mc_att_control: parameters MC_SCALE_XXX renamed to MC_MAN_X_MAX

This commit is contained in:
Anton Babushkin 2014-04-07 14:16:10 +04:00
parent 606660d94a
commit 9a579fa870
2 changed files with 24 additions and 24 deletions

View File

@ -157,9 +157,9 @@ private:
param_t yaw_rate_d; param_t yaw_rate_d;
param_t yaw_ff; param_t yaw_ff;
param_t man_scale_roll; param_t man_roll_max;
param_t man_scale_pitch; param_t man_pitch_max;
param_t man_scale_yaw; param_t man_yaw_max;
} _params_handles; /**< handles for interesting parameters */ } _params_handles; /**< handles for interesting parameters */
struct { struct {
@ -169,9 +169,9 @@ private:
math::Vector<3> rate_d; /**< D gain for angular rate error */ math::Vector<3> rate_d; /**< D gain for angular rate error */
float yaw_ff; /**< yaw control feed-forward */ float yaw_ff; /**< yaw control feed-forward */
float man_scale_roll; float man_roll_max;
float man_scale_pitch; float man_pitch_max;
float man_scale_yaw; float man_yaw_max;
} _params; } _params;
/** /**
@ -299,9 +299,9 @@ MulticopterAttitudeControl::MulticopterAttitudeControl() :
_params_handles.yaw_rate_d = param_find("MC_YAWRATE_D"); _params_handles.yaw_rate_d = param_find("MC_YAWRATE_D");
_params_handles.yaw_ff = param_find("MC_YAW_FF"); _params_handles.yaw_ff = param_find("MC_YAW_FF");
_params_handles.man_scale_roll = param_find("MC_SCALE_ROLL"); _params_handles.man_roll_max = param_find("MC_MAN_R_MAX");
_params_handles.man_scale_pitch = param_find("MC_SCALE_PITCH"); _params_handles.man_pitch_max = param_find("MC_MAN_P_MAX");
_params_handles.man_scale_yaw = param_find("MC_SCALE_YAW"); _params_handles.man_yaw_max = param_find("MC_MAN_Y_MAX");
/* fetch initial parameter values */ /* fetch initial parameter values */
parameters_update(); parameters_update();
@ -369,13 +369,13 @@ MulticopterAttitudeControl::parameters_update()
param_get(_params_handles.yaw_ff, &_params.yaw_ff); param_get(_params_handles.yaw_ff, &_params.yaw_ff);
/* manual control scale */ /* manual control scale */
param_get(_params_handles.man_scale_roll, &_params.man_scale_roll); param_get(_params_handles.man_roll_max, &_params.man_roll_max);
param_get(_params_handles.man_scale_pitch, &_params.man_scale_pitch); param_get(_params_handles.man_pitch_max, &_params.man_pitch_max);
param_get(_params_handles.man_scale_yaw, &_params.man_scale_yaw); param_get(_params_handles.man_yaw_max, &_params.man_yaw_max);
_params.man_scale_roll *= M_PI / 180.0; _params.man_roll_max *= M_PI / 180.0;
_params.man_scale_pitch *= M_PI / 180.0; _params.man_pitch_max *= M_PI / 180.0;
_params.man_scale_yaw *= M_PI / 180.0; _params.man_yaw_max *= M_PI / 180.0;
return OK; return OK;
} }
@ -496,7 +496,7 @@ MulticopterAttitudeControl::control_attitude(float dt)
//} //}
} else { } else {
/* move yaw setpoint */ /* move yaw setpoint */
_v_att_sp.yaw_body = _wrap_pi(_v_att_sp.yaw_body + _manual_control_sp.yaw * _params.man_scale_yaw * dt); _v_att_sp.yaw_body = _wrap_pi(_v_att_sp.yaw_body + _manual_control_sp.yaw * _params.man_yaw_max * dt);
_v_att_sp.R_valid = false; _v_att_sp.R_valid = false;
publish_att_sp = true; publish_att_sp = true;
} }
@ -511,8 +511,8 @@ MulticopterAttitudeControl::control_attitude(float dt)
if (!_v_control_mode.flag_control_velocity_enabled) { if (!_v_control_mode.flag_control_velocity_enabled) {
/* update attitude setpoint if not in position control mode */ /* update attitude setpoint if not in position control mode */
_v_att_sp.roll_body = _manual_control_sp.roll * _params.man_scale_roll; _v_att_sp.roll_body = _manual_control_sp.roll * _params.man_roll_max;
_v_att_sp.pitch_body = -_manual_control_sp.pitch * _params.man_scale_pitch; _v_att_sp.pitch_body = -_manual_control_sp.pitch * _params.man_pitch_max;
_v_att_sp.R_valid = false; _v_att_sp.R_valid = false;
publish_att_sp = true; publish_att_sp = true;
} }

View File

@ -175,30 +175,30 @@ PARAM_DEFINE_FLOAT(MC_YAWRATE_D, 0.0f);
PARAM_DEFINE_FLOAT(MC_YAW_FF, 0.5f); PARAM_DEFINE_FLOAT(MC_YAW_FF, 0.5f);
/** /**
* Manual control scaling factor for roll * Max manual roll
* *
* @unit deg * @unit deg
* @min 0.0 * @min 0.0
* @max 90.0 * @max 90.0
* @group Multicopter Attitude Control * @group Multicopter Attitude Control
*/ */
PARAM_DEFINE_FLOAT(MC_SCALE_ROLL, 35.0f); PARAM_DEFINE_FLOAT(MC_MAN_R_MAX, 35.0f);
/** /**
* Manual control scaling factor for pitch * Max manual pitch
* *
* @unit deg * @unit deg
* @min 0.0 * @min 0.0
* @max 90.0 * @max 90.0
* @group Multicopter Attitude Control * @group Multicopter Attitude Control
*/ */
PARAM_DEFINE_FLOAT(MC_SCALE_PITCH, 35.0f); PARAM_DEFINE_FLOAT(MC_MAN_P_MAX, 35.0f);
/** /**
* Manual control scaling factor for yaw * Max manual yaw rate
* *
* @unit deg/s * @unit deg/s
* @min 0.0 * @min 0.0
* @group Multicopter Attitude Control * @group Multicopter Attitude Control
*/ */
PARAM_DEFINE_FLOAT(MC_SCALE_YAW, 120.0f); PARAM_DEFINE_FLOAT(MC_MAN_Y_MAX, 120.0f);