How to run px4 sitl with custom world?

I made a custom world in gazebo and saved it to sitl_gazebo/worlds. How to run make px4_sitl with the custom world? I tried make px4_sitl gazebo_iris__[custom world] but it said unknown target.

@Rayhan You need to add the target to sitl_target.cmake


Thanks, that works. Anyway then when I tried to run it, the gazebo stuck on loading “preparing your world” with black blank screen like this.

Is the problem came from my .world file?

Yes, it is most likely that it can’t find resources you included in your world file

1 Like

place the asset folder in your /models folder, and update the name of your world in the sitl_target.cmake.

Then build px4 by make px4_sitl gazebo__world

I am not able to find the sitl_target.cmake file in the sitl_gazebo folder

it may have been moved to
PX4-Autopilot/sitl_targets_gazebo.cmake at main · PX4/PX4-Autopilot · GitHub :

1 Like

I found this file by your help, thanks Benja.
I am trying to find the default configuration file which sets and loads as default world. Can you help me with that?

the empty world is first entered here

note the

COMMAND ${PX4_SOURCE_DIR}/Tools/simulation/gazebo/ $<TARGET_FILE:px4> ${debugger} ${model} ${world} ${PX4_SOURCE_DIR} ${PX4_BINARY_DIR}

and then in you have