mirror of
https://gitee.com/xiaohuolufeihua/bizhang_-obav.git
synced 2026-05-21 01:12:11 +00:00
mc_pos_control: also use vertical smoothing in altitude
Smoothing can be configured by MPC_POS_MODE parameter put before only for position mode and not for altitude mode.
This commit is contained in:
@@ -949,15 +949,10 @@ MulticopterPositionControl::start_flight_task()
|
||||
|
||||
// manual position control
|
||||
if (_vehicle_status.nav_state == vehicle_status_s::NAVIGATION_STATE_POSCTL || task_failure) {
|
||||
|
||||
should_disable_task = false;
|
||||
int error = 0;
|
||||
|
||||
switch (MPC_POS_MODE.get()) {
|
||||
case 0:
|
||||
error = _flight_tasks.switchTask(FlightTaskIndex::ManualPosition);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
error = _flight_tasks.switchTask(FlightTaskIndex::ManualPositionSmooth);
|
||||
break;
|
||||
@@ -970,6 +965,7 @@ MulticopterPositionControl::start_flight_task()
|
||||
error = _flight_tasks.switchTask(FlightTaskIndex::ManualPositionSmoothVel);
|
||||
break;
|
||||
|
||||
case 0:
|
||||
default:
|
||||
error = _flight_tasks.switchTask(FlightTaskIndex::ManualPosition);
|
||||
break;
|
||||
@@ -991,7 +987,20 @@ MulticopterPositionControl::start_flight_task()
|
||||
// manual altitude control
|
||||
if (_vehicle_status.nav_state == vehicle_status_s::NAVIGATION_STATE_ALTCTL || task_failure) {
|
||||
should_disable_task = false;
|
||||
int error = _flight_tasks.switchTask(FlightTaskIndex::ManualAltitude);
|
||||
int error = 0;
|
||||
|
||||
switch (MPC_POS_MODE.get()) {
|
||||
case 1:
|
||||
error = _flight_tasks.switchTask(FlightTaskIndex::ManualAltitudeSmooth);
|
||||
break;
|
||||
|
||||
case 0:
|
||||
case 2:
|
||||
case 3:
|
||||
default:
|
||||
error = _flight_tasks.switchTask(FlightTaskIndex::ManualAltitude);
|
||||
break;
|
||||
}
|
||||
|
||||
if (error != 0) {
|
||||
if (prev_failure_count == 0) {
|
||||
|
||||
Reference in New Issue
Block a user