使用ARUCO识别二维码获取位置信息
1、安装软件
cd ~/catkin_ws/src
git clone -b kinetic-devel https://github.com/pal-robotics/aruco_ros
cd …
catkin_make
在编译时遇到一个错误
/home/wgq/catkin_wgq/src/aruco_ros/aruco_ros/src/simple_double.cpp: In function ‘void image_callback(const ImageConstPtr&)’:
/home/wgq/catkin_wgq/src/aruco_ros/aruco_ros/src/simple_double.cpp:161:78: error: ‘CV_FILLED’ was not declared in this scope
v::circle(inImage, cv::Point(u[0], v[0]), 3, cv::Scalar(0, 0, 255), CV_FILLED);
^~~~~~~~~
/home/wgq/catkin_wgq/src/aruco_ros/aruco_ros/src/simple_double.cpp:161:78: note: suggested alternative: ‘__FILE’
v::circle(inImage, cv::Point(u[0], v[0]), 3, cv::Scalar(0, 0, 255), CV_FILLED);
^~~~~~~~~
__FILE
aruco_ros/aruco_ros/CMakeFiles/double.dir/build.make:62: recipe for target ‘aruco_ros/aruco_ros/CMakeFiles/double.dir/src/simple_double.cpp.o’ failed
make[2]: *** [aruco_ros/aruco_ros/CMakeFiles/double.dir/src/simple_double.cpp.o] Error 1
CMakeFiles/Makefile2:2507: recipe for target ‘aruco_ros/aruco_ros/CMakeFiles/double.dir/all’ failed
make[1]: *** [aruco_ros/aruco_ros/CMakeFiles/double.dir/all] Error 2
Makefile:140: recipe for target ‘all’ failed
解决方法:CV_FILLED直接-1
2、测试aruco标签
首先把launch文件里mark的ID和尺寸对应上,相机发布的主题对应上
Mark标签可以到https://chev.me/arucogen/打印
启动usb相机
roslaunch usb_cam usb_cam.launch
启动单标签
roslaunch aruco_ros single.launch
launch文件里相机的主题要对应上
可以用rqt查看,如图识别出正确mark即可
3、获取位置信息
双目相机标定,已经标定好的usb相机可以直接使用
到工程src文件夹下
git clone https://github.com/ros-perception/image_pipeline.git
编译成功后即可以使用标定包,注意尺寸和点位的对应
rosrun camera_calibration cameracalibrator.py --size 8x6 --square 0.108 right:=/my_stereo/right/image_raw left:=/my_stereo/left/image_raw left_camera:=/my_stereo/left right_camera:=/my_stereo/right
可到以下地址下载标定板
http://wiki.ros.org/camera_calibration/Tutorials/MonocularCalibration?action=AttachFile&do=view&target=check-108.pdf
变换标定板位置,在相机视野的上下左右,倾斜水平,直到所有项目都为绿色条
再次运行标签识别
roslaunch aruco_ros single.launch
查看位姿.launch文件里标签ID要对应,
rostopic echo /aruco_single/pose
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)