From 84ac8abc42ad24e489fc93031a58c3b689b1210b Mon Sep 17 00:00:00 2001 From: Grant Morphett Date: Mon, 22 Jun 2015 08:48:30 +1000 Subject: [PATCH] AP_Mount: Fixed a bug with wrapping of panning angles. --- libraries/AP_Mount/AP_Mount_Backend.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/AP_Mount/AP_Mount_Backend.cpp b/libraries/AP_Mount/AP_Mount_Backend.cpp index addff24c4a..08f35deb1b 100644 --- a/libraries/AP_Mount/AP_Mount_Backend.cpp +++ b/libraries/AP_Mount/AP_Mount_Backend.cpp @@ -95,15 +95,15 @@ void AP_Mount_Backend::update_targets_from_rc() // allow pilot speed position input to come directly from an RC_Channel if (roll_rc_in && rc_ch(roll_rc_in)) { _angle_ef_target_rad.x += rc_ch(roll_rc_in)->norm_input_dz() * 0.0001f * _frontend._joystick_speed; - constrain_float(_angle_ef_target_rad.x, radians(_state._roll_angle_min*0.01f), radians(_state._roll_angle_max*0.01f)); + _angle_ef_target_rad.x = constrain_float(_angle_ef_target_rad.x, radians(_state._roll_angle_min*0.01f), radians(_state._roll_angle_max*0.01f)); } if (tilt_rc_in && (rc_ch(tilt_rc_in))) { _angle_ef_target_rad.y += rc_ch(tilt_rc_in)->norm_input_dz() * 0.0001f * _frontend._joystick_speed; - constrain_float(_angle_ef_target_rad.y, radians(_state._tilt_angle_min*0.01f), radians(_state._tilt_angle_max*0.01f)); + _angle_ef_target_rad.y = constrain_float(_angle_ef_target_rad.y, radians(_state._tilt_angle_min*0.01f), radians(_state._tilt_angle_max*0.01f)); } if (pan_rc_in && (rc_ch(pan_rc_in))) { _angle_ef_target_rad.z += rc_ch(pan_rc_in)->norm_input_dz() * 0.0001f * _frontend._joystick_speed; - constrain_float(_angle_ef_target_rad.z, radians(_state._pan_angle_min*0.01f), radians(_state._pan_angle_max*0.01f)); + _angle_ef_target_rad.z = constrain_float(_angle_ef_target_rad.z, radians(_state._pan_angle_min*0.01f), radians(_state._pan_angle_max*0.01f)); } } else { // allow pilot position input to come directly from an RC_Channel