ArduCopter: add PARAMETER CONVERSION comments

This commit is contained in:
Peter Barker 2022-04-26 10:24:59 +10:00 committed by Peter Barker
parent a5dee06afb
commit f4b46d3b9c

View File

@ -1173,23 +1173,30 @@ ParametersG2::ParametersG2(void)
old object. This should be zero for top level parameters.
*/
const AP_Param::ConversionInfo conversion_table[] = {
// PARAMETER_CONVERSION - Added: Oct-2014
{ Parameters::k_param_log_bitmask_old, 0, AP_PARAM_INT16, "LOG_BITMASK" },
// PARAMETER_CONVERSION - Added: Jan-2015
{ Parameters::k_param_serial0_baud, 0, AP_PARAM_INT16, "SERIAL0_BAUD" },
{ Parameters::k_param_serial1_baud, 0, AP_PARAM_INT16, "SERIAL1_BAUD" },
{ Parameters::k_param_serial2_baud, 0, AP_PARAM_INT16, "SERIAL2_BAUD" },
// PARAMETER_CONVERSION - Added: Jan-2017
{ Parameters::k_param_arming_check_old, 0, AP_PARAM_INT8, "ARMING_CHECK" },
// battery
// PARAMETER_CONVERSION - Added: Mar-2018
{ Parameters::k_param_fs_batt_voltage, 0, AP_PARAM_FLOAT, "BATT_LOW_VOLT" },
{ Parameters::k_param_fs_batt_mah, 0, AP_PARAM_FLOAT, "BATT_LOW_MAH" },
{ Parameters::k_param_failsafe_battery_enabled,0, AP_PARAM_INT8, "BATT_FS_LOW_ACT" },
// PARAMETER_CONVERSION - Added: Aug-2018
{ Parameters::Parameters::k_param_ch7_option_old, 0, AP_PARAM_INT8, "RC7_OPTION" },
{ Parameters::Parameters::k_param_ch8_option_old, 0, AP_PARAM_INT8, "RC8_OPTION" },
{ Parameters::Parameters::k_param_ch9_option_old, 0, AP_PARAM_INT8, "RC9_OPTION" },
{ Parameters::Parameters::k_param_ch10_option_old, 0, AP_PARAM_INT8, "RC10_OPTION" },
{ Parameters::Parameters::k_param_ch11_option_old, 0, AP_PARAM_INT8, "RC11_OPTION" },
{ Parameters::Parameters::k_param_ch12_option_old, 0, AP_PARAM_INT8, "RC12_OPTION" },
// PARAMETER_CONVERSION - Added: Apr-2019
{ Parameters::k_param_compass_enabled_deprecated, 0, AP_PARAM_INT8, "COMPASS_ENABLE" },
// PARAMETER_CONVERSION - Added: Jul-2019
{ Parameters::k_param_arming, 2, AP_PARAM_INT16, "ARMING_CHECK" },
};
@ -1222,13 +1229,16 @@ void Copter::load_parameters(void)
#if LANDING_GEAR_ENABLED == ENABLED
// convert landing gear parameters
// PARAMETER_CONVERSION - Added: Nov-2018
convert_lgr_parameters();
#endif
// convert fs_options parameters
// PARAMETER_CONVERSION - Added: Nov-2019
convert_fs_options_params();
#if MODE_RTL_ENABLED == ENABLED
// PARAMETER_CONVERSION - Added: Sep-2021
g.rtl_altitude.convert_parameter_width(AP_PARAM_INT16);
#endif
@ -1244,6 +1254,7 @@ void Copter::convert_pid_parameters(void)
{
// conversion info
const AP_Param::ConversionInfo pid_conversion_info[] = {
// PARAMETER_CONVERSION - Added: Apr-2016
{ Parameters::k_param_pid_rate_roll, 0, AP_PARAM_FLOAT, "ATC_RAT_RLL_P" },
{ Parameters::k_param_pid_rate_roll, 1, AP_PARAM_FLOAT, "ATC_RAT_RLL_I" },
{ Parameters::k_param_pid_rate_roll, 2, AP_PARAM_FLOAT, "ATC_RAT_RLL_D" },
@ -1254,16 +1265,19 @@ void Copter::convert_pid_parameters(void)
{ Parameters::k_param_pid_rate_yaw, 1, AP_PARAM_FLOAT, "ATC_RAT_YAW_I" },
{ Parameters::k_param_pid_rate_yaw, 2, AP_PARAM_FLOAT, "ATC_RAT_YAW_D" },
#if FRAME_CONFIG == HELI_FRAME
// PARAMETER_CONVERSION - Added: May-2016
{ Parameters::k_param_pid_rate_roll, 4, AP_PARAM_FLOAT, "ATC_RAT_RLL_VFF" },
{ Parameters::k_param_pid_rate_pitch, 4, AP_PARAM_FLOAT, "ATC_RAT_PIT_VFF" },
{ Parameters::k_param_pid_rate_yaw , 4, AP_PARAM_FLOAT, "ATC_RAT_YAW_VFF" },
#endif
};
const AP_Param::ConversionInfo imax_conversion_info[] = {
// PARAMETER_CONVERSION - Added: Apr-2016
{ Parameters::k_param_pid_rate_roll, 5, AP_PARAM_FLOAT, "ATC_RAT_RLL_IMAX" },
{ Parameters::k_param_pid_rate_pitch, 5, AP_PARAM_FLOAT, "ATC_RAT_PIT_IMAX" },
{ Parameters::k_param_pid_rate_yaw, 5, AP_PARAM_FLOAT, "ATC_RAT_YAW_IMAX" },
#if FRAME_CONFIG == HELI_FRAME
// PARAMETER_CONVERSION - Added: May-2016
{ Parameters::k_param_pid_rate_roll, 7, AP_PARAM_FLOAT, "ATC_RAT_RLL_ILMI" },
{ Parameters::k_param_pid_rate_pitch, 7, AP_PARAM_FLOAT, "ATC_RAT_PIT_ILMI" },
{ Parameters::k_param_pid_rate_yaw, 7, AP_PARAM_FLOAT, "ATC_RAT_YAW_ILMI" },
@ -1271,36 +1285,46 @@ void Copter::convert_pid_parameters(void)
};
// conversion from Copter-3.3 to Copter-3.4
const AP_Param::ConversionInfo angle_and_filt_conversion_info[] = {
// PARAMETER_CONVERSION - Added: May-2016
{ Parameters::k_param_p_stabilize_roll, 0, AP_PARAM_FLOAT, "ATC_ANG_RLL_P" },
{ Parameters::k_param_p_stabilize_pitch, 0, AP_PARAM_FLOAT, "ATC_ANG_PIT_P" },
{ Parameters::k_param_p_stabilize_yaw, 0, AP_PARAM_FLOAT, "ATC_ANG_YAW_P" },
// PARAMETER_CONVERSION - Added: Apr-2016
{ Parameters::k_param_pid_rate_roll, 6, AP_PARAM_FLOAT, "ATC_RAT_RLL_FILT" },
{ Parameters::k_param_pid_rate_pitch, 6, AP_PARAM_FLOAT, "ATC_RAT_PIT_FILT" },
// PARAMETER_CONVERSION - Added: Jan-2018
{ Parameters::k_param_pid_rate_yaw, 6, AP_PARAM_FLOAT, "ATC_RAT_YAW_FILT" },
{ Parameters::k_param_pi_vel_xy, 0, AP_PARAM_FLOAT, "PSC_VELXY_P" },
{ Parameters::k_param_pi_vel_xy, 1, AP_PARAM_FLOAT, "PSC_VELXY_I" },
{ Parameters::k_param_pi_vel_xy, 2, AP_PARAM_FLOAT, "PSC_VELXY_IMAX" },
// PARAMETER_CONVERSION - Added: Aug-2021
{ Parameters::k_param_pi_vel_xy, 3, AP_PARAM_FLOAT, "PSC_VELXY_FLTE" },
// PARAMETER_CONVERSION - Added: Jan-2018
{ Parameters::k_param_p_vel_z, 0, AP_PARAM_FLOAT, "PSC_VELZ_P" },
{ Parameters::k_param_pid_accel_z, 0, AP_PARAM_FLOAT, "PSC_ACCZ_P" },
{ Parameters::k_param_pid_accel_z, 1, AP_PARAM_FLOAT, "PSC_ACCZ_I" },
{ Parameters::k_param_pid_accel_z, 2, AP_PARAM_FLOAT, "PSC_ACCZ_D" },
{ Parameters::k_param_pid_accel_z, 5, AP_PARAM_FLOAT, "PSC_ACCZ_IMAX" },
// PARAMETER_CONVERSION - Added: Oct-2019
{ Parameters::k_param_pid_accel_z, 6, AP_PARAM_FLOAT, "PSC_ACCZ_FLTE" },
// PARAMETER_CONVERSION - Added: Jan-2018
{ Parameters::k_param_p_alt_hold, 0, AP_PARAM_FLOAT, "PSC_POSZ_P" },
{ Parameters::k_param_p_pos_xy, 0, AP_PARAM_FLOAT, "PSC_POSXY_P" },
};
const AP_Param::ConversionInfo throttle_conversion_info[] = {
// PARAMETER_CONVERSION - Added: Jun-2016
{ Parameters::k_param_throttle_min, 0, AP_PARAM_FLOAT, "MOT_SPIN_MIN" },
{ Parameters::k_param_throttle_mid, 0, AP_PARAM_FLOAT, "MOT_THST_HOVER" }
};
const AP_Param::ConversionInfo loiter_conversion_info[] = {
// PARAMETER_CONVERSION - Added: Apr-2018
{ Parameters::k_param_wp_nav, 4, AP_PARAM_FLOAT, "LOIT_SPEED" },
{ Parameters::k_param_wp_nav, 7, AP_PARAM_FLOAT, "LOIT_BRK_JERK" },
{ Parameters::k_param_wp_nav, 8, AP_PARAM_FLOAT, "LOIT_ACC_MAX" },
{ Parameters::k_param_wp_nav, 9, AP_PARAM_FLOAT, "LOIT_BRK_ACCEL" }
};
// PARAMETER_CONVERSION - Added: Apr-2016
// gains increase by 27% due to attitude controller's switch to use radians instead of centi-degrees
// and motor libraries switch to accept inputs in -1 to +1 range instead of -4500 ~ +4500
float pid_scaler = 1.27f;
@ -1329,6 +1353,7 @@ void Copter::convert_pid_parameters(void)
AP_Param::convert_old_parameter(&info, 0.001f);
}
// convert RC_FEEL_RP to ATC_INPUT_TC
// PARAMETER_CONVERSION - Added: Mar-2018
const AP_Param::ConversionInfo rc_feel_rp_conversion_info = { Parameters::k_param_rc_feel_rp, 0, AP_PARAM_INT8, "ATC_INPUT_TC" };
AP_Int8 rc_feel_rp_old;
if (AP_Param::find_old_parameter(&rc_feel_rp_conversion_info, &rc_feel_rp_old)) {
@ -1342,6 +1367,7 @@ void Copter::convert_pid_parameters(void)
// TradHeli default parameters
#if FRAME_CONFIG == HELI_FRAME
static const struct AP_Param::defaults_table_struct heli_defaults_table[] = {
// PARAMETER_CONVERSION - Added: Nov-2018
{ "LOIT_ACC_MAX", 500.0f },
{ "LOIT_BRK_ACCEL", 125.0f },
{ "LOIT_BRK_DELAY", 1.0f },
@ -1353,8 +1379,11 @@ void Copter::convert_pid_parameters(void)
{ "PSC_VELXY_D", 0.0f },
{ "PSC_VELXY_I", 0.5f },
{ "PSC_VELXY_P", 1.0f },
// PARAMETER_CONVERSION - Added: Jan-2019
{ "RC8_OPTION", 32 },
// PARAMETER_CONVERSION - Added: Aug-2018
{ "RC_OPTIONS", 0 },
// PARAMETER_CONVERSION - Added: Feb-2022
{ "ATC_RAT_RLL_ILMI", 0.05},
{ "ATC_RAT_PIT_ILMI", 0.05},
};
@ -1366,20 +1395,26 @@ void Copter::convert_pid_parameters(void)
const AP_Param::ConversionInfo ff_and_filt_conversion_info[] = {
#if FRAME_CONFIG == HELI_FRAME
// tradheli moves ATC_RAT_RLL/PIT_FILT to FLTE, ATC_RAT_YAW_FILT to FLTE
// PARAMETER_CONVERSION - Added: Jul-2019
{ Parameters::k_param_attitude_control, 386, AP_PARAM_FLOAT, "ATC_RAT_RLL_FLTE" },
{ Parameters::k_param_attitude_control, 387, AP_PARAM_FLOAT, "ATC_RAT_PIT_FLTE" },
{ Parameters::k_param_attitude_control, 388, AP_PARAM_FLOAT, "ATC_RAT_YAW_FLTE" },
#else
// multicopters move ATC_RAT_RLL/PIT_FILT to FLTD & FLTT, ATC_RAT_YAW_FILT to FLTE
{ Parameters::k_param_attitude_control, 385, AP_PARAM_FLOAT, "ATC_RAT_RLL_FLTD" },
// PARAMETER_CONVERSION - Added: Oct-2019
{ Parameters::k_param_attitude_control, 385, AP_PARAM_FLOAT, "ATC_RAT_RLL_FLTT" },
// PARAMETER_CONVERSION - Added: Jul-2019
{ Parameters::k_param_attitude_control, 386, AP_PARAM_FLOAT, "ATC_RAT_PIT_FLTD" },
// PARAMETER_CONVERSION - Added: Oct-2019
{ Parameters::k_param_attitude_control, 386, AP_PARAM_FLOAT, "ATC_RAT_PIT_FLTT" },
// PARAMETER_CONVERSION - Added: Jul-2019
{ Parameters::k_param_attitude_control, 387, AP_PARAM_FLOAT, "ATC_RAT_YAW_FLTE" },
{ Parameters::k_param_attitude_control, 449, AP_PARAM_FLOAT, "ATC_RAT_RLL_FF" },
{ Parameters::k_param_attitude_control, 450, AP_PARAM_FLOAT, "ATC_RAT_PIT_FF" },
{ Parameters::k_param_attitude_control, 451, AP_PARAM_FLOAT, "ATC_RAT_YAW_FF" },
#endif
// PARAMETER_CONVERSION - Added: Oct-2019
{ Parameters::k_param_pos_control, 388, AP_PARAM_FLOAT, "PSC_ACCZ_FLTE" },
};
uint8_t filt_table_size = ARRAY_SIZE(ff_and_filt_conversion_info);
@ -1391,6 +1426,7 @@ void Copter::convert_pid_parameters(void)
if (!ins.harmonic_notches[1].params.enabled()) {
// notch filter parameter conversions (moved to INS_HNTC2) for 4.2.x, converted from fixed notch
const AP_Param::ConversionInfo notchfilt_conversion_info[] {
// PARAMETER_CONVERSION - Added: Apr 2022
{ Parameters::k_param_ins, 101, AP_PARAM_INT8, "INS_HNTC2_ENABLE" },
{ Parameters::k_param_ins, 293, AP_PARAM_FLOAT, "INS_HNTC2_ATT" },
{ Parameters::k_param_ins, 357, AP_PARAM_FLOAT, "INS_HNTC2_FREQ" },
@ -1406,6 +1442,7 @@ void Copter::convert_pid_parameters(void)
#endif
// ACRO_RP_P and ACRO_Y_P replaced with ACRO_RP_RATE and ACRO_Y_RATE for Copter-4.2
// PARAMETER_CONVERSION - Added: Sep-2021
const AP_Param::ConversionInfo acro_rpy_conversion_info[] = {
{ Parameters::k_param_acro_rp_p, 0, AP_PARAM_FLOAT, "ACRO_RP_RATE" },
{ Parameters::k_param_acro_yaw_p, 0, AP_PARAM_FLOAT, "ACRO_Y_RATE" }
@ -1424,6 +1461,8 @@ void Copter::convert_pid_parameters(void)
*/
void Copter::convert_lgr_parameters(void)
{
// PARAMETER_CONVERSION - Added: Nov-2018
// convert landing gear PWM values
uint8_t chan;
if (!SRV_Channels::find_channel(SRV_Channel::k_landing_gear_control, chan)) {
@ -1506,6 +1545,7 @@ void Copter::convert_lgr_parameters(void)
// handle conversion of tradheli parameters from Copter-3.6 to Copter-3.7
void Copter::convert_tradheli_parameters(void) const
{
// PARAMETER_CONVERSION - Added: Mar-2019
if (g2.frame_class.get() == AP_Motors::MOTOR_FRAME_HELI) {
// single heli conversion info
const AP_Param::ConversionInfo singleheli_conversion_info[] = {
@ -1523,6 +1563,7 @@ void Copter::convert_tradheli_parameters(void) const
}
// convert to known swash type for setups that match
// PARAMETER_CONVERSION - Added: Sep-2019
AP_Int16 swash_pos_1, swash_pos_2, swash_pos_3, swash_phang;
AP_Int8 swash_type;
bool swash_pos1_exist = AP_Param::find_old_parameter(&singleheli_conversion_info[0], &swash_pos_1);
@ -1559,12 +1600,17 @@ void Copter::convert_tradheli_parameters(void) const
{ Parameters::k_param_motors, 1, AP_PARAM_INT16, "H_SW_H3_SV1_POS" },
{ Parameters::k_param_motors, 2, AP_PARAM_INT16, "H_SW_H3_SV2_POS" },
{ Parameters::k_param_motors, 3, AP_PARAM_INT16, "H_SW_H3_SV3_POS" },
// PARAMETER_CONVERSION - Added: Mar-2019
{ Parameters::k_param_motors, 4, AP_PARAM_INT16, "H_SW2_H3_SV1_POS" },
{ Parameters::k_param_motors, 5, AP_PARAM_INT16, "H_SW2_H3_SV2_POS" },
{ Parameters::k_param_motors, 6, AP_PARAM_INT16, "H_SW2_H3_SV3_POS" },
// PARAMETER_CONVERSION - Added: Sep-2019
{ Parameters::k_param_motors, 7, AP_PARAM_INT16, "H_SW_H3_PHANG" },
// PARAMETER_CONVERSION - Added: Mar-2019
{ Parameters::k_param_motors, 8, AP_PARAM_INT16, "H_SW2_H3_PHANG" },
// PARAMETER_CONVERSION - Added: Sep-2019
{ Parameters::k_param_motors, 19, AP_PARAM_INT8, "H_SW_COL_DIR" },
// PARAMETER_CONVERSION - Added: Mar-2019
{ Parameters::k_param_motors, 19, AP_PARAM_INT8, "H_SW2_COL_DIR" },
};
@ -1575,6 +1621,8 @@ void Copter::convert_tradheli_parameters(void) const
}
// PARAMETER_CONVERSION - Added: Sep-2019
// convert to known swash type for setups that match
AP_Int16 swash1_pos_1, swash1_pos_2, swash1_pos_3, swash1_phang, swash2_pos_1, swash2_pos_2, swash2_pos_3, swash2_phang;
bool swash1_pos1_exist = AP_Param::find_old_parameter(&dualheli_conversion_info[0], &swash1_pos_1);
@ -1661,6 +1709,7 @@ void Copter::convert_tradheli_parameters(void) const
AP_Param::set_and_save_by_name("H_TAIL_SPEED", tailspeed_pct );
}
// PARAMETER_CONVERSION - Added: Dec-2019
// table of stabilize collective parameters to be converted with scaling
const AP_Param::ConversionInfo collhelipct_conversion_info[] = {
{ Parameters::k_param_input_manager, 1, AP_PARAM_INT16, "IM_STB_COL_1" },
@ -1680,6 +1729,8 @@ void Copter::convert_tradheli_parameters(void) const
void Copter::convert_fs_options_params(void) const
{
// PARAMETER_CONVERSION - Added: Nov-2019
// If FS_OPTIONS has already been configured and we don't change it.
enum ap_var_type ptype;
AP_Int32 *fs_opt = (AP_Int32 *)AP_Param::find("FS_OPTIONS", &ptype);