A metapackage for the MRS UAV Gazebo + PX4 SITL simulation pipeline.
- Install the MRS UAV System
sudo apt install ros-noetic-mrs-uav-gazebo-simulation
Package | Repository |
---|---|
MRS Gazebo Common Resources | mrs_gazebo_common_resources |
PX4 | px4_firmware |
PX4 SITL Gazebo | px4_sitl_gazebo |
Model | Spawn argument | Simulation |
---|---|---|
F4F RoboFly | --robofly |
|
DJI f330 | --f330 |
|
DJI f450 | --f450 |
|
Holybro x500 | --x500 |
|
DJI f550 | --f550 |
|
Tarot t650 | --t650 |
|
T-Drones m690 | --m690 |
|
NAKI II | --naki |
A custom drone model can be added from an external package. Please look at mrs_gazebo_custom_drone_example for an example. The wiki page https://ctu-mrs.github.io/docs/simulation/gazebo/gazebo/custom_drone.html contains a detailed description of all the important steps and configuration parts.
Use one of the prepared Tmuxinator sessions in roscd mrs_uav_gazebo_simulation/tmux
as an example:
The drone models are dynamically created in runtime using the MRS drone spawner. The UAV platforms can be additionally equipped by adding components (rangefinders, LiDARs, cameras, plugins etc.).
To start the example Gazebo world call:
roslaunch mrs_uav_gazebo_simulation simulation.launch world_name:=grass_plane.world gui:=true
At this point the Gazebo world will only contain the environment with grass plane but with no vehicles yet.
The simulation.launch
will automatically start the mrs_drone_spawner
as a ROS node. If you use a custom launch file to start Gazbo, you can launch the spawner separately:
roslaunch mrs_uav_gazebo_simulation mrs_drone_spawner.launch
The mrs_drone_spawner
will perform the following tasks:
-
Generate SDF models from the UAV templates
-
Add optional components (sensors, plugins...) based on the user input
-
Run PX4 SITL and Mavros, and ensure that all ports are correctly linked with the Gazebo simulator
-
Remove all subprocesses on exit
Vehicles are added to the simulation by calling the spawn
service of the mrs_drone_spawner
.
The service takes one string argument, which specifies the vehicle ID, type and sensor configuration.
Example: spawn a single vehicle with ID 1, type X500, with a down-facing laser rangefinder:
rosservice call /mrs_drone_spawner/spawn "1 --x500 --enable-rangefinder"
To display the basic use manual for the spawner, call the service with the argument --help
. NOTE: String argument cannot start with a dash. Add a space before the dashes to avoid errors. The service call returns the full help text, but the formatting may be broken. Please refer to the terminal running simulation
or mrs_drone_spawner
where the help text is also printed with proper formatting.
rosservice call /mrs_drone_spawner/spawn " --help"
You can also display a manual for a specific platform. This will list all the components that can be equipped to the selected platform, and their brief description.
rosservice call /mrs_drone_spawner/spawn " --x500 --help"
Multiple vehicles may be spawned with one service call:
rosservice call /mrs_drone_spawner/spawn "1 2 3 4 5 --t650 --enable-bluefox-camera --enable-rangefinder"
The default parameters of some components may be reconfigured by adding param:=value
after the component keyword. Multiple params may be used at the same time:
rosservice call /mrs_drone_spawner/spawn "1 --x500 --enable-rangefinder --enable-ouster model:=OS0-32 use_gpu:=True horizontal_samples:=128 update_rate:=10"
The list of components and their reconfigurable parameters can be displayed using the platform-specific help.
For more details, please refer to the MRS drone spawner page.