写在前面:
欢迎光临 清流君 的博客小天地,这里是我分享技术与心得的温馨角落。
人生如戏,我们并非能选择舞台和剧本,但我们可以选择如何演绎 感谢您的支持与关注,让我们一起在知识的海洋中砥砺前行~~~
文章目录
- 引言
- 一、准备工作
- 1.1 安装 usb_cam 驱动
- 1.2 安装相机标定功能包
- 1.3 准备标定板和 USB 摄像头
- 二、相机标定
- 2.1 启动摄像头驱动节点
- 2.2 确定相机编号
- 2.3 查看启动的设备是否正确
- 2.4 运行相机标定节点
- 2.5 移动标定板或摄像头
- 2.6 得到标定结果
- 2.7 保存保定数据
- 三、对焦问题
- 3.1 启动摄像头存在的警告
- 3.2 对焦问题的可能原因
- 四、运行Apriltag_ros
- 4.1 安装 Apriltag 依赖
- 4.2 安装 Apriltag_ros 功能包
- 4.3 修改配置文件
- 4.4 运行Apriltag_ros
- (1) 启动 USB 相机驱动
- (2) 运行 AprilTag_ros 算法
- (3) RViz 可视化界面
- (4) 输出定位数据
- 五、总结
- 参考资料
引言
上一篇博客介绍了虚拟机 Ubuntu18.04
安装 USB 摄像头 ROS 驱动 usb_cam 的最新方法,本篇博客讲解如何使用 ROS 驱动的 USB 摄像头进行相机标定与 AprilTag 识别。
一、准备工作
1.1 安装 usb_cam 驱动
系统环境:Ubuntu18.04
本教程是基于 usb_cam 包读取图像,因此需要提前安装 usb_cam 驱动,参见:
【Ubuntu】虚拟机安装USB摄像头ROS驱动 usb_cam(最新方法)
1.2 安装相机标定功能包
安装 camera_calibration
功能包:
1.3 准备标定板和 USB 摄像头
一个通过 ROS 发布图像的单目 USB 摄像头。
二、相机标定
2.1 启动摄像头驱动节点
2.2 确定相机编号
确定使用的video_id
,使用如下命令查看:
一般笔记本电脑自带的摄像头 id
为
id
为
usb_cam/src/usb_cam/launch/usb_cam-test.launch
里面的
。
尝试启动摄像头。
但是博主这样写会报错:
… logging to /home/qingliu/.ros/log/0976c44a-7583-11ef-82de-000c293e3ad5/roslaunch-qingliu-4538.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://localhost:44077/
SUMMARY
========
PARAMETERS
- /image_view/autosize: True
- /rosdistro: melodic
- /rosversion: 1.14.13
- /usb_cam/camera_frame_id: usb_cam
- /usb_cam/color_format: yuv422p
- /usb_cam/image_height: 480
- /usb_cam/image_width: 640
- /usb_cam/io_method: mmap
- /usb_cam/pixel_format: yuyv
- /usb_cam/video_device: /dev/video1
NODES
/image_view (image_view/image_view)
usb_cam (usb_cam/usb_cam_node)
ROS_MASTER_URI=http://localhost:11311
process[usb_cam-1]: started with pid [4558]
process[image_view-2]: started with pid [4559]
[ INFO] [1726639123.930729617]: Initializing nodelet with 4 worker threads.
[ INFO] [1726639124.024001715]: Using transport “raw”
[ INFO] [1726639124.046743699]: using default calibration URL
[ INFO] [1726639124.047399791]: camera calibration URL: file:///home/qingliu/.ros/camera_info/head_camera.yaml
[ INFO] [1726639124.047502595]: Unable to open camera calibration file [/home/qingliu/.ros/camera_info/head_camera.yaml]
[ WARN] [1726639124.047555944]: Camera calibration file /home/qingliu/.ros/c