Hey I am having a similar issue, except I am not using gazebo-classic, I’m using gz. I put my custom world to the worlds directory, but I cannot find the list of targets cmake file for gz. Do you have any idea where this file exists? Or if there is a different step that i am missing?
According to the documentation on adding new worlds and models, all you should need is to add the sdf to the gz worlds directory. No need to modify a cmake file like with gazebo-classic.
You may need to specify the world using the environment variable PX4_GZ_WORLD in your make command. For example: PX4_GZ_WORLD=custom make px4_sitl gz_x500
Though it seems make px4_sitl gz_x500_custom should also work.
That doesn’t work. I tried to put the world into directory and make clean, make again, still, self-defined sdf cannot be used. Only modifying the original sdf to change the world.
You need to put your new world here PX4-Autopilot/Tools/simulation/gz (for ROS2)/ worlds and create here ROMFS/px4fmu_common/init.d-posix/airframes/ a file named 4229_gz_<model_name> (you can use 4001_gz_x500 as template). In this file, you need to put something like this at the top to refer to your world and to a custom model. If you also have a custom model you need to copy this file to build/px4_sitl_default/rootfs/etc/init.d-posix/airframes.