记录---在ROS中打开网络摄像机

前言

使用设备:Ubuntu18.04,大华热成像网络摄像机。

大华网络摄像机RTSP格式:

rtsp://username:password@ip:port/cam/realmonitor?channel=1&subtype=0
说明:
username: 用户名。例如admin。
password: 密码。例如admin。
ip: 为设备IP。例如 10.7.8.122。
port: 端口号默认为554,若为默认可不填写。
channel: 通道号,起始为1。例如通道2,则为channel=2。
subtype: 码流类型,主码流为0(即subtype=0),辅码流为1(即subtype=1)。


一、参考文章

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

https://www.ncnynl.com/archives/202108/4537.html

2,在Ubuntu系统基于ROS使用废旧Android手机摄像头搭建监控设备:https://blog.csdn.net/u010925447/article/details/77836205

二、操作步骤

1.下载功能包

资源可以在GitHub上下载:https://github.com/robotics-in-concert/rocon_devices

下载完毕后,可以单独使用rocon_devices/rocon_rtsp_camera_relay/功能包

rocon_rtsp_camera_relay功能包放置在自己的工作空间下,例如demo02_ws/src目录下。

之后在此工作空间下进行编译操作:

catkin_make
source devel/setup.bash

然后添加rtsp来源变量到.bashrc文件中:

echo 'export ROCON_RTSP_CAMERA_RELAY_URL="rtsp://username:password@ip:port/cam/realmonitor?channel=1&subtype=0"' >> ~/.bashrc 

可以在主目录中查看.bashrc文件是否添加成功:

启动launch文件:

roslaunch rocon_rtsp_camera_relay rtsp_camera_relay.launch --screen

效果如下:

roslaunch rocon_rtsp_camera_relay rtsp_camera_relay.launch --screen
... logging to /home/rose/.ros/log/9847cc02-eb26-11ed-b8da-000c2986565f/roslaunch-rose-virtual-machine-98800.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://rose-virtual-machine:42083/

SUMMARY
========

PARAMETERS
 * /rosdistro: melodic
 * /rosversion: 1.14.13
 * /rtsp_camera_relay/video_stream_url: rtsp://admin:fire...

NODES
  /
    rtsp_camera_relay (rocon_rtsp_camera_relay/rocon_rtsp_camera_relay_node)

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

setting /run_id to 9847cc02-eb26-11ed-b8da-000c2986565f
process[rosout-1]: started with pid [98833]
started core service [/rosout]
process[rtsp_camera_relay-2]: started with pid [98840]
[ INFO] [1683278652.210586888]: Rtsp Camera : Initialising..
[ INFO] [1683278653.557247534]: Rtsp Camera : Initialised

2.查看图像

另外打开一个窗口,读取图像:

rqt_image_view 

效果如下:

踩坑记录:

我是直接按照所参考的文章1,按照步骤进行的操作,但是出现了如下错误:

 进行了多次尝试修改,无论是重新编译还是修改文件,奈何还是不行。

然后通过文章2有了新发现,尝试把rocon_rtsp_camera_relay功能包单独拿出来放在工作空间下,再进行编译操作,就成功了。

  • 2
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值