Copter: Payload Place: Change PLDP_RNG_MIN to PLDP_RNG_MAX

This commit is contained in:
Leonard Hall 2024-03-05 14:41:52 +10:30 committed by Peter Barker
parent cbe5cf8c81
commit bc6d965bbc
3 changed files with 9 additions and 9 deletions

View File

@ -1176,13 +1176,13 @@ const AP_Param::GroupInfo ParametersG2::var_info2[] = {
// @User: Standard
AP_GROUPINFO("PLDP_THRESH", 1, ParametersG2, pldp_thrust_placed_fraction, 0.9),
// @Param: PLDP_RNG_MIN
// @DisplayName: Payload Place minimum range finder altitude
// @Description: Minimum range finder altitude in m to trigger payload touchdown, set to zero to disable.
// @Param: PLDP_RNG_MAX
// @DisplayName: Payload Place maximum range finder altitude
// @Description: Maximum range finder altitude in m to trigger payload touchdown, set to zero to disable.
// @Units: m
// @Range: 0 100
// @User: Standard
AP_GROUPINFO("PLDP_RNG_MIN", 2, ParametersG2, pldp_range_finder_minimum_m, 0.0),
AP_GROUPINFO("PLDP_RNG_MAX", 2, ParametersG2, pldp_range_finder_maximum_m, 0.0),
// @Param: PLDP_DELAY
// @DisplayName: Payload Place climb delay

View File

@ -682,7 +682,7 @@ public:
// payload place parameters
AP_Float pldp_thrust_placed_fraction;
AP_Float pldp_range_finder_minimum_m;
AP_Float pldp_range_finder_maximum_m;
AP_Float pldp_delay_s;
AP_Float pldp_descent_speed_ms;
};

View File

@ -1301,14 +1301,14 @@ void PayloadPlace::run()
// thrust is above minimum threshold
place_start_time_ms = now_ms;
break;
} else if (is_positive(g2.pldp_range_finder_minimum_m)) {
} else if (is_positive(g2.pldp_range_finder_maximum_m)) {
if (!copter.rangefinder_state.enabled) {
// abort payload place because rangefinder is not enabled
state = State::Ascent_Start;
gcs().send_text(MAV_SEVERITY_WARNING, "%s PLDP_RNG_MIN set and rangefinder not enabled", prefix_str);
gcs().send_text(MAV_SEVERITY_WARNING, "%s PLDP_RNG_MAX set and rangefinder not enabled", prefix_str);
break;
} else if (copter.rangefinder_alt_ok() && (copter.rangefinder_state.glitch_count == 0) && (copter.rangefinder_state.alt_cm > g2.pldp_range_finder_minimum_m * 100.0)) {
// range finder altitude is above minimum
} else if (copter.rangefinder_alt_ok() && (copter.rangefinder_state.glitch_count == 0) && (copter.rangefinder_state.alt_cm > g2.pldp_range_finder_maximum_m * 100.0)) {
// range finder altitude is above maximum
place_start_time_ms = now_ms;
break;
}