Launch a custom world in px4-sitl


In older PX4 versions I could launch my custom world with the commands :

cd src/Firmware
no_sim=1 make px4_sitl_default gazebo
roslaunch gazebo_ros empty_world.launch world_name:=$(pwd)/Tools/sitl_gazebo/worlds/

Now, I installed the newest PX4 version and when I run no_sim=1 make px4_sitl_default gazebo it sets as default. How do I launch px4-sitl with my custom world ?



Have you checked the docs? Gazebo Classic Simulation | PX4 User Guide

Thank you for your response. I was able to load a custom world setting up the PX4_SITL_WORLD environment variable.

If I launch make px4_sitl gazebo-classic it spawns Iris model by default. But I need a Iris with a depth camera so I tried make px4_sitl gazebo-classic_iris_depth_camera but I got the following error :

ninja: error: unknown target 'gazebo-classic_iris_depth_camera'
make: *** [Makefile:232: px4_sitl] Erro 1

The model is in the folder : PX4-Autopilot/Tools/simulation/gazebo-classic/sitl_gazebo-classic/models. How can I spawn this model instead of the default Iris model ? Is there a environment variable like for the world setting ?

Some models spawns sucessfully like iris or typhoon_h480 but others like solo or iris_depth_camera gives the unknown target error.

One workaround I found was edit


And then I had to create a 1071_gazebo-classic_iris_downward_depth_camera file on PX4-Autopilot/build/px4_sitl_default/rootfs/etc/init.d-posix/airframes folder. Then the specified model was spawned with make px4_sitl gazebo-classic.

Probably, there is a easier way to set up the model name but I could not find it.

1 Like

Hi, Great info !!
what are the contents inside the 1071_gazebo-classic_iris_downward_depth_camera file

I just copied the 1010_gazebo-classic_iris_opt_flow file and renamed it.

but why did you rename it as 1071_ xxx

I just choose a random number. Not sure if it is necessary.

1 Like