1. 配置本地ubuntu環境
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 環境
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端實例程序
參照之前編寫的talker/listener步驟編寫joey工作區下ex0316工作包
source 到當前工作區下
4. 編寫firefly端實例程序
參照之前編寫的talker/listner步驟編寫joey2工作區下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 運行程序
roslaunch ex0316 try.launch