美文网首页
ROS远程遥控摄像头采集

ROS远程遥控摄像头采集

作者: joey_zhou | 来源:发表于2016-05-24 11:02 被阅读271次

硬件环境: Firefly控制板、X86控制板
编程语言:cpp

通信过程:

x86上有运行无误的ros摄像头视频采集节点,firefly控制板上有同主题下视频显示节点。通过firefly中的roslaunch运行程序,x86摄像头数据通过远程实时显示在firefly控制板中,整个过程无不需要x86执行任何代码,所有控制操作均有roslaunch执行。

操作步骤:

1.基础环境配置:

x86摄像头程序配置--见《ROS摄像头使用说明》
----示例中程序包:cam_test_own 程序名称video_publisher.cpp

firefly视频显示程序配置--见《Firefly间ros视频流使用说明》
----示例中程序包:image_transport_tutorial 程序名称my_subscriber.cpp

2.远程操作环境配置:

以firefly作为master配置两台机器,使机器之间可以进行远程通信。
----详见《ROS-wifi及以太网通信》中远程环境配置部分

3.远程遥控环境配置:

x86配置:

sudo vim /opt/ros/indigo/joey_env.sh
#!/bin/sh

export ROS_IP=192.136.20.147  
export ROS_HOSTNAME=zyy-desktop
#填写实际ip地址与主机名
. /home/zyy/test_myself/devel/setup.sh
#填写需要运行程序所在工作区的setup.sh
exec "$@"

Firefly 配置:

运行下面的命令或者将下面的命令增加在 ~/.bashrc中

export ROSLAUNCH_SSH_UNKNOWN=1

4.Firefly中编写launch文件:

vim mulit_control.launch

<launch>
  <machine name="zyy" address="192.168.20.147" user="zyy" password="ubuntu" env-loader="/opt/ros/indigo/joey_env.sh" />
    <node machine="zyy" name="videopubstream" pkg="cam_test_own" type="video_publisher" output="screen" ns="image_publisher">
    <param name="image_transport" value="compressed"/>
    </node>
    <node name="videosubstream" pkg="image_transport_tutorial" type="my_subscriber" output="screen" ns="image_publisher">
    <param name="image_transport" value="compressed"/>
    </node>
</launch>

其中 machine name中name随意,address填写x86的地址 user 与password 为x86中用户名与密码(最好是使用证书登录)env-loader="/opt/ros/indigo/joey_env.sh 是上一节中配置的环境参数。
对于在远程运行的节点只需在 <node ......>中填好 mechine name为配置的mechine即可。

5.运行程序

source 到当前工作区
roslaunch image_transport_tutorial mulit_control.launch

相关文章

网友评论

      本文标题:ROS远程遥控摄像头采集

      本文链接:https://www.haomeiwen.com/subject/jzlzrttx.html