-
Notifications
You must be signed in to change notification settings - Fork 13.7k
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
Introduce actuator output function parameters #18265
Conversation
515f332
to
0ae7ede
Compare
This is borderline bike-shedding, but should we try to settle this one now? (previous discussion https://docs.google.com/document/d/10WsNyjARZEuDeCNywnwBnUy3FhX4CR2fmSL0b4eZl6U/edit?pli=1&disco=AAAANoXLsW0) There are kind of 2 parts of this that I question (mildly).
I actually don't think we should even be carrying opinionated default airframes that we pretend will work everywhere. There are a handful of cases where exact configurations should be carried. For the rest it should be a generic start. A "generic quadcopter" should default to using 4 MAIN outputs, but otherwise carry no actuator specifics. Then on the GUI side it should be easy for a user to switch those over to DSHOT, UAVCAN, etc on arbitrary outputs and set any specifics. |
We might as well.
Agreed. I don't think it will matter much though in this case, as the config UI will not even show the param name, just the label.
Odd yes, but is it really a problem? They can ask and there's a good reason. It is a historical problem that we have to carry. Overall I tend towards
I see that the same way.
No, it's for |
What about "MAVLink X" or "MAVLink Actuator X" or "MAVLink Set X", or again "MAVLink Input X". |
If it makes sense I'm hoping we can skip including "Mavlink" in the naming, then continue using the vehicle_command in a ROS2 world. |
type: enum | ||
default: 400 | ||
values: | ||
-5: DShot150 |
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.
What about boards that don't have dshot (kinetis, imxrt, etc)?
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.
They're automatically removed. Also for timers w/o DMA.
-5: DShot150 | ||
-4: DShot300 | ||
-3: DShot600 | ||
-2: DShot1200 |
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.
So this means using PWM_FMU_* parameters to configure dshot min/max/disarm/etc as well?
Can't we have DSHOT_*
parameters per physical output configured to dshot? Then we'd have appropriate defaults for min, disarmed, etc and the PWM parameters could have units in microseconds.
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.
No, dshot uses separate params. Just the function is the same.
Maybe this is where we disagree. I don't think we need to have much of a disconnect between the param name and the label. We should map these parameters to particular physical outputs unambiguously on a per board basis. For example on the original pixhawk (and pixhawk 2, etc) we have 8 MAIN and 6 AUX outputs clearly labelled. PWM_MAIN_* can always refer to those px4io outputs regardless of it being active or not (SYS_USE_IO). In the fmu-v5 case it would be set early in boot based on hardware version, but then the location of PWM_MAIN and PWM_AUX is effectively static per board.
The transition is potentially problematic depending on how it's handled for the remaining in tree airframes. Other than that's it's going to look like a PX4 oddity that will have to be explained again and again. From historical usage many people will have certain expectations for MAIN and AUX. I don't think it's worth fighting that existing experience, but we can still move away from it going forward with labeling on newer boards and an increasing number of boards dropping the px4io entirely. I don't want to try and trick people into doing something slightly better in the face of 10 years of convention. |
Right, then "Offboard X" might be a better fit |
_actuator_controls_5_pub.publish(actuator_controls_5); | ||
_actuator_motors_pub.publish(actuator_motors); | ||
|
||
// TODO: servos |
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.
I am not sure to see the point of using separate topics.
- We will have unused actuator data in both topics, which IMO hinders the debugging and logging experience
- I do not buy the pre-arm argument. Any output can be unsafe to activate pre-flight, we should not infer it from its type. We should rather get it from an output-level "PREARMABLE" parameter, effective for control_alloc function and other functions.
- Control allocator will need parameters to decide which output goes to the motor topic and which goes to the servo topic
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.
I do not buy the pre-arm argument. Any output can be unsafe to activate pre-flight, we should not infer it from its type. We should rather get it from an output-level "PREARMABLE" parameter, effective for control_alloc function and other functions.
Having this safety property at the lowest level makes sense to me if ultimately we can have the feedback/status tightly integrated. The higher level component telling the landing gear to retract, or the gimbal to deploy, or the engine to start should be able to know (easily) that the command isn't possible at this stage of operation.
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.
IMO we generally need a bit more semantics, be it for ease of configurability & use or system inspection. While at the same time it does not reduce generality.
Control allocator will need parameters to decide which output goes to the motor topic and which goes to the servo topic
It knows this already.
Unfortunately I'm not sure when I'll have the chance to dig through this in detail, but at a high level, what's different between this PR and #16808? |
This is the case that doesn't work. You'd have to select the metadata as well dynamically. That's possible, but not something I want to add. Alright, let's go with PWM_MAIN/AUX then.
The main one is that outputs can directly subscribe to any topic, not just actuator_controls.
That's fine with me, but you can also use it in missions. |
9cc8422
to
987f46b
Compare
Updates:
|
f45611f
to
142f4b3
Compare
I've resolved the remaining build failures. I actually disagree with the offboard part of Is everyone else happy to move forward with this? |
142f4b3
to
6b6e72f
Compare
Over on /opt/gcc/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: px4_fmu-v6x_default.elf section `.text' will not fit in region `flash'
1783
/opt/gcc/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: region `flash' overflowed by 15649 bytes
1784
collect2: error: ld returned 1 exit status |
92a86c6
to
5b1858b
Compare
This happened with multi-instance, when the second instance did not load a mixer. Then the first instance would always return false in update_pwm_out_state, and continuously call up_pwm_servo_arm. This led to irregular pulses, e.g. with an output set to fixed 1500us, I saw pulses of e.g. 1800us occationally (they were in a range of [1500-2100]).
The parameter additions are only used internally for the pwm generator.
…tivenessMatrix clang tidy error: /__w/PX4-Autopilot/PX4-Autopilot/src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectivenessMultirotor.cpp:50:34: error: default arguments on virtual or override methods are prohibited [google-default-arguments,-warnings-as-errors] ActuatorEffectivenessMultirotor::getEffectivenessMatrix(matrix::Matrix<float, NUM_AXES, NUM_ACTUATORS> &matrix,
The implementation assumed timers are defined in the same order as used in the channels. This could lead to a mismatch between TIMx param and actual timer config. Now we use the actual array index, same as in the code.
So that the ordering of the generated params make more sense. TIM1 is now for channels 2-4 instead of 5-8.
The defaults changed in the previous commit for per-channel params, so we make sure that the overall params are still used as long as the per-channel params are default.
So that all failures can be evaluated.
…ance This fixes the case where oneshot was enabled with multi-instance pwm_out, triggering oneshot updates too close to each other and as a result could lead to spinning motors while disarmed.
5b1858b
to
564e8a8
Compare
Rebased, CI passing. Should be good to go from my side if there's nothing else. |
Hi, I am currently trying to use this PR. Unfortunately I am not able to find any reference to PWM_MAIN_FUNC exept on the mixer files. As this been tested? I would just like to control a few servos from an application. |
This pull request has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there: https://discuss.px4.io/t/using-do-set-actuator-to-releasing-the-payload/28686/3 |
SYS_CTRL_ALLOC
SYS_CTRL_ALLOC
is set, the output params are used, otherwise existing behavior is usedtimer_config.cpp
and generate per-timer config paramsPWM_FMU_*
is used for FMU, SITL andHIL_ACT_*
for HITL outputs. I'm not completely set on these though.This can go in before or after the IO mixing change (#16444).
See individual commits for details.
@hamishwillee @JacobCrabill