赞
踩
注意:在通过ros使用usb摄像头追踪ArUco markers之前,先进行相机的内参标定,否则会出现以下问题
Error: TF_NAN_INPUT: Ignoring transform for child_frame_id "aruco_marker_frame" from authority "unknown_publisher" because of a nan value in the transform (nan nan 0.000000) (nan nan nan nan) at line 244 in /tmp/binarydeb/ros-indigo-tf2-0.5.20/src/buffer_core.cpp
mkdir -p ~/aruco_ws/src
cd ~/aurco_ws/src
git clone https://github.com/pal-robotics/aruco_ros.git
cd .. #回到目录 /aruco_ws
catkin_make install #编译
source devel/setup.bash
修改single.launch文件,将图像和相机信息重新映射到usb_cam节点发布的主题:
(如果使用的是realsense相机或者其他相机,可以先查看相机对应的话题修改以下参数)
<remap from=”/camera_info” to=”/usb_cam/camera_info” />
<remap from=”/image” to=”/usb_cam/image_raw” />
适当修改相应的camera_frame,marker_frame,reference_frame,修改结果如下:
<launch> <arg name="markerId" default="582"/> <arg name="markerSize" default="0.034"/> <!-- in m --> <arg name="eye" default="left"/> <arg name="marker_frame" default="aruco_marker_frame"/> <arg name="ref_frame" default="usb_cam"/> <!-- leave empty and the pose will be published wrt param parent_name --> <arg name="corner_refinement" default="LINES" /> <!-- NONE, HARRIS, LINES, SUBPIX --> <node pkg="aruco_ros" type="single" name="aruco_single"> <remap from="/camera_info" to="/usb_cam/camera_info" /> <remap from="/image" to="/usb_cam/image_raw" /> <param name="image_is_rectified" value="True"/> <param name="marker_size" value="$(arg markerSize)"/> <param name="marker_id" value="$(arg markerId)"/> <param name="reference_frame" value="$(arg ref_frame)"/> <!-- frame in which the marker pose will be refered --> <param name="camera_frame" value="usb_cam"/> <param name="marker_frame" value="$(arg marker_frame)" /> <param name="corner_refinement" value="$(arg corner_refinement)" /> </node> </launch>
/camera_info
: 填入相机的内参 topic,这个topic一般由启动相机的节点发布,例如我用的是 usb_cam 启动相机,他就会发布相机内参 topic。/image
: 图片 topic,同样我的也是由 usb_cam 发布的,要填什么具体看你这个节点的名字。reference_frame
: marker 坐标系的参考坐标系,我们要获得的是marker 和相机的相对位姿,所以这里设置为相机坐标系,即和 camera_frame 一样。camera_frame
: 相机坐标系,随便写个名字marker_frame
:marker 坐标系,随便写个名字Dictionary
:选择Original ArUco
,不然可能识别不到
Marker ID
:上面single.launch
文件中的markerId
Marker size
, mm:上面single.launch
文件中的markerSize
,注意单位
roslaunch usb_cam usb_cam-test.launch #根据实际的相机启动文件名进行修改
cd ~/aruco_ws
source devel/setup.bash
roslaunch aruco_ros single.launch
查看aruco_ros发布的话题
rostopic list
根据查看的话题订阅/aruco_single/result
查看可视化结果
rosrun image_view image_view image:=/aruco_single/result
订阅/aruco_single/pose
话题,并打印/marker_frame
在 /reference_frame
的位姿
rostopic echo /aruco_single/pose
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。