Error when simulating a new airframe

Background

I am trying to work with a custom airframe on the PX4. I am relatively new to the PX4 framework and all, so I have used the iris airframe as the base of my new custom airframe. I have a few references on how to do this but I mainly follow this discussion and the steps from @antonerasm. However, I believe these steps are outdated for the current version of PX4 repo.

Current State

Following the steps, I have managed to:

  • Create a new model folder in PX4-Autopilot\Tools\simulation\gazebo-classic\sitl_gazebo-classic\models\my_airframe
  • Created both .sdf and .config files for my_airframe. (copied contents of .sdf file from iris and changed all occurences of iris with my_airframe)
  • Created an airframe file in ROMFS/px4fmu_common/init.d-posix with the name 2021_gazebo-classic_my_airframe
  • Added the airframe into the CmakeLists.txt file in the same folder
  • Added the my_airframe model to the sitl_target.cmake file in PX4-Autopilot\src\modules\simulation\simulator_mavlink. (From this reference)

Problem

When launching the SITL using sudo make px4_sitl gazebo-classic_my_airframe, I encounter this issue.

______  __   __    ___
| ___ \ \ \ / /   /   |
| |_/ /  \ V /   / /| |
|  __/   /   \  / /_| |
| |     / /^\ \ \___  |
\_|     \/   \/     |_/

px4 starting.

INFO  [px4] startup script: /bin/sh etc/init.d-posix/rcS 0
INFO  [init] found model autostart file as SYS_AUTOSTART=2021
INFO  [param] selected parameter default file parameters.bson
INFO  [param] importing from 'parameters.bson'
INFO  [parameters] BSON document size 274 bytes, decoded 274 bytes (INT32:11, FLOAT:3)
INFO  [param] selected parameter backup file parameters_backup.bson
  SYS_AUTOCONFIG: curr: 0 -> new: 1
+ SYS_AUTOSTART: curr: 10015 -> new: 2021
* SENS_BOARD_X_OFF: curr: 0.0000 -> new: 0.0000
* SENS_DPRES_OFF: curr: 0.0000 -> new: 0.0010
etc/init.d-posix/rcS: 9: /home/arief_ak/PX4-Autopilot/build/px4_sitl_default/rootfs/etc/init.d-posix/airframes/2021_gazebo-cla: not foundframe:
etc/init.d-posix/rcS: 10: .: Can't open /home/arief_ak/PX4-Autopilot/build/px4_sitl_default/rootfs/etc/init.d/rc.mc_defaults
ERROR [px4] Startup script returned with return value: 32512

For this error message:

etc/init.d-posix/rcS: 9: /home/arief_ak/PX4-Autopilot/build/px4_sitl_default/rootfs/etc/init.d-posix/airframes/2021_gazebo-cla: not foundframe:

I checked and the airframe is in the folder.

For this error message:

etc/init.d-posix/rcS: 10: .: Can't open /home/arief_ak/PX4-Autopilot/build/px4_sitl_default/rootfs/etc/init.d/rc.mc_defaults

I have no clue why this issue persists.

I was hoping that I could get some support on this.
Any help would be appreciated.

Arief.

airframes/2021_gazebo-cla: not foundframe:

@Arief_AK typo?

No, this is the copy-pasted terminal output I received.

I have same issue.

I also put my custom airframe in inid.d-posix/airframe and add my file name in cmakelists.txt.
And to run the PX4 only I add my airframe name in sitl_target.cmake.
When I try to run using following command: make px4_sitl none_[name], It occur same issue with you.

even my airframe is locate in this folder build/px4_sitl_default/tmp/rootfs/etc/init.d-posix/airframe/, It cannot recognize my airframe.

Did you solve this problem?
If you did, Can you share the solution?

(OS: Ubunutu20)

Hi @JeongseokHyun,

Thanks for the replies. First of all, I have not found a solution, but I have found a work-around.
Instead of re-writing a new custom airframe, I have over-written the iris airframe as it is already registered on the PX4.

My question to you:

Attached is a snippet of the rCS file.

Which line exactly did you modify? How did you find that this was the solution?
Thanks.

I think it is not this problem.

It seems like the name mismatch problem.

Can you change the airframe name same with command?

If you want to put a new airframe in px4, then, you need to put a new model in the gazebo using the same name to do that.

If you are okay to use the same name with the iris, then, just edit the inside contents in the iris airframe.

basically, sitl target name, airframe name, and gazebo model name need to same.

Thank you.

@Arief_AK Hi.
In my case, To resolved this problem, I recovered the line in init.d-posix/rcS.
And I created new custom airframe using exist airframe in same OS.
The line that I ignored in rcS code file can occur another problem during simulation.
So, please don’t follow that way. :D.