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

ArduPlane: add climb before turn to AUTOLAND #29142

Merged
merged 2 commits into from
Feb 11, 2025

Conversation

Hwurzburg
Copy link
Collaborator

@Hwurzburg Hwurzburg commented Jan 25, 2025

Alternate to #29135

After test flying using a TX GCS to change climb to altitudes, I agree with Tim that this is easier to use then options in #29135...and it actually uses less flash so I am closing #29135

Now fully terrain following capable

Thanks to Pete Hall for help

Updated autotest for terrain based mission out behind mountain with terrain following autoland return

ArduPlane/mode.h Outdated Show resolved Hide resolved
Copy link
Contributor

@timtuxworth timtuxworth left a comment

Choose a reason for hiding this comment

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

I think that's it just _m on values in meters.

ArduPlane/mode_autoland.cpp Outdated Show resolved Hide resolved
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.

Could we reuse RTL_CLIMB_MIN?

ArduPlane/mode_autoland.cpp Outdated Show resolved Hide resolved
ArduPlane/mode_autoland.cpp Outdated Show resolved Hide resolved
ArduPlane/mode_autoland.cpp Outdated Show resolved Hide resolved
ArduPlane/mode_autoland.cpp Outdated Show resolved Hide resolved
@Hwurzburg Hwurzburg force-pushed the autoland_options_variation branch from 388f4c8 to f29f06d Compare January 27, 2025 00:28
@Hwurzburg Hwurzburg requested a review from IamPete1 January 27, 2025 00:29
@Hwurzburg Hwurzburg added the WikiNeeded needs wiki update label Jan 27, 2025
ArduPlane/mode_autoland.cpp Outdated Show resolved Hide resolved
ArduPlane/mode_autoland.cpp Outdated Show resolved Hide resolved
@Hwurzburg Hwurzburg force-pushed the autoland_options_variation branch from f29f06d to f700e1d Compare January 28, 2025 23:00
@Hwurzburg
Copy link
Collaborator Author

@tridge need help in getting glide_slope from point of climb to alt -> base loiter point to follow terrain...it always just use above home alt as it proceeds to the loiter-to-alt point....help would be appreciated

@Hwurzburg Hwurzburg requested a review from tridge January 31, 2025 12:56
@Hwurzburg Hwurzburg force-pushed the autoland_options_variation branch from f700e1d to be5d6b1 Compare February 1, 2025 03:58
@Hwurzburg
Copy link
Collaborator Author

@tridge got it all working now.....full terrain support

@Hwurzburg Hwurzburg force-pushed the autoland_options_variation branch from be5d6b1 to 1d43cc0 Compare February 1, 2025 04:21
Copy link
Contributor

@timtuxworth timtuxworth left a comment

Choose a reason for hiding this comment

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

It seems to me that just because TERRAIN_ENABLE is true might not mean you want to use it for AUTOLAND. I guess it could be added to the TERRAIN_FOLLOW bitmask in a follow up PR.

ArduPlane/mode_autoland.cpp Outdated Show resolved Hide resolved
ArduPlane/mode_autoland.cpp Outdated Show resolved Hide resolved
@Hwurzburg Hwurzburg force-pushed the autoland_options_variation branch 4 times, most recently from 4fd568b to 428090e Compare February 2, 2025 18:45

#if AP_TERRAIN_AVAILABLE
if (plane.terrain_enabled_in_current_mode()) {
cmd_loiter.content.location.terrain_alt = 1; // this allows terrain following to it as a glide slop destination
Copy link
Contributor

Choose a reason for hiding this comment

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

i'm surprised you didn't need to subtract home alt here, I will need to look at this under gdb

Copy link
Collaborator Author

@Hwurzburg Hwurzburg Feb 4, 2025

Choose a reason for hiding this comment

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

set_target_altitude_location takes care of all that...the relative_alt bit is cleared when we convert the land alt to ABSOLUTE for later use...
since only the terrain alt flag is set when terrain following is enabled,

if (!loc.relative_alt) {
removes the home alt

Comment on lines 185 to 187
plane.target_altitude.amsl_cm = plane.current_loc.alt + climb_before_turn_alt * 100.0f;
#if AP_TERRAIN_AVAILABLE
plane.target_altitude.terrain_alt_cm = plane.target_altitude.amsl_cm;
Copy link
Member

Choose a reason for hiding this comment

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

I suspect this is key to how why works. It sets the TECS target to a huge altitude which is enough to get the vehicle to do a max rate climb. That is the only purpose of the target altitude. The key thing is that this target is not used for the comparison of when the climb is done.

The problem is that without terrain, or if your at sea level then the target altitude may be lower than the threshold alt and the climb will never complete.

We could just set INT32_MAX here and the result would be the same. Although I would not recommend that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

without terrain it climbs to current amsl + climb alt in cm....so that's correct, right?
how do you suggest I set the max climb , terrain based?

@IamPete1 IamPete1 force-pushed the autoland_options_variation branch 2 times, most recently from 7937624 to 437b2c9 Compare February 9, 2025 17:41
@Hwurzburg Hwurzburg force-pushed the autoland_options_variation branch from 7e13216 to 346bcdb Compare February 10, 2025 15:15
@Hwurzburg Hwurzburg force-pushed the autoland_options_variation branch from 624b9ae to ee70a67 Compare February 10, 2025 20:51
@tridge tridge merged commit f320fdd into ArduPilot:master Feb 11, 2025
97 checks passed
@Hwurzburg Hwurzburg deleted the autoland_options_variation branch February 11, 2025 00:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WikiNeeded needs wiki update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants