Copter: Auto mode CONDITION_YAW treats neg relative angle with CCW direction as CCW #25646
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This makes Auto mode's handling of the CONDITION_YAW command slightly more intuitive in the case where the user has specified both a negative relative angle and a CCW direction (e.g. Deg = -90, Dir = -1, Relative=1).
Currently master interprets this double negative as a positive and will rotate the vehicle in the clockwise direction. With this change the double negative is interpreted as a negative and so the vehicle rotates in the CCW direction.
This PR also includes some drive-by formatting fixes.
This has been lightly tested in SITL and works as expected.
Note that CONDITION_YAW can also be sent as an immediate command (e.g. while the vehicle is GUIDED mode) but that handler rejects negative angles so the double-negative case is never met. We could them consistent by removing these few lines and the modify the MAVLink spec (see related PR)
There is a related MAVLink PR here ArduPilot/mavlink#341 (related but no dependency)
This resolves issue #23874