PX4 / PX4-Autopilot

PX4 Autopilot Software
https://px4.io
BSD 3-Clause "New" or "Revised" License
7.87k stars 13.24k forks source link

[Bug] Parameters not found in custom module #23162

Open bmelanman opened 1 month ago

bmelanman commented 1 month ago

Describe the bug

I've been doing semi-regular syncs between the main PX4 repo branch and a custom fork that I've been using to implement a gimbal as a senior project.

Unfortunately it seems that the most recent sync has (somehow?) broken my module's parameters! Once everything is compiled and flashed, the UART output of the ARK CANnode I'm using give a wall of ERROR [param] Parameter <whatever> not found. for all of my module's params.

I've had similar issues in the past (that is, errors related to a repo sync), and I can normally just sort through the commits to see what might've caused the issue, but I haven't been able to find anything thus far, and I'm making very little progress towards a solution compared to past issues as well.

To Reproduce

Clone my PX4 fork (LINK) and compile it for the ARK CANnode, flash it however you choose, and watch the debug UART output on boot

git clone https://github.com/bmelanman/PX4-Autopilot.git && cd PX4-Autopilot
make ark_cannode_default
st-flash write ./build/ark_cannode_default/83-*.bin 0x08010000
st-flash reset
screen /dev/tty.usbserial-D30CYNAP 57600

Expected behavior

I expect all parameters to be found

Screenshot / Media

No response

Flight Log

N/A

Software Version

nsh> ver all
HW arch: ARK_CANNODE
PX4 git-hash: 0f3f4566ac278b629691816f529f2294578ed2e5
PX4 version: 1.15.0 80 (17760384)
PX4 git-branch: main
OS: NuttX
OS version: Release 11.0.0 (184549631)
OS git-hash: 0f401a6062653795b6355c420ea8b0e72578c204
Build datetime: May 21 2024 15:59:42
Build uri: localhost
Build variant: default
Toolchain: GNU GCC, 10.3.1 20210824 (release)
PX4GUID: 0001000000002037374c33315008003e0038
MCU: STM32F???, rev. ?
nsh>

Flight controller

ARK CANnode

Vehicle type

Other

How are the different components wired up (including port information)

The CANnode is currently not connected to anything except 5V and a debug breakout board

Additional context

No response

bmelanman commented 1 month ago

Update on this: I figured it out! I had used a formatter on my parameters source file (i.e. module_params.c) which apparently prevented the params from being parsed due to the addition of spaces inside the param declaration

This works:

PARAM_DEFINE_INT32(MNT_DO_STAB, 0);
// without spaces ^              ^

This does not work:

PARAM_DEFINE_INT32( MNT_DO_STAB, 0 );
// with spaces     ^              ^

Technically the problem is now solved, however this seems like something that will come up as an issue again in the future, so feel free to leave this issue open, or close it and make a new one, or whatever else.

Thanks!