Skip to content

Commit

Permalink
FixedwingPositionControl: regulate npfg output to zero when it is not…
Browse files Browse the repository at this point in the history
… certain
  • Loading branch information
KonradRudin committed Nov 27, 2023
1 parent 2db837b commit 55d4834
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
9 changes: 2 additions & 7 deletions src/modules/fw_pos_control/FixedwingPositionControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,6 @@ FixedwingPositionControl::vehicle_attitude_poll()
}

const Eulerf euler_angles(R);
_roll = euler_angles(0);
_pitch = euler_angles(1);
_yaw = euler_angles(2);

Expand Down Expand Up @@ -508,10 +507,10 @@ FixedwingPositionControl::landing_status_publish()

float FixedwingPositionControl::getCorrectedNpfgRollSetpoint()
{
// Scale the npfg output if npfg is not certaiin for correct output
// Scale the npfg output to zero if npfg is not certain for correct output
float new_roll_setpoint(_npfg.getRollSetpoint());
const float can_run_factor(_npfg.canRun(_local_pos, _wind_valid));
return _last_roll_setpoint + can_run_factor * (new_roll_setpoint - _last_roll_setpoint);
return can_run_factor * (new_roll_setpoint);
}

void
Expand Down Expand Up @@ -2457,10 +2456,6 @@ FixedwingPositionControl::Run()
}
}

_last_roll_setpoint = _att_sp.roll_body;

} else {
_last_roll_setpoint = _roll;
}

// if there's any change in landing gear setpoint publish it
Expand Down
2 changes: 0 additions & 2 deletions src/modules/fw_pos_control/FixedwingPositionControl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,6 @@ class FixedwingPositionControl final : public ModuleBase<FixedwingPositionContro
double _current_longitude{0};
float _current_altitude{0.f};

float _roll{0.f};
float _pitch{0.0f};
float _yaw{0.0f};
float _yawrate{0.0f};
Expand Down Expand Up @@ -400,7 +399,6 @@ class FixedwingPositionControl final : public ModuleBase<FixedwingPositionContro
matrix::Vector2d _transition_waypoint{(double)NAN, (double)NAN};
param_t _param_handle_airspeed_trans{PARAM_INVALID};
float _param_airspeed_trans{NAN}; // [m/s]
float _last_roll_setpoint{0.f}; // Roll setpoint set in the last iteration

// ESTIMATOR RESET COUNTERS

Expand Down

0 comments on commit 55d4834

Please sign in to comment.