Dear all,
I want to add a camera to rc_cessna_model and simulate it with ROS2 Gazebo in PX4. I mentioned ROS2, so you can understand that I don’t work with Gazebo custom. Let me tell what I have done. Indeed I have replicated exactly what has been done to x500_mono_cam. Below are the steps and files:
- Created rc_cessna mono_cam folder which is exact copy of rc_cessna folder inside Tools/simulation/gz/models directory. I have adjusted model.sdf file like below:
<?xml version="1.0" encoding="UTF-8"?>
<sdf version='1.9'>
<model name='rc_cessna_mono_cam'>
<include merge='true'>
<uri>rc_cessna</uri>
</include>
<include merge='true'>
<uri>model://mono_cam</uri>
<pose>.12 .03 .242 0 0 0</pose>
</include>
<joint name="CameraJoint" type="fixed">
<parent>base_link</parent>
<child>mono_cam/base_link</child>
<pose relative_to="base_link">.12 .03 .242 0 0 0</pose>
</joint>
</model>
</sdf>
And model.config like below:
<?xml version="1.0"?>
<model>
<name>rc_cessna_mono_cam</name>
<version>1.0</version>
<sdf version='1.9'>model.sdf</sdf>
<author>
<name>Benjamin Perseghetti</name>
<email>bperseghetti@rudislabs.com</email>
</author>
<description>
This is a model of an RC Cessna 182 with simple monocular camera.
</description>
</model>
- Then inside ROMFS/px4fmu_common/init.d-posix/airframes directory I added 4012_gz_rc_cessna_mono_cam file with below content:
#!/bin/sh
#
# @name Gazebo rc_cessna_mono_cam
# @type Fixedwing
#
PX4_SIM_MODEL=${PX4_SIM_MODEL:=rc_cessna_mono_cam}
. ${R}etc/init.d-posix/airframes/4003_gz_rc_cessna
- Finally, I have added 4012_gz_rc_cessna_mono_cam to ROMFS/px4fmu_common/init.d-posix/airframes/CMakeLists.txt file.
That’s all.
I have seen this answer also:
However, the structure of Px4 folders have been changed, and I think there is no need to do set(models rc_cessna_mono_cam) inside platforms/posix/cmake/sitl_target.cmake.
My problem is that, when I do
make make px4_sitl gz_rc_cessna_mono_cam
, it is written in terminal
[UserCommands.cc:1097] Error Code 1: Msg: Error finding file [rc_cessna_mono_cam/model.sdf].
[UserCommands.cc:1097] Error Code 1: Msg: Unable to read file: [rc_cessna_mono_cam/model.sdf]
I don’t know what is the problem. I would highly appreciate your help. Thank you for your time.