< >
Home » ROS与传感器教程 » ROS与传感器教程-整合网络摄像头

ROS与传感器教程-整合网络摄像头

ROS与传感器教程-整合网络摄像头

说明:

  • 介绍ros下如何整合网络摄像头
  • 准备网络摄像头,能通过rstp来访问

步骤:

  • 假设网络摄像头的rstp访问地址为:
rtsp://10.6.3.57:554/user=admin&password=&channel=1&stream=0.sdp?
  • RTSP格式:
10.6.3.57这个是被连接的设备的IP
:554这个是RTSP服务的端口号,可以在设备的网络服务里面更改
user=admin这个是设备的登录用户名
password= 密码空
channel=1 第一通道
stream=0.sdp?主码流
stream=1.sdp?副码流
  • 安装ros驱动
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src
git clone https://github.com/robotics-in-concert/rocon_devices
cd ..
catkin_make 
source devel/setup.bash 
  • 也可以添加工作空间到bashrc文件下
echo "source ~/catkin_ws/devel/setup.bash"   >> ~/.bashrc 
  • 添加rtsp来源变量到bashrc:
echo 'export ROCON_RTSP_CAMERA_RELAY_URL="rtsp://10.6.3.57:554/user=admin&password=&channel=1&stream=0.sdp?"' >> ~/.bashrc 
  • 启动launch
roslaunch rocon_rtsp_camera_relay rtsp_camera_relay.launch --screen
  • 效果如下:
ubuntu@RACEBOT-V102-VM:~$ roslaunch rocon_rtsp_camera_relay rtsp_camera_relay.launch --screen
... logging to /home/ubuntu/.ros/log/2da1bd62-fa6f-11eb-b34e-000c2921a51c/roslaunch-RACEBOT-V102-VM-7171.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://localhost:33795/

SUMMARY
========

PARAMETERS
 * /rosdistro: kinetic
 * /rosversion: 1.12.14
 * /rtsp_camera_relay/video_stream_url: rtsp://192.168.0....

NODES
  /
    rtsp_camera_relay (rocon_rtsp_camera_relay/rocon_rtsp_camera_relay_node)

auto-starting new master
process[master]: started with pid [7181]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to 2da1bd62-fa6f-11eb-b34e-000c2921a51c
process[rosout-1]: started with pid [7200]
started core service [/rosout]
process[rtsp_camera_relay-2]: started with pid [7206]
[ INFO] [1628664098.685374352]: Rtsp Camera : Initialising..
[ INFO] [1628664099.857022174]: Rtsp Camera : Initialised
  • 读取图像
rqt_image_view
  • 选择对应话题/rtsp_camera_relay/image
  • 效果如下:

请输入图片描述

纠错,疑问,交流: 请进入讨论区点击加入Q群

获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号


标签: ros与传感器教程