In this scenario, we consider the problem of simulation of multiple agents using multiple host computers on a local network. For connecting computers that are not on the same network, please consider https://mit-aera.atlassian.net/wiki/x/AYDQEw.
ROS Multi Computer Setup
As an example, let’s consider a simple setup with two computers. We designate one computer as the primary and the other as secondary. First, we need to record the IP addresses and hostnames of the two computers. As an example consider that the first computer has the hostname primary
and the second computer has the hostname secondary
. Let’s further assume that the ip addresses are primary.ip.address
and secondary.ip.address
.
For this tutorial, please replace every instance of primary and secondary with the hostnames of your setup and similarly primary.ip.address and secondary.ip.address with the IP addresses of your setup.
In both computers, edit /etc/hosts/
to add the lines
primary.ip.address primary secondary.ip.address secondary
To test the networking, you can check that the primary
computer can ping the secondary
by running
ping secondary
and vice versa.
On the first computer run
export ROS_MASTER_URI=primary:11311 roscore
On the second computer run
export ROS_MASTER_URI=primary:11311
Launch Files
To generate the launch files required, we provide a simple convenience script flightgoggles/script/generate_launch.py
. An example configuration file (flightgoggles/script/vehicle_model.yaml
) is provided below.
filename: multiVehicle.launch renderer: 0: ip: "primary.ip.address" inputPort: "10253" outputPort: "10254" 1: ip: "secondary.ip.address" inputPort: "10255" outputPort: "10256" vehicle_models: uav1: type: flightgoggles_uav_dynamics config_dynamics: config/drone/drone.yaml enable_teleop: true renderer: 0 uav2: type: flightgoggles_uav_dynamics config_dynamics: config/drone/drone.yaml enable_teleop: false renderer: 1 car1: type: flightgoggles_car_dynamics config_dynamics: config/car/car.yaml enable_teleop: false renderer: 1
An external renderer can be launched manually (note the port numbers need to match the renderer ID) with the following commands:
./FlightGogglesv3.x86_64 -input-port 10255 -output-port 10256