Communications - osrf/mbzirc GitHub Wiki

A robot has the ability to send data to one robot of the team. Next are the main communication features available:

  • Packets are sent over a single hop, similar to UDP. No MANET algorithm or other packet relay systems are provided. Teams can implement their own relay systems if they like.
  • If two robots are within communication range, then one can try send a packet to the other.
  • There is a maximum range beyond which two robots are not neighbors (and thus cannot communicate directly).
  • When a robot tries to send a packet to a neighbor, that packet is dropped with some probability.
  • There is a maximum data rate allowed among robots communicating over the same network segment (e.g.: 1 Gbps).

Addresses

Each robot has an address associated that matches its robot name (e.g.: quadrotor_1, quadrotor_2).

How to receive data

Data is received via a regular ROS 2 topic. For each robot, the topic <ROBOT_NAME>/rx has been preconfigured to receive data. You only need to subscribe to this topic to receive any messages sent to you by other robot. Here's an example to receive messages using the command line (from the perspective of quadrotor_2):

ros2 topic echo /quadrotor_2/rx

Note that the message received is a ros_ign_interfaces/Dataframe. You can check the src_address to know the address of the sender. The dst_address field should match your own address. The data field contains serialized data. It's your responsibility to unserialize the data.

How to send data

You need to populate a ros_ign_interfaces/Dataframe message before publishing. Note that src_address must be filled with your own address (your model name). The dst_address field should be filled with the name of the destination robot. The data field contains the serialized payload of your data. The communication infrastructure does not know anything about what's inside the payload field. It's your responsibility to serialize it at the sender and deserialize it at destination.

When the message is populated, you can publish it on the preconfigured ROS 2 topic <ROBOT_NAME>/tx. Here's an example of message publication using the command line with no data (from the perspective of quadrotor_1):

ros2 topic pub quadrotor_1/tx ros_ign_interfaces/Dataframe '{src_address: "quadrotor_1", dst_address: "quadrotor_2"}'
⚠️ **GitHub.com Fallback** ⚠️