1.开启笔记本摄像头
2.打开roscore
roscore
3.打开摄像头
cd sc_localization_ws/src/usb_cam/launch //到达 usb_cam-test.launch所在的文件夹
roslaunch usb_cam-test.launch
3.标定
rosrun camera_calibration cameracalibrator.py --size 8x6 --square 0.027 image:=/usb_cam/image_raw camera:=/usb_cam
(1)size:标定棋盘格的内部角点个数,这里使用的棋盘一共有六行,内部8个角点;
其中参数size 8x6 注意是字母x,是指棋盘内部角点个数
(2)square:这个参数对应每个棋盘的边长,单位是米;
(3)image和camera:设置摄像头发布的图像话题。
(4)
x:标定板在图像中的左右位置,从左到右x由小变大。
y:标定板在图像中的上下位置,从上到下y由小变大。
Size:标定板在图像中的大小,由远及近,Size由小变大。
Skew:标定板在图像中倾斜的角度大小
cd sc_localization_ws/src/apriltag_ros/apriltag_ros/launch/
roslaunch continuous_detection.launch
在路径~/sc_localization_ws/src/apriltag_ros/apriltag_ros/config/路径修改配置文件
将setting.yaml 中的publish_tf:后的false改成true
将tags.yaml中添加apriltag的位置
将sc_localization_ws/src/apriltag_ros/apriltag_ros/launch路径上的continuous_detection.launch中圈起来的后两行。
根据自己摄像头发布的topic更改,和摄像头的topic一致才能订阅到摄像头的图像信息。
6.新打开一个终端
cd sc_localization_ws/
source devel_isolated/setup.bash
rqt_image_view
对于上面的source
可以
gedit ~/.bashrc
在最后加上source的命令,就可以一劳永逸了。
7.发布topic
rostopic echo /tag_detections
8.打开可视化窗口
rviz