在Ubuntu系统基于ROS使用废旧Android手机摄像头搭建监控设备

前端之家收集整理的这篇文章主要介绍了在Ubuntu系统基于ROS使用废旧Android手机摄像头搭建监控设备前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

在Ubuntu系统基于ROS使用废旧Android手机摄像头搭建监控设备

之前的博文介绍了一些使用android手机获取ROS中传感器,图像以及控制机器人小车的案例;

这里主要介绍如何让ROS获取手机摄像头数据并使用,这样就不用usb_cam等,并且大部分都有手机;

实验成本低,简洁易行。

手机端需要安装RTSP Server等IP Camera类型APP;

PC配置为Ubuntu 16.04 + ROS Kinetic,(14.04+indigo也可行)。

首先,下载功能包并配置,编译等,如下:

点击打开链接http://download.csdn.net/detail/zhangrelay/9799960

$ catkin_make

然后,source xxx/devel/setup.bash:

查看手机IP地址,并配置:

export ROCON_RTSP_CAMERA_RELAY_URL=rtsp://192.168.3.66:5540/ch0

注意,依据自己的端口和情况进行配置。如有必要配置ACL等。

这里用到的ROS功能包是rocon_rtsp_camera_relay

文件组织如下:

.
├── CHANGELOG.rst
├── CMakeLists.txt
├── env-hooks
│ └── 25.rocon-rtsp-camera-relay.sh.em
├── include
│ └── rocon_rtsp_camera_relay
│ └── rocon_rtsp_camera_relay.hpp
├── launch
│ └── rtsp_camera_relay.launch
├── package.xml
├── rapps
│ └── image_stream
│ ├── image_stream.launch.xml
│ └── image_stream.rapp
└── src
├── main.cpp
└── rocon_rtsp_camera_relay.cpp

7 directories,10 files


main.cpp

  1. #include<ros/ros.h>
  2. #include<rocon_rtsp_camera_relay/rocon_rtsp_camera_relay.hpp>
  3. intmain(intargc,char**argv)
  4. {
  5. ros::init(argc,argv,"rtsp_camera_relay");
  6. ros::NodeHandlepnh("~");
  7. std::stringvideo_stream_url,user,password;
  8. pnh.getParam("video_stream_url",video_stream_url);
  9. rocon::RoconRtspCameraRelayrtsp(pnh);
  10. ROS_INFO("RtspCamera:Initialising..");
  11. if(!rtsp.init(video_stream_url))
  12. {
  13. ROS_ERROR("RtspCamera:Failedtoinitialisestream");
  14. return-1;
  15. }
  16. ROS_INFO("RtspCamera:Initialised");
  17. rtsp.spin();
  18. ROS_INFO("RtspCamera:ByeBye");
  19. return0;
  20. }


可以知道只需要配置合适IP即可使用非常方便。

rocon_rtsp_camera_relay.cpp参考源码。


具体使用说明:

1 先启动手机端:


配置后打开:




2 PC端

运行如下命令:

$ roslaunch rocon_rtsp_camera_relay rtsp_camera_relay.launch --screen

如果没有报错,可以看到下面结果,如果报错,依据错误排查问题:

... logging to /home/relaybotBox/.ros/log/7fabe4ea-15c5-11e7-bd22-00e0b4159b09/roslaunch-relaybotBox-desktop-10439.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://192.168.3.18:34861/
SUMMARY
========
PARAMETERS
* /rosdistro: kinetic
* /rosversion: 1.12.6
* /rtsp_camera_relay/video_stream_url: rtsp://192.168.3....

NODES
/
rtsp_camera_relay (rocon_rtsp_camera_relay/rocon_rtsp_camera_relay_node)

auto-starting new master
process[master]: started with pid [10450]
ROS_MASTER_URI=http://localhost:11311
setting /run_id to 7fabe4ea-15c5-11e7-bd22-00e0b4159b09
process[rosout-1]: started with pid [10464]
started core service [/rosout]
process[rtsp_camera_relay-2]: started with pid [10472]
[ INFO] [1490932367.742812354]: Rtsp Camera : Initialising..
[ INFO] [1490932369.181637729]: Rtsp Camera : Initialised



这里可以看到,最后显示Initialised,已经可以ROS已经可以查看手机的摄像头视频了:

使用一些工具可以查看具体信息,如下:

$ rostopic list
/rosout
/rosout_agg
/rtsp_camera_relay/camera_info
/rtsp_camera_relay/image
/rtsp_camera_relay/image/compressed
/rtsp_camera_relay/image/compressed/parameter_descriptions
/rtsp_camera_relay/image/compressed/parameter_updates
/rtsp_camera_relay/image/compressedDepth
/rtsp_camera_relay/image/compressedDepth/parameter_descriptions
/rtsp_camera_relay/image/compressedDepth/parameter_updates
/rtsp_camera_relay/image/theora
/rtsp_camera_relay/image/theora/parameter_descriptions
/rtsp_camera_relay/image/theora/parameter_updates
/rtsp_camera_relay/status






手机不仅可以很方便的获取ROS中摄像头的数据,ROS也可以很方便的获取手机摄像头的数据。

机器翻译参考:

概述

实时流协议(即RTSP)是IP摄像机(例如foscam)使用的网络控制协议该包桥接从ip摄像机转换流图像,并将其提供为ROS主题@H_369_502@

安装

 > sudo apt-get install ros- <distro> -rocon-rtsp-camera-relay

执行

 > export ROCON_RTSP_CAMERA_RELAY_URL = rtsp://您的IPCAM URL  > roslaunch rocon_rtsp_camera_relay rtsp_camera_relay.launch - 屏幕


~End~

原文链接:https://www.f2er.com/ubuntu/351430.html

猜你在找的Ubuntu相关文章