Copter: Add TKOFF_TH_MAX

This commit is contained in:
Leonard Hall 2023-03-21 11:01:39 +10:30 committed by Randy Mackay
parent fab0adf636
commit 6d5bc17c8e
3 changed files with 10 additions and 2 deletions

View File

@ -1208,6 +1208,13 @@ const AP_Param::GroupInfo ParametersG2::var_info2[] = {
// @User: Advanced // @User: Advanced
AP_GROUPINFO("SURFTRAK_TC", 5, ParametersG2, surftrak_tc, 1.0), AP_GROUPINFO("SURFTRAK_TC", 5, ParametersG2, surftrak_tc, 1.0),
// @Param: TKOFF_THR_MAX
// @DisplayName: Takeoff maximum throttle during take-off ramp up
// @Description: Takeoff maximum throttle allowed before controllers assume the aircraft is airborne during the takeoff process.
// @Range: 0.0 0.9
// @User: Advanced
AP_GROUPINFO("TKOFF_THR_MAX", 6, ParametersG2, takeoff_throttle_max, 0.9),
// ID 62 is reserved for the AP_SUBGROUPEXTENSION // ID 62 is reserved for the AP_SUBGROUPEXTENSION
AP_GROUPEND AP_GROUPEND

View File

@ -678,6 +678,7 @@ public:
// ramp time of throttle during take-off // ramp time of throttle during take-off
AP_Float takeoff_throttle_slew_time; AP_Float takeoff_throttle_slew_time;
AP_Float takeoff_throttle_max;
#if HAL_WITH_ESC_TELEM && FRAME_CONFIG != HELI_FRAME #if HAL_WITH_ESC_TELEM && FRAME_CONFIG != HELI_FRAME
AP_Int16 takeoff_rpm_min; AP_Int16 takeoff_rpm_min;
#endif #endif

View File

@ -90,7 +90,7 @@ void Mode::_TakeOff::do_pilot_takeoff(float& pilot_climb_rate_cm)
copter.attitude_control->set_throttle_out(throttle, true, 0.0); copter.attitude_control->set_throttle_out(throttle, true, 0.0);
// tell position controller to reset alt target and reset I terms // tell position controller to reset alt target and reset I terms
copter.pos_control->init_z_controller(); copter.pos_control->init_z_controller();
if (throttle >= 0.9 || if (throttle >= MIN(copter.g2.takeoff_throttle_max, 0.9) ||
(copter.pos_control->get_z_accel_cmss() >= 0.5 * copter.pos_control->get_max_accel_z_cmss()) || (copter.pos_control->get_z_accel_cmss() >= 0.5 * copter.pos_control->get_max_accel_z_cmss()) ||
(copter.pos_control->get_vel_desired_cms().z >= constrain_float(pilot_climb_rate_cm, copter.pos_control->get_max_speed_up_cms() * 0.1, copter.pos_control->get_max_speed_up_cms() * 0.5)) || (copter.pos_control->get_vel_desired_cms().z >= constrain_float(pilot_climb_rate_cm, copter.pos_control->get_max_speed_up_cms() * 0.1, copter.pos_control->get_max_speed_up_cms() * 0.5)) ||
(is_positive(take_off_complete_alt - take_off_start_alt) && copter.pos_control->get_pos_target_z_cm() - take_off_start_alt > 0.5 * (take_off_complete_alt - take_off_start_alt))) { (is_positive(take_off_complete_alt - take_off_start_alt) && copter.pos_control->get_pos_target_z_cm() - take_off_start_alt > 0.5 * (take_off_complete_alt - take_off_start_alt))) {
@ -166,7 +166,7 @@ void Mode::auto_takeoff_run()
pos_control->update_xy_controller(); pos_control->update_xy_controller();
attitude_control->reset_rate_controller_I_terms(); attitude_control->reset_rate_controller_I_terms();
attitude_control->input_thrust_vector_rate_heading(pos_control->get_thrust_vector(), 0.0); attitude_control->input_thrust_vector_rate_heading(pos_control->get_thrust_vector(), 0.0);
if (throttle >= 0.9 || if (throttle >= MIN(copter.g2.takeoff_throttle_max, 0.9) ||
(copter.pos_control->get_z_accel_cmss() >= 0.5 * copter.pos_control->get_max_accel_z_cmss()) || (copter.pos_control->get_z_accel_cmss() >= 0.5 * copter.pos_control->get_max_accel_z_cmss()) ||
(copter.pos_control->get_vel_desired_cms().z >= 0.1 * copter.pos_control->get_max_speed_up_cms()) || (copter.pos_control->get_vel_desired_cms().z >= 0.1 * copter.pos_control->get_max_speed_up_cms()) ||
( auto_takeoff_no_nav_active && (inertial_nav.get_position_z_up_cm() >= auto_takeoff_no_nav_alt_cm))) { ( auto_takeoff_no_nav_active && (inertial_nav.get_position_z_up_cm() >= auto_takeoff_no_nav_alt_cm))) {