How do I add new models to PX4 sitl in gazebo?

Hello everyone,
I’m trying to create new models based on existing ones in the /PX4-Autopilot/Tools/sitl_gazebo/models/
I started this by copying a directory, iris for example, and change all occurances of iris in that directory o iris2.
then I simply did

DONT_RUN=1 make px4_sitl_default gazebo

but when trying to run px4 in sitl using the following command:

make px4_sitl gazebo_iris2
make px4_sitl gazebo_iris2__baylands

I get :

ninja: error: unknown target 'gazebo_iris2', did you mean 'gazebo_iris'?                                 │
make: *** [Makefile:230: px4_sitl] Error 1 

OK, I found this link which did the trick Create custom model for SITL - #22 by Fatih_Ozkan

A second question :
I noticed there are .sdf.jinja and sdf.last_generated in the model directories as well. however, when I removed them, now the model is not loaded saying model cant be found. are these not supposed to be generated on the fly during px4 build? if so why am I getting this error?
How am I supposed to force their regeneration?
Whats wrong here? any help in this is greatly appreciated

1 Like

Maybe it’s too late but here is what I know:

jinja files are generating sdf files which will be used by Gazebo. If you don’t want to edit jinja don’t delete and I suggest copy the sdf file you edited before next to the jinja file after make.

  • I can’t remember exactly but somehow ‘make’ system try to find jinja file but uses sdf file. So after ‘make’ change the sdf file with yours. It worked that way as remembered.
1 Like