How to start the simulation with a custom world
To start the simulation, we use ROS launch file
roslaunch mrs_simulation simulation.launch gui:=true
The launch simulation.launch
file contains two arguments
<arg name="world_name" default="grass_plane" />
<arg name="world_file" default="$(find mrs_gazebo_common_resources)/worlds/$(arg world_name).world" />
specifying the default world to be grass_plane
from the mrs_gazebo_common_resources
package.
Load a custom world
Load world from mrs_gazebo_common_resources
Pass the world name (e.g., forest
) as an argument to the launch file
roslaunch mrs_simulation simulation.launch gui:=true world_name:=forest
Load arbitrary custom world
Pass the world file as an argument to the launch file using find
to locate your package
roslaunch mrs_simulation simulation.launch gui:=true world_file:='$(find custom_gazebo_resources)/worlds/custom_world.world'
or use absolute path of the world file
roslaunch mrs_simulation simulation.launch gui:=true world_file:=/path/to/world/custom_world.world
How to create a custom world
Create the world manually in a text editor
Create a completely new .world file or copy & modify an existing file (e.g., forest.world). Make sure your world file contains line
<plugin name="mrs_gazebo_static_transform_republisher_plugin" filename="libMRSGazeboStaticTransformRepublisher.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
- 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_republisher
plugin.
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.