Skip to content
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

Plane: update alt error for every target change #24195

Closed

Conversation

robertlong13
Copy link
Collaborator

@robertlong13 robertlong13 commented Jul 2, 2023

This is related to #23458. This PR should make it much harder to let a bug like that one slip through.

Any of the functions that touch target_altitude should update altitude_error_cm before returning.

@IamPete1
Copy link
Member

IamPete1 commented Jul 3, 2023

Looks like a sensible change. However all the altitude stuff is extremely touchy in plane, we would need to go through and test each case.

@magicrub
Copy link
Contributor

magicrub commented Jul 3, 2023

@robertlong13 I'm with @IamPete1 . Looks like a sensible change but Altitude is some serious spaghetti code in Plane. Since @tridge has already responded on the linked issue I'll let him handle this.

@robertlong13 robertlong13 force-pushed the plane_alt_error_update branch from 6e8db94 to 78727cf Compare May 3, 2024 04:11
@robertlong13
Copy link
Collaborator Author

@tridge, I've gone ahead and rebased this in case you're still interested in it. If we think it's too risky though, I'm also happy to close it. Other than autotest and flying around a bit in SITL, I'm not sure the best way to test.

Copy link
Member

@IamPete1 IamPete1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had another look at this. As far as I can tell we don't actually use altitude_error_cm for anything important. By my count its logging, two MAVLink messages and a check in RTL and VTOL assist.

I think it would be a clearer change to remove the variable completely. Then there is nothing to go out of date. The few places that need it can call calc_altitude_error_cm directly.

The key thing is that the diff will show all the users of the value which is the thing which actually matters.

@robertlong13
Copy link
Collaborator Author

I had another look at this. As far as I can tell we don't actually use altitude_error_cm for anything important. By my count its logging, two MAVLink messages and a check in RTL and VTOL assist.

I think it would be a clearer change to remove the variable completely. Then there is nothing to go out of date. The few places that need it can call calc_altitude_error_cm directly.

The key thing is that the diff will show all the users of the value which is the thing which actually matters.

This sounds like a much better idea to me, and way easier to verify correctness.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants