-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
Fix uncalibrated RC input being used #21543
Conversation
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/px4-community-q-a-may-03-2023/31965/1 |
57cbcfb
to
aa728ef
Compare
For now I removed the validity check for the channel count of every sample matching the calibration parameter. (#21543 (comment)) |
@@ -155,6 +154,12 @@ void RCUpdate::parameters_updated() | |||
|
|||
update_rc_functions(); | |||
|
|||
_rc_calibrated = _param_rc_chan_cnt.get() > 0 | |||
&& (_param_rc_map_throttle.get() > 0 |
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 a rover?
What it be enough to start with just RC_CHAN_CNT > 0 and RC_MAP_THROTTLE?
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 thought about that case. Just one of the 4 main functions needs to be mapped:
(channel count > 0) and (throttle or roll or pitch or yaw mapped)
Did I do a mistake?
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/px4-maintainers-call-may-09-2023/32047/1 |
07bed33
to
4b76c3d
Compare
I rebased again in the hope Mac CI is more successful. In my eyes this pr is mergeable. Any objections? |
4b76c3d
to
f573b6a
Compare
I rebased again. If no one objects I'll merge this later. |
Solved Problem
When testing for #21506 I often reset all parameters to go through a fresh setup and found that my RC input data from a crossfire receiver was used even though I didn't calibrate it yet. The values were all static zero because it was uncalibrated but still assuming to have pilot input even though there is none is a safety concern.
Solution
valid
flag in themanual_control_input
topic to signal that the input is not actually calibrated and shouldn't be considered valid and used. The RC is considered calibrated if the channel count parameterRC_CHAN_CNT
is set and at least one of the stick axes roll, pitch, yaw or throttle is mapped to an RC channel. Further the input is only considered valid if the number of channels in it actually matches what was calibrated (RC_CHAN_CNT
).Changelog Entry
For release notes:
Alternatives
What's not ideal in my eyes is the reporting to the user. He cannot screw up anymore by accidentally using uncalibrated stick input but he's not informed about the details about why the stick input does not get used. QGC shows a red remote icon but feedback could be better. Should I duplicate all these checks into the RC calibration check here?
PX4-Autopilot/src/modules/commander/HealthAndArmingChecks/checks/rcCalibrationCheck.cpp
Line 81 in 1d4b66f
Test coverage
I did bench testing using the same setup that I found the issue with. On a fresh setup the
![](https://user-images.githubusercontent.com/4668506/235889619-a3b5c50d-3d84-437d-a6d2-54e7c6189739.png)
![](https://user-images.githubusercontent.com/4668506/235889949-ac6ff101-515f-4a68-895a-1cdc77681f81.png)
manual_control_input
is published with the uncalibrated values but flagged as invalid and therefore does not get selected/used.Once the RC is successfully calibrated it gets flagged valid and is normally used.