ubuntu系统配置大恒相机驱动并读取ros话题

文章目录

  1. 说明
  2. 安装大恒相机sdk
    1.1 下载
    1.2 安装sdk(用于配置ip和调试相机参数)
    (1) 电脑网卡配置(网卡固定ip)
    (2)查看相机图像以及配置相机参数
  3. 安装ros驱动包(注:大恒相机官方没ros驱动)
    2.0 正确流程
    2.1 错误示范
    2.1 报错1—缺包
    2.2 报错2—包编译顺序问题,改catkin_makecatkin build
  4. 说明
    本机: ubuntu18.04 x86/64系统
    相机: 水星二代 MER
    应该也适用于ubuntu的其他版本
    大恒相机sdk跟系统有关,可以到官网上下载其他架构(如 arm)
    ros驱动包不清楚跟系统有没有关系,目前自己没在arm架构上尝试

1. 安装大恒相机sdk

1.1 下载

官网
下载: Galaxy Linux-x86-Gige-U3 SDK_CN-EN,其他操作系统自己查看

1.2 安装sdk(用于配置ip和调试相机参数)

进入目录/Galaxy_Linux-x86_Gige-U3_32bits-64bits_1.5.2303.9221

chmod +x ./Galaxy_camera.run
./Galaxy_camera.run

依次EnterYY``E(En是英文,Cn是中文)

需要重启和重新插拔相机

All configurations will take effect after the system is rebooted
If you don't want to reboot the system for a while
you will need to unplug and replug the camera.

(1) 电脑网卡配置(网卡固定ip)
本机以太网网卡名称: enp3s0
本机有线ip地址为 192.168.1.102
sudo ifconfig enp3s0 192.168.1.102 netmask 255.255.255.0
先修改相机ip

cd /home/meng/ivrc/daheng_ws/Galaxy_Linux-x86_Gige-U3_32bits-64bits_1.5.2303.9221/Galaxy_camera/bin
./GxGigeIPConfig

点击自动配置ip后,ip会配置在一个网段,然后可以手动修改ip,这里修改为192.168.1.108
注意可访问状态变成可读和可写即为成功

(2)查看相机图像以及配置相机参数

cd /home/meng/ivrc/daheng_ws/Galaxy_Linux-x86_Gige-U3_32bits-64bits_1.5.2303.9221/Galaxy_camera/bin
./GalaxyView

会有下面的failed,但不影响


2. 安装ros驱动包(注:大恒相机官方没ros驱动)

2.0 正确流程

需要额外下载rm_control包以及替换https://github.com/qiayuanliao/galaxy_camera中建议的catkin_make
为catkin build

创建工作空间,在src里面下载:https://github.com/qiayuanliao/galaxy_camera

mkdir -p galaxy_camera_ws/src
cd galaxy_camera_ws/src
git clone https://github.com/qiayuanliao/galaxy_camera.git
git clone https://github.com/rm-controls/rm_control.git
cd ..
catkin build
source devel/setup.bash
roslaunch galaxy_camera MER-139.launch


另起终端查看图像话题rosrun rqt_image_view rqt_image_view,这里比较模糊,需要在前面1.2 (2)里面调整相机参数

2.1 错误示范

创建工作空间,在src里面下载:https://github.com/qiayuanliao/galaxy_camera

mkdir -p galaxy_camera_ws/src
cd galaxy_camera_ws/src
git clone https://github.com/qiayuanliao/galaxy_camera
cd ..
catkin_make

2.2 报错1–缺包

  Could not find a package configuration file provided by "rm_msgs" with any
  of the following names:

    rm_msgsConfig.cmake
    rm_msgs-config.cmake

缺少包,到https://github.com/rm-controls/rm_control下载,并放在src目录下面

cd galaxy_camera_ws/src
git clone https://github.com/rm-controls/rm_control.git
cd ..
catkin_make

2.3 报错2–包编译顺序问题,改catkin_make为catkin build

galaxy_camera/include/galaxy_camera.h:16:10: fatal error: rm_msgs/EnableImuTrigger.h: 没有那个文件或目录
 #include <rm_msgs/EnableImuTrigger.h>

https://github.com/rm-controls/rm_control,查看EnableImuTrigger是一个文件还是生成的文件

如上图,发现确实在rm_msgs包编译时生成了EnableImuTrigger.h;上述报错应该是有与包的编译顺序问题,需要先编译rm_msgs,再编译galaxy_camera