-
Notifications
You must be signed in to change notification settings - Fork 17.2k
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
AP_MISSION: Add nan mission sanity checks to various mission commands #24701
Open
trolledbypro
wants to merge
9
commits into
ArduPilot:master
Choose a base branch
from
trolledbypro:add-NaN-mission-sanity-checks
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
AP_MISSION: Add nan mission sanity checks to various mission commands #24701
trolledbypro
wants to merge
9
commits into
ArduPilot:master
from
trolledbypro:add-NaN-mission-sanity-checks
+28
−12
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Co-authored-by: Nick Exton <NExton@sypaq.com.au>
peterbarker
requested changes
Aug 25, 2023
libraries/AP_Mission/AP_Mission.cpp
Outdated
packet.param3 = cmd.content.gimbal_manager_pitchyaw.pitch_rate_degs; | ||
packet.param4 = cmd.content.gimbal_manager_pitchyaw.yaw_rate_degs; | ||
case MAV_CMD_DO_GIMBAL_MANAGER_PITCHYAW: | ||
packet.param1 = (fabs(packet.param1 - INT8_MAX) < FLT_EPSILON) ? NAN : cmd.content.gimbal_manager_pitchyaw.pitch_angle_deg; |
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.
AFAICS packet.param1 will always be zero here, so checking it for any other value makes no sense.
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 corrected the issue in my newest commit
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
In support of #24691
Hello,
As I continue to troubleshoot ArduPilot compatibility with MAVSDK Mission module, I noticed that several camera action commands did not have proper NaN support. ArduPilot was rejecting what are valid commands according to Mavlink due to invalid parameters:
MAV_CMD_IMAGE_STOP_CAPTURE:
Params 2, 3 and 4 can be set to NaN. Since these are reserved commands, their values are not saved to EEPROM and having these params as NaN has no effect.
MAV_CMD_VIDEO_START_CAPTURE:
Params 3 and 4 can be set to NaN. Since these are reserved commands, their values are not saved to EEPROM and having these params as NaN has no effect.
MAV_CMD_VIDEO_STOP_CAPTURE:
Params 2, 3 and 4 can be set to NaN. Since these are reserved commands, their values are not saved to EEPROM and having these params as NaN has no effect.
MAV_CMD_DO_GIMBAL_MANAGER_PITCHYAW:
Params 1, 2, 3 and 4 can be set to NaN. This command is special as commands stored to EEPROM can be NaN. To address this, I wrote the sanity check in a way that only accepts the following three cases:
These three cases are consistent with the implementation in AP_Mount #23053.
In terms of testing, the only testing I have done is in ArduPilot SITL is to see if the commands are accepted. I have not tested with real hardware.