Skip to content

Commit

Permalink
FlightModeManager: fix integral reset on ground
Browse files Browse the repository at this point in the history
This information could also be used for yaw and integral
resets of the lower level controllers.
  • Loading branch information
MaEtUgR committed Dec 1, 2020
1 parent e28af51 commit ffba2e1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions msg/vehicle_constraints.msg
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ float32 tilt # in radians [0, PI]
float32 min_distance_to_ground # in meters
float32 max_distance_to_ground # in meters
bool want_takeoff # tell the controller to initiate takeoff when idling (ignored during flight)
bool reset_integral # tells controller to reset integrators e.g. since we know the vehicle is not in air
float32 minimum_thrust # tell controller what the minimum collective output thrust should be
2 changes: 1 addition & 1 deletion src/modules/flight_mode_manager/FlightModeManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ void FlightModeManager::generateTrajectorySetpoint(const float dt,
// set yaw-sp to current yaw
setpoint.yawspeed = 0.f;
// prevent any integrator windup
// _control.resetIntegral(); TODO
constraints.reset_integral = true;
}

_trajectory_setpoint_pub.publish(setpoint);
Expand Down
4 changes: 4 additions & 0 deletions src/modules/mc_pos_control/MulticopterPositionControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,10 @@ void MulticopterPositionControl::Run()
_control.setConstraints(constraints);
_control.setThrustLimits(constraints.minimum_thrust, _param_mpc_thr_max.get());

if (constraints.reset_integral) {
_control.resetIntegral();
}

// Run position control
if (_control.update(dt)) {
_failsafe_land_hysteresis.set_state_and_update(false, time_stamp_now);
Expand Down

0 comments on commit ffba2e1

Please sign in to comment.