ROS入門-roslaunch控制遠(yuǎn)程程序啟動(dòng)

1. 配置本地ubuntu環(huán)境

sudo vim /etc/hosts (添加)

192.168.2.22    ubuntu0556
192.168.2.4 firefly

vim ~/.bashrc (添加)

export ROS_IP="192.168.2.22"
export ROS_HOSTNAME=ubuntu0556
export ROS_MASTER_URI=http://ubuntu0556:11311
export ROSLAUNCH_SSH_UNKNOWN=1

2. 配置firefly 環(huán)境

sudo vim /etc/hosts (添加)

192.168.2.22    ubuntu0556
192.168.2.4 firefly

vim ~/.bashrc (添加)

export ROS_HOSTNAME=firefly
export ROS_MASTER_URI=http://ubuntu0556:11311
export ROSLAUNCH_SSH_UNKNOWN=1

vim /opt/ros/indigo/joey_env.sh

#!/bin/sh
export ROS_IP=192.168.2.4 
export ROS_HOSTNAME=firefly
. /home/firefly/joey2/devel/setup.sh
exec "$@"

3. 編寫ubuntu端實(shí)例程序

參照之前編寫的talker/listener步驟編寫joey工作區(qū)下ex0316工作包
source 到當(dāng)前工作區(qū)下

4. 編寫firefly端實(shí)例程序

參照之前編寫的talker/listner步驟編寫joey2工作區(qū)下joey_talker工作包

5. ubuntu下編寫launch文件

vim ~/joey/src/ex0316/try.launch

<launch>
<machine name="firefly" address="firefly" user="firefly" password="firefly" env-loader="/opt/ros/indigo/joey_env.sh"/>
<node machine="firefly" name="talk" pkg="joey_talker" type="talker.py" output="screen" ns="a" />
<node name="talk" pkg="ex0316" type="talker.py" output="screen" />
<node name="list" pkg="ex0316" type="listener.py" output="screen" />
<node machine="firefly" name="list" pkg="joey_talker" type="listener.py" output="screen" ns="a" />
</launch>

6 運(yùn)行程序

roslaunch ex0316 try.launch

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容