ROS multi-robot Communication in detail, ros robot explanation

Source: Internet
Author: User

ROS multi-robot Communication in detail, ros robot explanation

The soul of ROS design lies in its distributed computing. An excellent node does not need to be considered on which machine it runs. It allows real-time allocation of computing workload to maximize the use of system resources. (There is a special case-the driver node must run on a machine with a physical connection to the hardware device ). Using ROS on multiple robots is a simple task. You only need to remember the following points:

1. You only need one master. You only need to run it on one machine.

All nodes must be connected to the same master by configuring ROS_MASTER_URI.

2. Any two machines must have a complete, bidirectional connection network between any two ports. (Refer to ROS/NetworkSetup ).

3. Each machine must broadcast the name it can resolve to another machine. (Refer to ROS/NetworkSetup ).

This article implements communication between two computers with ubantu and ROS.

Steps:

(1) Related Software Installation

(2) obtain the IP address and Host Name of the two hosts

(3) Configure ros to connect two computers and run the example

1. Related Software Installation

First of all, the two systems must install ROS, and then the synchronization package to synchronize the two systems.

sudo apt-get install chrony 

Ssh is required for system connection.

sudo apt-get install openssh-server
2. Get the IP address and Host Name of the two hosts

On two machines respectively

(1) view IP addresses

ifconfig

The desktop is 192.168.1.35.

The notebook is 192.168.1.6.

(2) view the Host Name

hostname 
3 configure ros to connect two computers and run the example

(1) first check whether the ssh of the two computers is enabled

ps -e|grep ssh 

If you see sshd, it indicates that the ssh-server has been started and will be restarted if it is not started.

sudo /etc/init.d/ssh restart 

(2) Use ssh to connect to your computer

Ping each other's computers first

ping 192.168.1.35

The following figure shows that the network is connected.

64 bytes from 192.168.1.6: icmp_seq=1 ttl=64 time=0.293 ms64 bytes from 192.168.1.6: icmp_seq=2 ttl=64 time=0.403 ms64 bytes from 192.168.1.6: icmp_seq=3 ttl=64 time=0.389 ms

Note that if the laptop is connected via wifi and the desktop is wired, the ping may fail. You need to ping the network.

Ssh connection configuration method.

Used on both Laptops and Desktops

Ssh username @ ip_address-p port

Connect to the other party's computer. After successful

(3) Configure ROS_MASTER_URI

Set the desktop ip address to 192.168.1.35 and the notebook ip address to 192.168.1.6.

(A) The desktop operations are as follows:

Set the desktop to master

Started only on the desktop

roscore

Create Console

export ROS_MASTER_URI=https://192.168.1.35:11311rosrun rospy_tutorials listener.py 

(B) perform the following operations on the notebook:

export ROS_MASTER_URI=https://192.168.1.35:11311rosrun rospy_tutorials talker.py 

Note that After configuring ROS_MASTER_URI, you can run roscore on ROS_MASTER_URI. Otherwise, running multiple roscores won't receive the signal.

The listener on the desktop receives the following message, indicating that the communication between different ros machines is successful.

Related Article

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.