mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-26 14:03:34 +08:00
navigator move parameters out of MissionBlock
- MissionBlock is an interface with > 10 implementations
This commit is contained in:
committed by
Lorenz Meier
parent
8e457b6037
commit
4416c4ddb3
@@ -254,7 +254,9 @@ private:
|
||||
float slow_land_alt1;
|
||||
float slow_land_alt2;
|
||||
int32_t alt_mode;
|
||||
int32_t opt_recover;
|
||||
|
||||
bool opt_recover;
|
||||
|
||||
float rc_flt_smp_rate;
|
||||
float rc_flt_cutoff;
|
||||
|
||||
@@ -528,7 +530,6 @@ MulticopterPositionControl::MulticopterPositionControl() :
|
||||
_params_handles.hold_max_xy = param_find("MPC_HOLD_MAX_XY");
|
||||
_params_handles.hold_max_z = param_find("MPC_HOLD_MAX_Z");
|
||||
_params_handles.alt_mode = param_find("MPC_ALT_MODE");
|
||||
_params_handles.opt_recover = param_find("VT_OPT_RECOV_EN");
|
||||
_params_handles.rc_flt_cutoff = param_find("RC_FLT_CUTOFF");
|
||||
_params_handles.rc_flt_smp_rate = param_find("RC_FLT_SMP_RATE");
|
||||
|
||||
@@ -655,7 +656,11 @@ MulticopterPositionControl::parameters_update(bool force)
|
||||
param_get(_params_handles.alt_mode, &v_i);
|
||||
_params.alt_mode = v_i;
|
||||
|
||||
param_get(_params_handles.opt_recover, &_params.opt_recover);
|
||||
if (_vehicle_status.is_vtol) {
|
||||
int32_t i = 0;
|
||||
param_get(_params_handles.opt_recover, &i);
|
||||
_params.opt_recover = (i == 1);
|
||||
}
|
||||
|
||||
/* mc attitude control parameters*/
|
||||
/* manual control scale */
|
||||
@@ -714,6 +719,9 @@ MulticopterPositionControl::poll_subscriptions()
|
||||
if (_vehicle_status.is_vtol) {
|
||||
_attitude_setpoint_id = ORB_ID(mc_virtual_attitude_setpoint);
|
||||
|
||||
_params_handles.opt_recover = param_find("VT_OPT_RECOV_EN");
|
||||
parameters_update(true);
|
||||
|
||||
} else {
|
||||
_attitude_setpoint_id = ORB_ID(vehicle_attitude_setpoint);
|
||||
}
|
||||
@@ -1464,14 +1472,6 @@ MulticopterPositionControl::control_non_manual(float dt)
|
||||
control_auto(dt);
|
||||
}
|
||||
|
||||
/* weather-vane mode for vtol: disable yaw control */
|
||||
if (_vehicle_status.is_vtol) {
|
||||
_att_sp.disable_mc_yaw_control = _pos_sp_triplet.current.disable_mc_yaw_control;
|
||||
|
||||
} else {
|
||||
_att_sp.disable_mc_yaw_control = false;
|
||||
}
|
||||
|
||||
// guard against any bad velocity values
|
||||
bool velocity_valid = PX4_ISFINITE(_pos_sp_triplet.current.vx) &&
|
||||
PX4_ISFINITE(_pos_sp_triplet.current.vy) &&
|
||||
@@ -2880,7 +2880,7 @@ MulticopterPositionControl::generate_attitude_setpoint(float dt)
|
||||
_att_sp.yaw_body += euler_sp(2);
|
||||
|
||||
/* only if optimal recovery is not used, modify roll/pitch */
|
||||
if (_params.opt_recover <= 0) {
|
||||
if (!(_vehicle_status.is_vtol && _params.opt_recover)) {
|
||||
// construct attitude setpoint rotation matrix. modify the setpoints for roll
|
||||
// and pitch such that they reflect the user's intention even if a yaw error
|
||||
// (yaw_sp - yaw) is present. In the presence of a yaw error constructing a rotation matrix
|
||||
@@ -3014,7 +3014,6 @@ MulticopterPositionControl::task_main()
|
||||
/* set default max velocity in xy to vel_max */
|
||||
_vel_max_xy = _params.vel_max_xy;
|
||||
|
||||
|
||||
/* reset flags when landed */
|
||||
if (_vehicle_land_detected.landed) {
|
||||
_reset_pos_sp = true;
|
||||
|
||||
Reference in New Issue
Block a user