mc_pos_control: moded weathervane parameters to weathervane lib

Signed-off-by: Roman <bapstroman@gmail.com>
This commit is contained in:
Roman
2018-09-19 08:27:07 +02:00
committed by Lorenz Meier
parent 8abcf2defa
commit 4ad11484ca
5 changed files with 121 additions and 78 deletions
@@ -142,12 +142,7 @@ private:
(ParamInt<px4::params::MPC_POS_MODE>) MPC_POS_MODE,
(ParamInt<px4::params::MPC_ALT_MODE>) MPC_ALT_MODE,
(ParamFloat<px4::params::MPC_IDLE_TKO>) MPC_IDLE_TKO, /**< time constant for smooth takeoff ramp */
(ParamInt<px4::params::MPC_OBS_AVOID>) MPC_OBS_AVOID, /**< enable obstacle avoidance */
(ParamBool<px4::params::MPC_WV_MAN_EN>) _wv_manual_enabled,
(ParamBool<px4::params::MPC_WV_AUTO_EN>) _wv_auto_enabled,
(ParamFloat<px4::params::MPC_WV_ROLL_MIN>) _wv_min_roll,
(ParamFloat<px4::params::MPC_WV_GAIN>) _wv_gain,
(ParamFloat<px4::params::MPC_WV_YRATE_MAX>) _wv_max_yaw_rate
(ParamInt<px4::params::MPC_OBS_AVOID>) MPC_OBS_AVOID /**< enable obstacle avoidance */
);
control::BlockDerivative _vel_x_deriv; /**< velocity derivative in x */
@@ -380,9 +375,7 @@ MulticopterPositionControl::parameters_update(bool force)
// set trigger time for arm hysteresis
_arm_hysteresis.set_hysteresis_time_from(false, (int)(MPC_IDLE_TKO.get() * 1000000.0f));
_wv_controller.set_weathervane_gain(_wv_gain.get());
_wv_controller.set_min_roll_rad(math::radians(_wv_min_roll.get()));
_wv_controller.set_yawrate_max_rad(math::radians(_wv_max_yaw_rate.get()));
_wv_controller.update_parameters();
}
return OK;
@@ -602,10 +595,10 @@ MulticopterPositionControl::task_main()
// activate the weathervane controller if required. If activated a flighttask can use it to implement a yaw-rate control strategy
// that turns the nose of the vehicle into the wind
if (_control_mode.flag_control_manual_enabled && _control_mode.flag_control_attitude_enabled
&& _wv_manual_enabled.get()) {
&& _wv_controller.manual_enabled()) {
_wv_controller.activate();
} else if (_control_mode.flag_control_auto_enabled && _wv_auto_enabled.get()) {
} else if (_control_mode.flag_control_auto_enabled && _wv_controller.auto_enabled()) {
_wv_controller.activate();
} else {
@@ -672,52 +672,3 @@ PARAM_DEFINE_INT32(MPC_OBS_AVOID, 0);
* @group Mission
*/
PARAM_DEFINE_INT32(MPC_YAW_MODE, 0);
/**
* Enable weathervane for manual.
*
* @value 0 Disabled
* @value 1 Enabled
* @group Multicopter Position Control
*/
PARAM_DEFINE_INT32(MPC_WV_MAN_EN, 0);
/**
* Enable weathervane for auto.
*
* @value 0 Disabled
* @value 1 Enabled
* @group Multicopter Position Control
*/
PARAM_DEFINE_INT32(MPC_WV_AUTO_EN, 0);
/**
* Weather-vane yaw rate from roll gain.
*
* The desired gain to convert roll sp into yaw rate sp.
*
* @min 0.0
* @max 3.0
* @increment 0.01
* @decimal 3
* @group VTOL Attitude Control
*/
PARAM_DEFINE_FLOAT(MPC_WV_GAIN, 1.0f);
/**
* Minimum roll angle setpoint for weathervane controller to demand a yaw-rate.
*
* @min 0
* @max 5
* @group Multicopter Position Control
*/
PARAM_DEFINE_FLOAT(MPC_WV_ROLL_MIN, 1.0f);
/**
* Maximum yawrate the weathervane controller is able to demand.
*
* @min 0
* @max 120
* @group Multicopter Position Control
*/
PARAM_DEFINE_FLOAT(MPC_WV_YRATE_MAX, 90.0f);