当前位置:网站首页>ROS知识:如何实现相机接入
ROS知识:如何实现相机接入
2022-04-21 19:39:00 【无水先生】
一、说明
将相机接入ros系统,ROS的基本功能;实现接入相机需要什么准备?
1)准备一个USB相机;
2)安装好的Ubuntu20.04、ros-neotic
二、安装usb_cam ROS 功能包
2.1 生成工作空间
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src
2.2 从git-hub下载驱动包
进入创建好的工作空间:
cd ~/catkin_ws/src
git clonehttps://github.com/bosch-ros-pkg/usb_cam.git
2.3 编译
然后退回到工作空间,编译代码:
cd~/catkin_ws
catkin_make
编译好之后,添加编译好的文件到环境变量:
source devel/setup.bash
2.4 测试usb_cam
先运行usb_cam节点:
rosrun usb_cam usb_cam_node
运行上面命令发现摄像头被打开了。这是因为ros发布的topic是/usb_cam/image_raw。
新打开一个终端,通过如下命令查看:
rostopic list
结果如下:
/rosout
/rosout_agg
/usb_cam/camera_info/usb_cam/image_raw
/usb_cam/image_raw/compressed
/usb_cam/image_raw/compressed/parameter_descriptions
/usb_cam/image_raw/compressed/parameter_updates
/usb_cam/image_raw/compressedDepth
/usb_cam/image_raw/compressedDepth/parameter_descriptions
/usb_cam/image_raw/compressedDepth/parameter_updates
/usb_cam/image_raw/theora
/usb_cam/image_raw/theora/parameter_descriptions
/usb_cam/image_raw/theora/parameter_updates
2.5 打开一个观看图像的节点
我们需要运行如下命令才可以看到图像:
rosrun image_view image_view image:=/usb_cam/image_raw

2.6 用launch文件打开
直接写launch文件,这样就不用一个终端运行node,一个终端看图像。新建usb_cam_test.launch:
<launch>
<node name="usb_cam" pkg="usb_cam" type="usb_cam_node" output="screen" >
<param name="video_device" value="/dev/video0" />
<param name="image_width" value="640" />
<param name="image_height" value="480" />
<param name="pixel_format" value="yuyv" />
<param name="camera_frame_id" value="usb_cam" />
<param name="io_method" value="mmap"/>
</node>
<node name="image_view" pkg="image_view" type="image_view" respawn="false" output="screen">
<remap from="image" to="/usb_cam/image_raw"/>
<param name="autosize" value="true" />
</node>
</launch>
然后终端直接运行:
roslaunch usb_cam usb_cam_test.launch
三、参考文章
ROS系统下调用笔记本摄像头和USB摄像头_berry丶的博客-CSDN博客_ros打开笔记本摄像头
ROS入门:ROS下使用电脑相机运行ORB_Slam2 - 古月居 (guyuehome.com)
安装usb_cam ROS 功能包 - 简书 (jianshu.com)
在ROS中使用相机_我才睡醒的博客-CSDN博客_ros 相机
版权声明
本文为[无水先生]所创,转载请带上原文链接,感谢
https://yamagota.blog.csdn.net/article/details/124244474
边栏推荐
- Some keywords of the robotframework cannot be used or are black
- Distributed transaction Foundation
- 联想承诺 2025 年全线计算机产品 100% 含再生塑料
- Conan软件包管理器的Qt 6.2.4软件包
- 5.1 overview of triggers in fundamentals of digital electronic technology
- register关键字的使用
- Huawei developer Innovation Center teaches you one minute to understand harmonyos
- Instruction of crystal Chem active GIP ELISA Kit
- Overview of relational database and non relational database, introduction to redis, common commands and optimization
- 31 - Gru principle and source code line by line implementation
猜你喜欢

Installing MySQL 8 on Linux centos7 (simple and practical)

Instruction of crystal Chem active GIP ELISA Kit

影响VPS网站优化的因素有哪些?

int count= cmd.ExecuteNonQuery();附近有一条语法错误

Abbexa donkey anti goat IgG (H & L) antibody

iMeta | EndNote调整完美引文格式教程(视频)

Redis基础

RobotFramework部分关键字无法使用或关键字为黑色

Robot framework log output Chinese garbled code

Distributed transaction Foundation
随机推荐
redis安装与配置开机自启
Rk3399 - add USB to serial driver
leetcode344. 反转字符串
leetcode18. 四数之和
leetcode18. Sum of four numbers
Switch branch
Redis installation and configuration startup
Engineering method for improving model speed / accuracy
【JZ47 礼物的最大价值】
Connection of Navicat Mysql to MySQL under Linux and 2003 error resolution
使用CMake构建/在命令行上构建项目
关系型数据库与非关系型数据库概述,Redis简介、常用命令及优化
Frame rate, code rate, resolution and definition
Stm32cupeide / stm32cupemx USB link w25qxx as USB flash disk
Automatic control principle Chapter 5 - frequency method (mind map)
669. Pruning binary search tree
知识点合集
使用CMake构建/Qt 5和Qt 6兼容性
Chekine series high density lipoprotein (HDL-C) content detection scheme
Mysql database index interview questions (latest version)