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: add param LAND_RNGFND_HLD to hold-off lidar during landing #25549

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion ArduPlane/commands_logic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,12 +252,22 @@ bool Plane::verify_command(const AP_Mission::Mission_Command& cmd) // Ret
return landing.verify_abort_landing(prev_WP_loc, next_WP_loc, current_loc, auto_state.takeoff_altitude_rel_cm, throttle_suppressed);

} else {
float height = height_above_target();

// use rangefinder to correct if possible
float height = height_above_target() - rangefinder_correction();
if (landing.get_rangefinder_holdoff_distance() <= 0 || // rangefinder holdoff is disabled (never hold off, always use rtanegfinder)
Copy link
Member

@IamPete1 IamPete1 Nov 20, 2023

Choose a reason for hiding this comment

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

Suggested change
if (landing.get_rangefinder_holdoff_distance() <= 0 || // rangefinder holdoff is disabled (never hold off, always use rtanegfinder)
if (landing.get_rangefinder_holdoff_distance() <= 0 || // rangefinder holdoff is disabled (never hold off, always use rangefinder)

auto_state.wp_proportion >= 1 || // or we have reached the land waypoint
landing.is_flaring() || // or we are flaring
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure its a good idea to change the altitude once the flare has started. I don't think it will do anything in anycase.

Copy link

Choose a reason for hiding this comment

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

Why not?

Copy link
Member

Choose a reason for hiding this comment

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

Why not?

What are you expecting to happen once the flare has already started? Suddenly the correction means were now above flare height and we stop flaring? (which of course means we won't do this correction next loop... )

I just think if your already in the flair its too late to start moving the target altitude about, trying to do it might cause unexpected behavior.

current_loc.get_distance(next_WP_loc) <= landing.get_rangefinder_holdoff_distance()) // or we've reached the holdoff distance
{
height -= rangefinder_correction();
}

// for flare calculations we don't want to use the terrain
// correction as otherwise we will flare early on rising
// ground
height -= auto_state.terrain_correction;

return landing.verify_land(prev_WP_loc, next_WP_loc, current_loc,
height, auto_state.sink_rate, auto_state.wp_proportion, auto_state.last_flying_ms, arming.is_armed(), is_flying(),
g.rangefinder_landing && rangefinder_state.in_range);
Expand Down
9 changes: 9 additions & 0 deletions libraries/AP_Landing/AP_Landing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,15 @@ const AP_Param::GroupInfo AP_Landing::var_info[] = {
// @User: Advanced
AP_GROUPINFO("WIND_COMP", 18, AP_Landing, wind_comp, 50),

// @Param: RNGFND_HLD
// @DisplayName: Rangefinder hold-off
// @Description: Rangefinder hold-off distance from land point. Hold off using the rangefinder's altitude correction until you're this close horizontally to the NAV_LAND point. Requires RNGFND_LANDING = 1. This is useful to avoid the rangefinder reacting to objects/trees, or pits, before the level-ish runway starts. Set to zero to disable the hold-off (don't inhibit the rangefinder). Using this feature will cause the rangefinder to correct the baro offset later in the landing which will lead to a larger slope correction. It is suggested to use LAND_ABORT_DEG with this feature so that unacheivable slopes will cause automatic go-arounds while retaining the rangefinder correction in the baro for a smoother landing on the next attempt.
// @Range: 0 1000
// @Units: m
// @Increment: 1
// @User: Advanced
AP_GROUPINFO("RNGFND_HLD", 19, AP_Landing, rangefinder_holdoff_before_land_point, 0),

// @Param: TYPE
// @DisplayName: Auto-landing type
// @Description: Specifies the auto-landing type to use
Expand Down
2 changes: 2 additions & 0 deletions libraries/AP_Landing/AP_Landing.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ class AP_Landing {
int8_t get_abort_throttle_enable(void) const { return abort_throttle_enable; }
int8_t get_flap_percent(void) const { return flap_percent; }
int8_t get_throttle_slewrate(void) const { return throttle_slewrate; }
float get_rangefinder_holdoff_distance(void) const { return rangefinder_holdoff_before_land_point; }
bool is_commanded_go_around(void) const { return flags.commanded_go_around; }
bool is_complete(void) const;
void set_initial_slope(void) { initial_slope = slope; }
Expand Down Expand Up @@ -166,6 +167,7 @@ class AP_Landing {
AP_Int8 abort_throttle_enable;
AP_Int8 flap_percent;
AP_Int8 throttle_slewrate;
AP_Float rangefinder_holdoff_before_land_point;
AP_Int8 type;
AP_Int8 flare_effectivness_pct;
AP_Float wind_comp;
Expand Down