Skip to content

Plane: fixed terrain guided target intermediate alt handling - #29685

Merged
tridge merged 8 commits into
ArduPilot:masterfrom
tridge:pr-quadplane-guided-terralt3
Apr 9, 2025
Merged

Plane: fixed terrain guided target intermediate alt handling#29685
tridge merged 8 commits into
ArduPilot:masterfrom
tridge:pr-quadplane-guided-terralt3

Conversation

@tridge

@tridge tridge commented Apr 4, 2025

Copy link
Copy Markdown
Contributor

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.

Comment thread ArduPlane/altitude.cpp
@timtuxworth

Copy link
Copy Markdown
Contributor

Have you seen this @Ryanf55 ? Any thoughts?

@IamPete1 IamPete1 left a comment

Copy link
Copy Markdown
Member

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.

Comment thread ArduPlane/altitude.cpp
Comment thread ArduPlane/altitude.cpp
alt_cm = gps.location().alt;
} 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
Copy Markdown
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.

@tridge tridge Apr 8, 2025

Copy link
Copy Markdown
Contributor Author

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

Comment thread ArduPlane/altitude.cpp Outdated
@tridge

tridge commented Apr 8, 2025

Copy link
Copy Markdown
Contributor Author

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

@peterbarker peterbarker left a comment

Copy link
Copy Markdown
Contributor

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

Ryanf55 commented Apr 9, 2025

Copy link
Copy Markdown
Contributor

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

tridge commented Apr 9, 2025

Copy link
Copy Markdown
Contributor Author

@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
@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.

7 participants