-
Notifications
You must be signed in to change notification settings - Fork 19k
Start using altitude getter - towards private alt in Location #28481
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
Conversation
* This is used when the get_alt_cm(frame, alt) fails Signed-off-by: Ryan Friedman <[email protected]>
Signed-off-by: Ryan Friedman <[email protected]>
Signed-off-by: Ryan Friedman <[email protected]>
Signed-off-by: Ryan Friedman <[email protected]>
Signed-off-by: Ryan Friedman <[email protected]>
Signed-off-by: Ryan Friedman <[email protected]>
Signed-off-by: Ryan Friedman <[email protected]>
Signed-off-by: Ryan Friedman <[email protected]>
Signed-off-by: Ryan Friedman <[email protected]>
Signed-off-by: Ryan Friedman <[email protected]>
Signed-off-by: Ryan Friedman <[email protected]>
Signed-off-by: Ryan Friedman <[email protected]>
Signed-off-by: Ryan Friedman <[email protected]>
3cc6fa3
to
1e30872
Compare
// retrieve the altitude (in cm) in the stored frame. | ||
int32_t get_alt_cm() const WARN_IF_UNUSED { | ||
return alt; | ||
} |
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.
Sorry, but I don't think this is acceptable.
The API requires you to specify a frame for a reason, and adding this is a significant step backwards.
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.
Currently You can just call myLocation.alt = 42.0
and now you just set the value (without a frame) without any ability for us to find and stop it.
This PR gives us ability to make .alt private, add a deprecation to this getter on a branch, and use the compiler to tell us all the places we need to phase it out of the codebase.
Eventually, this function gets removed.
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 did discuss the approach with Pete Hall before starting, he thought this approach was valuable because we can grep the code. I'm totally open to alternatives, and am only 1/3 of the way through at the current state.
Purpose
We want to move towards having the altitude in AP_Location private and force using frames when getting/setting it to make it easier to spot frame bugs. This PR gets us 1/3 of the way to making the altitude field private. Once that's private, we can start to use grep to migrate off
get_alt_cm()
where we are worried about using the wrong frame.Also, this could get us closer towards geoid-datum aware altitudes in AP.
Context
#28406 (comment)
Issue
Relates to #28435
Testing
None, hopefully this is narrowly scoped we can merge via inspection and manual testing in any areas of higher concern.