ROS
本章介绍在Ubuntu系统下的ROS平台中使用Mech-Eye SDK。
准备工作
|
准备工作
安装Ubuntu版本Mech-Eye SDK
安装方法参考在Ubuntu上安装Mech-Eye SDK。
安装ROS API
-
安装libzmq5和libzmq3-dev。
sudo apt install libzmq5 libzmq3-dev
-
创建
~/ros_ws/src
目录并进入该目录。mkdir -p ~/ros_ws/src && cd ~/ros_ws/src
-
将mecheye_ros_interface仓库克隆至~/ros_ws/src目录。
git clone https://github.com/MechMindRobotics/mecheye_ros_interface
-
进入~/ros_ws目录并构建代码。
cd ~/ros_ws && catkin_make
-
修改文件。
-
如需存储图片,请将~/ros_ws/src/mecheye_ros_interface/launch/start_camera.launch文件中此行
<arg name="save_file" default="true"/>
的false
更改为true
。 -
存储图片的路径可以在~/ros_ws/src/mecheye_ros_interface/src/main.cpp中进行修改。
-
运行服务
-
打开一个新终端,运行以下命令以开启服务。
source ~/ros_ws/devel/setup.bash roslaunch mecheye_ros_interface start_camera.launch
输出结果如下所示:
... logging to /home/mechmind/.ros/log/69ffe3a2-d290-11ec-828a-000c29351753/roslaunch-ubuntu-4349.log Checking log directory for disk usage. This may take a while. Press Ctrl-C to interrupt Done checking log file disk usage. Usage is <1GB. started roslaunch server http://ubuntu:38711/ SUMMARY ======== PARAMETERS * /mechmind_camera_start/camera_ip: 192.168.0.123 * /mechmind_camera_start/fx: 1727.46410256 * /mechmind_camera_start/fy: 1727.45869267 * /mechmind_camera_start/save_file: False * /mechmind_camera_start/u: 655.818082573 * /mechmind_camera_start/use_external_intri: False * /mechmind_camera_start/v: 516.630650061 * /rosdistro: melodic * /rosversion: 1.14.13 NODES / mechmind_camera_start (mecheye_ros_interface/start) auto-starting new master process[master]: started with pid [4359] ROS_MASTER_URI=http://localhost:11311 setting /run_id to 69ffe3a2-d290-11ec-828a-000c29351753 process[rosout-1]: started with pid [4370] started core service [/rosout] process[mechmind_camera_start-2]: started with pid [4377] Find Mech-Eye devices... Mech-Eye device index : 0 ............................ Camera Model Name: Mech-Eye Pro M Enhanced Camera ID: Sample Camera IP Address: 192.168.xx.xx Hardware Version: Vx.x.x Firmware Version: Vx.x.x ............................ Please enter the device index you want to connect: 0 Connected to the Mech-Eye device successfully. ............................ Camera Model Name: Mech-Eye Nano Camera ID: TAM06218A3020706 Camera IP Address: 192.168.xx.xx Hardware Version: Vx.x.x Firmware Version: Vx.x.x ............................
-
打开另一个新的终端,运行以下命令采集图片。
source ~/ros_ws/devel/setup.bash rosservice call /run_mechmind_camera
输出结果如下所示:
success: True message: ''
此时相机已经启用!2D图及深度图等数据默认保存在/tmp文件夹中。
每次修改~/ros_ws/src/mecheye_ros_interface/src下的文件,都需要执行cd ~/ros_ws && catkin_make更新可执行文件。 |