-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
DroneCAN: fix dangerous bug for twin-motor Planes #27610
DroneCAN: fix dangerous bug for twin-motor Planes #27610
Conversation
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.
The whole scale to unity thing really should be removed at somepoint. It will cause issues if you were to set different ranges on your throttles, or PWM_MIN
/PWM_MAX
for quadplane.
We should calculate the scaled output per channel.
13271e7
to
2a65d03
Compare
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'd like to AP_HAL/RCOutput.h change to init the min/max to 1000/2000
This prevents bugs and misconfigurations from causing DroneCAN ESCs to spin at full speed while the vehicle is disarmed.
Without this, twin motor planes with DroneCAN ESCs need to set a dummy throttle channel for scale_esc_to_unity to work.
Further protection from potential dangerous behavior when these do not get initialized for some reason.
2a65d03
to
3534d3a
Compare
Finally got around to the testing to confirm that I haven't inadvertently messed with the math: Params, all default except:
Armed in manual and throttled up using vjoy through Mission Planner and looked at the RawCommand messages using DroneCAN GUI Tested in/outs:
Also, I've made the change the Tridge requested. And of course I also tested that this PR does still in fact fix the bug. |
@robertlong13 I do hope that table has swapped column headers for reversible/non-reversible? |
Yup, swapped headers. Sorry. Editing the comment now |
Without this, twin motor planes with DroneCAN ESCs need to set a
dummy throttle channel for the
scale_esc_to_unity
to work correctly.Worse yet, if you don't do this, your ESCs will receive a max throttle command while disarmed as soon as the safety switch is disengaged.
The first commit prevents the max-throttle symptom when esc scaling is unconfigured or misconfigured (costs 16 bytes). The second commit allows the left/right throttle servos to be used to configure esc scaling (costs 24 bytes).
Params to reproduce this bug on CubeOrange, disengage the safety switch and look at RawCommand coming out of the autopilot in DroneCAN GUI