Ninja Build Error for Custom SITL Airframe not found

I am facing a challenge in building a custom SITL airframe in PX4 and could use some expert advice.

Issue Summary:
I created a custom airframe script 22001_none_plane in the init.d-posix directory, essentially duplicating the standard plane script from init.d. Despite correctly adding it to the CMakeLists.txt in the same directory and performing both make distclean and make clean, I am encountering a build error.

Specifics of the Problem:
When running the build command:

make px4_sitl none_plane

I receive the error:

ninja: error: unknown target 'none_plane'
make: *** [Makefile:232: px4_sitl] Error 1

Attempts to Resolve:

  • Ensured the script 22001_none_plane is accurately named and located in ROMFS/px4fmu_common/init.d-posix/airframes.
  • Added the script reference to CMakeLists.txt in the init.d-posix/airframes directory.
  • Tried various IDs and names, even replicating another model (like none_iris) with a new name and ID.
  • Conducted thorough make distclean and make clean operations.

Despite these efforts, the issue persists, and the build system doesnā€™t recognize the new target. I am using PX4 on WSL (Windows Subsystem for Linux) and have checked for common file format issues (line endings, permissions).

Request for Guidance:

  • Is there a step Iā€™m missing or a common pitfall in this process?
  • Could this issue be related to a specific aspect of PX4ā€™s build system, particularly in the context of WSL?
  • Has anyone encountered a similar challenge and found a workaround?

I appreciate any insights or suggestions you can provide. Itā€™s a roadblock in my project, and any help to move forward would be invaluable.

Thank you in advance for your assistance!

Shouldnā€™t it be called 22001_plane? I think none is for the choice of simulator to start.

I used to think like that but it seems we already have a none_iris in the init.posix folder. Thatā€™s why I am confused!
I tested adding 22001_plane and using make px4_sitl plane and make px4_sitl none_plane
and also tested with 22001_none_plane ā€¦
That is why I thought either I was missing a step or a bug within the WSL environmentā€¦

Hello
After some investigation, I found that the handling of airframe names in PX4 has changed, especially from version 1.15 alpha onwards. In previous versions, we used to define a ā€˜planeā€™ airframe and then apply ā€˜none_planeā€™ for additional setups. However, the latest version requires each simulator definition to be specified separately.

To resolve this, I defined a ā€˜none_planeā€™ airframe and made necessary changes in the src/modules/simulation/simulator_mavlink/CMakeLists.txt file. Hereā€™s the essential addition I made:

# none_plane (legacy compatibility launch helper)
add_custom_target(none_plane
	COMMAND ${CMAKE_COMMAND} -E env PX4_SYS_AUTOSTART=22001 $<TARGET_FILE:px4>
	WORKING_DIRECTORY ${SITL_WORKING_DIR}
	USES_TERMINAL
	DEPENDS
		px4
		${PX4_SOURCE_DIR}/ROMFS/px4fmu_common/init.d-posix/airframes/22001_none_plane
	COMMENT "launching px4 none_plane (SYS_AUTOSTART=22001)"
)

Furthermore, itā€™s crucial to include ā€˜none_planeā€™ in the cmakelists in the init.d-posix/airframes/ directory just like before. This approach solved the build error I was facing. If youā€™re dealing with a similar issue, I hope this solution helps you as well.
and this is my definition of airframe

#!/bin/sh
#
# @name Generic Standard Plane SITL for custom Simulator
#
# @type Standard Plane
# @class Plane
# @author alireza787b
#

. ${R}etc/init.d/rc.fw_defaults

param set-default CA_AIRFRAME 1
param set-default CA_ROTOR_COUNT 1
param set-default CA_ROTOR0_PX 0.3
param set-default CA_SV_CS_COUNT 4
param set-default CA_SV_CS0_TYPE 1
param set-default CA_SV_CS0_TRQ_R -0.5
param set-default CA_SV_CS1_TRQ_R 0.5
param set-default CA_SV_CS1_TYPE 2
param set-default CA_SV_CS2_TRQ_P 1.0
param set-default CA_SV_CS2_TYPE 3
param set-default CA_SV_CS3_TRQ_Y 1.0
param set-default CA_SV_CS3_TYPE 4

param set-default SENS_EN_GPSSIM 1
param set-default SENS_EN_BAROSIM 1
param set-default SENS_EN_MAGSIM 1
param set-default SENS_EN_ARSPDSIM 1

# disable some checks to allow to fly:
# - with usb
param set-default CBRK_USB_CHK 197848
# - without real battery
param set-default CBRK_SUPPLY_CHK 894281
# - without safety switch
param set-default CBRK_IO_SAFETY 22027
# - without Airspeed Sensor
param set-default CBRK_AIRSPD_CHK 1612128

2 Likes