PX4 / PX4-Autopilot

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

prearm with linux #14705

Open navioglider opened 4 years ago

navioglider commented 4 years ago

bug description setting COM_PREARM_MODE="Always" does not seem to do anything when running linux (same behaviour as if "Disabled"). From this comment in the code it seems like you already know about the issue: https://github.com/PX4/Firmware/blob/7c533e5a535e48b460dda1a4f148b830155f3e06/src/drivers/linux_pwm_out/linux_pwm_out.cpp#L360-L362 (although it has been like that for a looong time) reactivating line 362 seems to me to make prearm work again and not break anything. did the bug get fixed at some point?

drone raspberry pi 4b + navio2

dagar commented 4 years ago

@navioglider this isn't a direct answer to your question, but linux_pwm_out was never on par with the "normal" output modules (eg pwm_out) we use on common boards like the pixhawk. My plan for the navio2 was to implement the same low level PWM functions we use on NuttX, then use the regular pwm_out module and purge linux_pwm_out.

Here's an old branch I had started (https://github.com/dagar/PX4-Firmware/commits/pr-linux_pwm_out_cleanup). Look for boards/emlid/navio2/pwm/pwm_servo.cpp.

In terms of overall PX4 platform unification (Linux & NuttX) the output module and init scripts are the largest remaining items (for Navio2 at least). If we can migrate linux_pwm_out -> pwm_out, and the init system to what's in ROMFS/ we'll be in a much better position to maintain Linux board support going forward.

FYI @SalimTerryLi

dagar commented 4 years ago

Direct link to what needs to be implemented for Navio2.

https://github.com/dagar/PX4-Firmware/blob/4cd633fcb19e809835fca99e3768d6aa701aeac1/boards/emlid/navio2/pwm/pwm_servo.cpp#L10-L88

Screenshot from 2020-04-19 13-05-31

SalimTerryLi commented 4 years ago

That is. Thanks for mentioning that. The first thing that come to my mind is whether can I deploy PCA9685 in this way or not. I will try to figure out that. But I cannot provide any useful info that would benefit this issue, as I have no Navio2 HAT to do any test.

Onboard PWM channels should be managed in this way, for sure.

dagar commented 4 years ago

Related: https://github.com/PX4/Firmware/pull/14707

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.