diff options
author | Anton Babushkin <anton.babushkin@me.com> | 2013-11-09 14:11:39 +0400 |
---|---|---|
committer | Anton Babushkin <anton.babushkin@me.com> | 2013-11-09 14:11:39 +0400 |
commit | 03162f5f0dd616d7c03f0781cb209e8af9fdae99 (patch) | |
tree | c08ebdda38f84b0117398dcb49a222ff8e8a88ce /src/modules/multirotor_pos_control | |
parent | c63995e91c188b476aa2608b42a366f68dced423 (diff) | |
download | px4-firmware-03162f5f0dd616d7c03f0781cb209e8af9fdae99.tar.gz px4-firmware-03162f5f0dd616d7c03f0781cb209e8af9fdae99.tar.bz2 px4-firmware-03162f5f0dd616d7c03f0781cb209e8af9fdae99.zip |
multirotor_pos_control: failsafe against invalid yaw setpoint in AUTO
Diffstat (limited to 'src/modules/multirotor_pos_control')
-rw-r--r-- | src/modules/multirotor_pos_control/multirotor_pos_control.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/modules/multirotor_pos_control/multirotor_pos_control.c b/src/modules/multirotor_pos_control/multirotor_pos_control.c index 36dd370fb..3d23d0c09 100644 --- a/src/modules/multirotor_pos_control/multirotor_pos_control.c +++ b/src/modules/multirotor_pos_control/multirotor_pos_control.c @@ -471,7 +471,10 @@ static int multirotor_pos_control_thread_main(int argc, char *argv[]) } else { local_pos_sp.z = local_pos.ref_alt - global_pos_sp.altitude; } - att_sp.yaw_body = global_pos_sp.yaw; + /* update yaw setpoint only if value is valid */ + if (isfinite(global_pos_sp.yaw) && fabsf(global_pos_sp.yaw) < M_TWOPI) { + att_sp.yaw_body = global_pos_sp.yaw; + } mavlink_log_info(mavlink_fd, "[mpc] new sp: %.7f, %.7f (%.2f, %.2f)", (double)sp_lat, sp_lon, (double)local_pos_sp.x, (double)local_pos_sp.y); |