Browse Source

fixed code style

sbg
Andreas Antener 9 years ago
parent
commit
48e2053f98
  1. 18
      src/modules/mc_pos_control/mc_pos_control_main.cpp

18
src/modules/mc_pos_control/mc_pos_control_main.cpp

@ -918,6 +918,7 @@ void MulticopterPositionControl::control_auto(float dt) @@ -918,6 +918,7 @@ void MulticopterPositionControl::control_auto(float dt)
_reset_pos_sp = true;
_reset_alt_sp = true;
}
reset_pos_sp();
reset_alt_sp();
/* set current velocity as last target velocity to smooth out transition */
@ -1091,6 +1092,7 @@ void MulticopterPositionControl::control_auto(float dt) @@ -1091,6 +1092,7 @@ void MulticopterPositionControl::control_auto(float dt)
_reset_alt_sp = false;
/* otherwise: in case of interrupted mission don't go to waypoint but stay at current position */
} else {
_reset_pos_sp = true;
_reset_alt_sp = true;
@ -1266,8 +1268,9 @@ MulticopterPositionControl::task_main() @@ -1266,8 +1268,9 @@ MulticopterPositionControl::task_main()
}
/* weather-vane mode for vtol: disable yaw control */
if(!_control_mode.flag_control_manual_enabled && _pos_sp_triplet.current.disable_mc_yaw_control == true) {
if (!_control_mode.flag_control_manual_enabled && _pos_sp_triplet.current.disable_mc_yaw_control == true) {
_att_sp.disable_mc_yaw_control = true;
} else {
/* reset in case of setpoint updates */
_att_sp.disable_mc_yaw_control = false;
@ -1318,6 +1321,7 @@ MulticopterPositionControl::task_main() @@ -1318,6 +1321,7 @@ MulticopterPositionControl::task_main()
/* publish attitude setpoint */
if (_att_sp_pub != nullptr) {
orb_publish(_attitude_setpoint_id, _att_sp_pub, &_att_sp);
} else if (_attitude_setpoint_id) {
_att_sp_pub = orb_advertise(_attitude_setpoint_id, &_att_sp);
}
@ -1382,7 +1386,7 @@ MulticopterPositionControl::task_main() @@ -1382,7 +1386,7 @@ MulticopterPositionControl::task_main()
// check if we are not already in air.
// if yes then we don't need a jumped takeoff anymore
if (!_takeoff_jumped && !_vehicle_status.condition_landed && fabsf(_takeoff_thrust_sp) < FLT_EPSILON ) {
if (!_takeoff_jumped && !_vehicle_status.condition_landed && fabsf(_takeoff_thrust_sp) < FLT_EPSILON) {
_takeoff_jumped = true;
}
@ -1392,6 +1396,7 @@ MulticopterPositionControl::task_main() @@ -1392,6 +1396,7 @@ MulticopterPositionControl::task_main()
_takeoff_thrust_sp += 0.5f * dt;
_vel_sp.zero();
_vel_prev.zero();
} else {
// copter has reached our takeoff speed. split the thrust setpoint up
// into an integral part and into a P part
@ -1547,8 +1552,7 @@ MulticopterPositionControl::task_main() @@ -1547,8 +1552,7 @@ MulticopterPositionControl::task_main()
/* assume ground, cut thrust */
if (_in_landing
&& _vel_z_lp < 0.1f
) {
&& _vel_z_lp < 0.1f) {
thr_max = 0.0f;
_in_landing = false;
_lnd_reached_ground = true;
@ -1565,8 +1569,7 @@ MulticopterPositionControl::task_main() @@ -1565,8 +1569,7 @@ MulticopterPositionControl::task_main()
if (_lnd_reached_ground
/* XXX: magic value, assuming free fall above 4m/s2 acceleration */
&& (_acc_z_lp > 4.0f
|| _vel_z_lp > 2.0f * _params.land_speed)
) {
|| _vel_z_lp > 2.0f * _params.land_speed)) {
thr_max = _params.thr_max;
_in_landing = false;
_lnd_reached_ground = false;
@ -1811,7 +1814,8 @@ MulticopterPositionControl::task_main() @@ -1811,7 +1814,8 @@ MulticopterPositionControl::task_main()
!(!_control_mode.flag_control_altitude_enabled && _manual.z < 0.1f)) {
/* we want to know the real constraint, and global overrides manual */
const float yaw_rate_max = (_params.man_yaw_max < _params.global_yaw_max) ? _params.man_yaw_max : _params.global_yaw_max;
const float yaw_rate_max = (_params.man_yaw_max < _params.global_yaw_max) ? _params.man_yaw_max :
_params.global_yaw_max;
const float yaw_offset_max = yaw_rate_max / _params.mc_att_yaw_p;
_att_sp.yaw_sp_move_rate = _manual.r * yaw_rate_max;

Loading…
Cancel
Save