Distributed operation Method of ROS nodes

Source: Internet
Author: User

I. Host Master settings

1. Install the SSH client and server (Ubuntu is installed by default)

2. Machine name and IP binding

due to the need to bind the computer name and IP in /etc/hosts , it is best to set the IP address as the static address

sudo nano/etc/hosts

Add Master's IP address and machine name eg:192.168.3.155 Wang

Add slave IP address and machine name eg:192.168.3.156 Han (Master does not add this item as if it is OK, slave need to add this item)

3. To be on the safe side Modify the machine name in the/etc/hostname with the user name

sudo nano/etc/hostname

Change Wang-desktop to Wang (same user name)

Use sudo nano/etc/hosts to change the wang-desktop to Wang

4.export ros_master_uri= "http://wool:11311"

Two. Slave settings

1.1.2.3.4 with Master

Three. Start using

Hypothesis: Master Slave

Hal Marvin

Listener Talker

1. Start [[Master]]

We need to select a machine to run master, here we choose hal. the first step in starting master is :

SSH HalRoscore

2. Start Listener

Next we start the listener on the machine Hal and configure the Ros_master_uriso that we can use the MASTER that just started:

SSH Halexport ros_master_uri=http://hal:11311rosrun rospy_tutorials listener.py 

3. Start Talker

Now we're going to start talker on the Marvin Machine, as well by configuring the Ros_master_uri to use MASTER on the Hal machine:

SSH Marvinexport ros_master_uri=http://hal:11311rosrun rospy_tutorials talker.py 

Small surprise: Now you can see that the listener on the machine Hal is receiving messages from talker released on the Marvin Machine

Note: If you are running a node on this machine, you can use SSH

Four. Configuration if the node is not on the same machine

There are several ways to run nodes on different machines, and the easy way is to start them separately on each machine. Another way is to use the launch file to start these nodes uniformly, as follows:

<launch>

<include file= "Bzrobot.machine" >

<node pkg= "rospy_tutorials" type= "listener.py" name= "listener" machine= "wool"/>

<node pkg= "rospy_tutorials" type= "talker.py" name= "talker" machine= "Wooa"/>

</launch>

Machine Label

< Span lang= "ZH-CN" > create machine tags, To facilitate the node assign to a different Machine

<launch>

<machine name= "wool" address= "wool" env-loader= "/opt/ros/indigo/env.sh" default= "true"/>

<machine name= "Wooa" address= "Wooa" env-loader= "/opt/ros/indigo/env.sh"/>

</launch>


env.sh environment variable settings

< Span lang= "ZH-CN" > use env.sh node Machine

#!/bin/sh


Exportroslaunch_ssh_unknown=1

#exportROS_MASTER_URI =wool


./opt/ros/indigo/setup.sh


exec "[Email protected]"


Distributed operation Method of ROS nodes

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.