-
Notifications
You must be signed in to change notification settings - Fork 13.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor FMU: move mixer handling into a library #12790
Conversation
We should get those other tasks removed from fmu. #10119 |
perf_counter_t _control_latency_perf; | ||
|
||
DEFINE_PARAMETERS( | ||
(ParamInt<px4::params::MC_AIRMODE>) _param_mc_airmode, ///< multicopter air-mode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should think of a different way to handle this eventually. Seeing the "Multicopter Attitude Control" param group on a plane deeply bothers me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. Maybe just move the param to a mixer group?
How do you see this working in cases like uavcan? I'm wondering if having the uORB subscription callbacks in mixer_module is going to be too restrictive for things like uavcan. |
So far I see these options:
|
I think this goes in the right direction, although I have not reviewed carefully. |
34cfa18
to
db75c10
Compare
Rebased.
I made it configurable now so the user of the library can decide. |
One of the motivations for the PX4 WQ was to be able to afford to carve these things into separate little modules. Possibly splitting out mixing entirely from the output driver is something I'd like to consider down the road if we can wrap out heads around the current configuration mess. |
@PX4/testflights could you please give this a try on one or more of the following flight controllers?
Thanks! |
f142dd7
to
ab629a8
Compare
Tested on Pixracer v4 f-450 Modes Tested log: Tested on Pixhawk4 mini v5 f-450 Modes Tested log: |
Tested on NXP FMUK66 V3 Position Mode: Good. - Procedure Notes: Log: |
Tested on CUAV Nano V5: Position Mode: Good. - Procedure Notes: Log: |
This should be a pure refactoring, no functional change.
Makes sure that the parameter is included for the builds that need it.
As there is nothing pwm-specific about it.
And make sure fmu calls MixingOutput::updateSubscriptions on startup even if no mixer is loaded, so that it gets scheduled.
ab629a8
to
c42c76b
Compare
Currently all actuator output drivers handle mixer loading, mixer parameters and actuator controls subscriptions with everything around that themselves, leading to duplicated code with minor differences.
This PR is a step towards improving that by pulling these parts out of fmu into a library that can be used by other modules.
It is a pure refactoring, except for:
PX4FMU::write
(9c84251). I don't see it being used anywhere.Testing
I tested:
@Igor-Misic this serves as preparation for DShot.
I tend towards adding it as a new module (as opposed to integrate into fmu), as the fmu driver contains various things we won't need. On the other hand however, in the current form we would lose input capture pin configuration
and the safety button.@dagar one problem I found with the actuator_controls uORB scheduling is that you can end up your module not being scheduled at all. For example with an RC passthrough mixer and no RC connected. If the module wants to do other tasks as well we need to ensure it's run periodically even w/o uORB updates.
A careful review is appreciated.