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