Documentation for using ROS in the SWARM Developer System

ROS 1 Integration

To support real world systems, the SWARM Developer System constructed an entirely new interface to utilize the Robotic Operating System (ROS) Version 1. This enables users to integrate their disparate, C++ or Python-based ROS modules with the SWARM Colosseum system. While a ROS interface existed in Colosseum before, it was monolithic highly non-performant.

Just to show the increased performance, the old ROS interface had the following performance stats:

  • Regular Image (640 x 480) w/ rendering on: 3 - 5 FPS
  • Regular Image (640 x 480) w/o rendering on: 8 - 12 FPS
  • IMU Publishing Rate with 5 sensors: 50 - 60 Messages per secod

The new ROS interface has the following performance stats:
  • Regular Image (640 x 480) w/ rendering on: 12 FPS
  • Regular Image (640 x 480) w/o rendering on: 45 FPS
  • IMU Publishing Rate with 5 sensors: 180 Messages per secod
Another feature that we implemented in Publishing rate control for each individual sensor. This now operates much closer to how Gazebo operated in the past. We will continue to make substantial improvements to this interface as we go.

Currently Supported Versions

  • Melodic (Ubuntu 18.04)
  • Noetic (Ubuntu 20.04)

Using ROS

Running the Node

To run the ROS node is quite easy. You simply put the the parameter RunROSNode in the vehicle options for the agent you wish to use. The ROS node will automatically turn on once the SWARM system loads. From there, you can subscribe to individual messages.

Requirements

To run a ROS-based setup, you will need to add the following to the Settings file of your choice:

  • RunROSNode - Boolean value (should be set to true)
  • PlanningCoordinateFrame - String value that can be either NED (North, East, Down) or ENU (East, North, Up)

Firmware

You can utilize either the "SWARM" or "PX4" firmware to control the agent. An example of both setups is listed below:

PX4 with ROS Settings File

Here is an example of how to setup the vehicle settings. This would be in the DefaultSimulationSettings.json file in the settings folder.

                    ...
                    "Agents": {
                    "Drone1": {
                    "Vehicle": "Multirotor",
                    "VehicleOptions": {
                        "RunROSNode": true,
                        "UseLocalPX4": true,
                        "PlanningCoordinateFrame": "NED"
                    },
                    "AutoPilot": "PX4",
                    ...

                    

SWARM with ROS Settings File

Here is an example of how to setup the vehicle settings. This would be in the DefaultSimulationSettings.json file in the settings folder.

                    ...
                    "Agents": {
                    "Drone1": {
                    "Vehicle": "Multirotor",
                    "VehicleOptions": {
                        "RunROSNode": true,
                        "PlanningCoordinateFrame": "NED"
                    },
                    "AutoPilot": "SWARM",
                    ...

                    

Supported Sensors

The following is a list of sensors that you can choose to publish. If you use PX4, there are a minimum set of sensors that you must put so that the PX4 Simulator will run correctly.

  • Odometer - Publishes the sensor_msgs/Odometry message with truth kinematic data about the agent.
  • Magnetometer - Publsihes the sensor_msgs/MagneticField message with information about the magnetic field.
  • GPS - Publishes the sensor_msgs/NavSatFix message with information about the current GPS information.
  • IMU - Publishes the sensor_msgs/Imu message
  • Distance - Publishes the sensor_msgs/Range message
  • Barometer - Publishes the colosseum_agents/Altimeter message, which can be found in the ros folder of the Developer Client
  • LiDAR - Publsihes the sensor_msgs/PointCloud2 message

Namespace

An independent ROS node is run for each agent. Each agent's messages are namespaced by the name of the individual agent.

For example, a LiDAR sensor with name LidarSensor1 on an agent with name Drone1 would publish the message on the following topic: /Drone1/lidar/LidarSensor1

Indepent Publishing Rates

Each individual sensor now has a publshing rate. You can set this publshing rate in the individual sensor section in the "DefaultSimulationSettings.json" file. An example is provided below:

                    ...
                    "Agents": {
                    "Drone1": {
                    "Vehicle": "Multirotor",
                    "VehicleOptions": {
                        "RunROSNode": true,
                        "UseLocalPX4": true,
                        "PlanningCoordinateFrame": "NED"
                    },
                    "AutoPilot": "PX4",
                    "Sensors": {
                        "LiDAR": {
                            "LidarSensor1": {
                                "Enabled": false,
                                "Method": "AirSim",
                                "Hardware": "Velodyne Puck",
                                "PublishingRate": 20.0,
                                "X": 0.0,
                                "Y": 0.0,
                                "Z": -0.35,
                                "Pitch": 0.0,
                                "Roll": 0.0,
                                "Yaw": 0.0
                            }
                        },
                        "IMU": {
                            "Imu1": {
                                "Enabled": true,
                                "Method": "AirSim",
                                "PublishingRate": 100.0
                            }
                        },
                        "Barometers": {
                            "Barometer1": {
                                "Enabled": true,
                                "Method": "AirSim",
                                "PublishingRate": 10.0
                            }
                        },
                        "Odometers": {
                            "Odometer1": {
                                "Enabled": true,
                                "Method": "AirSim",
                                "PublishingRate": 25.0
                            }
                        },
                        "Cameras": {
                            "Camera1": {
                                "X": 0.35,
                                "Y": 0.0,
                                "Z": 0.0,
                                "Pitch": 0.0,
                                "Roll": 0.0,
                                "Yaw": 0.0,
                                "Settings": {
                                    "ImageType": "Scene",
                                    "Width": 640.0,
                                    "Height": 480.0,
                                    "FOV_Degrees": 90.0,
                                    "FramesPerSecond": 24.0
                                }
                            }
                        }
                    }
                    ...

                    
Tags: