This page is describing the upcoming ROS2 version of the MRS UAV System (however, it may be still outdated). If you are looking for ROS1 version of the docs, follow to https://ctu-mrs.github.io/docs/1.5.0/introduction/.
How to start the simulation with a custom world

To start the simulation, we use ROS launch files
ros2 launch mrs_uav_gazebo_simulator simulation.launch.py
The launch simulation.launch.py file contains this argument
declare_world_file_arg = DeclareLaunchArgument(
'world_file',
default_value = PathJoinSubstitution([
pkg_mrs_common_gazebo_resources, 'worlds', 'grass_plane.sdf'
]),
description='Path to the SDF world file'
)
specifying the default world to be grass_plane.sdf from the mrs_gazebo_common_resources package.
Load a custom world
Load world from mrs_gazebo_common_resources
Pass the world_file (e.g., forest.sdf) as an argument to the launch file
worlds="$(ros2 pkg prefix --share mrs_gazebo_common_resources)/worlds"
ros2 launch mrs_uav_gazebo_simulator simulation.launch.py world_file:="$worlds/forest.sdf"
Load arbitrary custom world
Pass the world file as an argument to the launch file using find to locate your package
ros2 launch mrs_uav_gazebo_simulator simulation.launch.py world_file:="$(find custom_gazebo_resources)/worlds/custom_world.sdf"
or use the absolute path of the world file
ros2 launch mrs_simulation simulation.launch.py world_file:=/path/to/world/custom_world.sdf
How to create a custom world
Create the world manually in a text editor
Create a completely new .sdf file or copy & modify an existing file (e.g., forest.sdf). Make sure your world file contains line
<plugin name="mrs_gazebo_static_transform_republisher_plugin" filename="libMrsGazeboCommonResources_StaticTransformRepublish.so"/>
The included mrs_gazebo_static_transform_republisher plugin provides static transforms of all the spawned sensors to the <uav_name>/fcu frame.
Create the world using Gazebo
- Start a Gazebo simulation,
gz sim - Insert models to the world as you wish using the Gazebo GUI
- Save world to file:
File -> Save as - Make sure the created file contains the
mrs_gazebo_static_transform_republisherplugin.
Common issues
No static transformations
rosrun rqt_tf_tree rqt_tf_tree shows no transformations between spawned sensors and the <uav_name>/fcu frame?
Make sure your world file contains the mrs_gazebo_static_transform_republisher plugin as described above.
Lack of static transformations might also prevent start of some systems and hence prevent taking off.