Skip to content

Plane: fixed terrain guided target intermediate alt handling #29685

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

Merged
merged 8 commits into from
Apr 9, 2025

Conversation

tridge
Copy link
Contributor

@tridge tridge commented Apr 4, 2025

introduces a new set_target_altitude_proportion_terrain() which handles the case of a terrain target destination with a source as absolute alt or terrain alt
This also removes (and bans) the use of terrain_alt=1 with relative_alt=0. That combination is not handled by the Location object but was used by plane.

The fundamental problem is that in the Location object, if you have terrain_alt=1 and relative_alt=0 then the get_alt_m() function will get an altitude that is the height of terrain at that location plus the alt field. Plane has always assumed that in this case the altitude is the height of terrain at that location plus the alt field plus the home altitude. This is because we have a rule that when relative_alt=0 we assume that home.alt has been incorporated into the alt field. To square the circle we need to make this combination impossible, which is a major change in the plane code.

@timtuxworth
Copy link
Contributor

Have you seen this @Ryanf55 ? Any thoughts?

@tridge tridge mentioned this pull request Apr 4, 2025
97 tasks
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.

Looks OK, this altitude stuff is always tricky, I the key thing is just to test each case.

} else {
loc.alt = baro.get_altitude() * 100 + AP::ahrs().get_home().alt;
alt_cm = baro.get_altitude() * 100 + AP::ahrs().get_home().alt;
Copy link
Member

Choose a reason for hiding this comment

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

I know this is existing code, but I wonder if it should be baro.get_altitude_AMSL() The difference is home altitude vs the set field elevation.

Copy link
Contributor Author

@tridge tridge Apr 8, 2025

Choose a reason for hiding this comment

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

wouldn't that mean we'd have home alt in there twice?
I also think it should be a separate PR if we change it

@tridge
Copy link
Contributor Author

tridge commented Apr 8, 2025

need to fix RockBlock.lua

@tridge tridge force-pushed the pr-quadplane-guided-terralt3 branch from fe91b01 to 9492720 Compare April 8, 2025 07:17
Copy link
Contributor

@peterbarker peterbarker left a comment

Choose a reason for hiding this comment

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

We flight-tested this today

@Ryanf55
Copy link
Contributor

Ryanf55 commented Apr 9, 2025

Have you seen this @Ryanf55 ? Any thoughts?

Id like to understand how it was flight tested, and whether there are more cases we want to test. It's not clear from Peter's comment what they tested, and Pete said we want to test each case. Does Peter want us to assume that he tested each case in flight? How do we know if we don't know what was tested.

If we have time:

  • Enumerate the test cases we want to test
  • Run through them manually in SITl
  • Or better yet, implement the test cases in auto test.

I'm happy to help with any of these in a week.

I really like the premise of the PR, but I feel entirely unqualified to approve it without doing any of the above.

@tridge
Copy link
Contributor Author

tridge commented Apr 9, 2025

@Ryanf55 it has had extensive testing in:

  • SITL with manual testing
  • autotest (see all the new tests added)
  • quadplane testing on a real vehicle, trying to trigger issues

The key cases are:

  • flying to a terrain alt target from a non-terrain target
  • flying between two terrain alt targets
  • flying between targets with increasing alt between
  • flying between targets with decreasing alt between
  • flying in a variety of modes (AUTO, LOITER, RTL, CRUISE etc)

@tridge tridge merged commit 10cc9f5 into ArduPilot:master Apr 9, 2025
138 of 141 checks passed
@github-project-automation github-project-automation bot moved this to Pending in 4.6 Backports Apr 9, 2025
@rmackay9 rmackay9 moved this from Pending to 4.6.0-beta6 in 4.6 Backports Apr 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 4.6.0-beta6
Development

Successfully merging this pull request may close these issues.

6 participants