What are jinja templates and how to create one for a quadcopter model


Recently, I got a missing template error when i tried to launch multiple uavs by launch file multi_uav_maros_sitl.launch. I am using the latest master release. iris model is lauched successfully but iris_fpv_cam gives the following error :

jinja2.exceptions.TemplateNotFound: models/iris_fpv_cam/iris_fpv_cam.sdf.jinja

RLException: while processing /home/dtu-project2/PX4-Autopilot/launch/single_vehicle_spawn.launch:
Invalid tag: Cannot load command parameter [sdf_iris_fpv_cam0]: command [/home/dtu-project2/PX4-Autopilot/Tools/sitl_gazebo/scripts/jinja_gen.py --stdout --mavlink_id=1 --mavlink_udp_port=14560 --mavlink_tcp_port=4560 --gst_udp_port=5600 --video_uri=5600 --mavlink_cam_udp_port=14530 /home/dtu-project2/PX4-Autopilot/Tools/sitl_gazebo/models/iris_fpv_cam/iris_fpv_cam.sdf.jinja /home/dtu-project2/PX4-Autopilot/Tools/sitl_gazebo] returned with code [1].

Param xml is
The traceback for the exception was written to the log file

I could see that there is a file iris.sdf.jinja present in PX4-Autopilot/Tools/sitl_gazebo/model/iris but there is no such file present for iris_fpv_cam model.

If someone has some knowledge of jinja and how to create one template file as indicated in the error, please comment or share some links.


@Ranjeet If you search for jinja in google, you will be able to find the documentation of the jinja templates: Jinja — Jinja Documentation (2.11.x)

It is a templating tool to generate sdf files. As I mentioned in Cannot launch iris_fpv_cam - #2 by Jaeyoung-Lim already, the iris_fpv_cam is not expected to work with the multi_uav_mavros_sitl.launch file. (This is not a bug)

You can either try to generate your own model templates by looking at how it is done in PX4-Autopilot/gazebo_sitl_multiple_run.sh at ed0fa99198c276760f0c7d4e9444492c978a2b00 · PX4/PX4-Autopilot · GitHub