minimum follow target alt of 8 m added, protecting against nan values in pos controller, fixing ci build error

This commit is contained in:
Jimmy Johnson
2016-05-16 15:11:57 -07:00
parent 42e04d4c11
commit 38b4278998
4 changed files with 12 additions and 9 deletions
@@ -1417,10 +1417,16 @@ MulticopterPositionControl::task_main()
_vel_sp(1) = (_pos_sp(1) - _pos(1)) * _params.pos_p(1);
}
// guard against any bad velocity values
bool velocity_valid = PX4_ISFINITE(_pos_sp_triplet.current.vx) &&
PX4_ISFINITE(_pos_sp_triplet.current.vy) &&
_pos_sp_triplet.current.velocity_valid;
// do not go slower than the follow target velocity when position tracking is active (set to valid)
if(_pos_sp_triplet.current.type == position_setpoint_s::SETPOINT_TYPE_FOLLOW_TARGET &&
_pos_sp_triplet.current.velocity_valid &&
velocity_valid &&
_pos_sp_triplet.current.position_valid) {
math::Vector<3> ft_vel(_pos_sp_triplet.current.vx, _pos_sp_triplet.current.vy, 0);
@@ -1444,7 +1450,7 @@ MulticopterPositionControl::task_main()
// track target using velocity only
} else if (_pos_sp_triplet.current.type == position_setpoint_s::SETPOINT_TYPE_FOLLOW_TARGET &&
_pos_sp_triplet.current.velocity_valid) {
velocity_valid) {
_vel_sp(0) = _pos_sp_triplet.current.vx;
_vel_sp(1) = _pos_sp_triplet.current.vy;