diff --git a/APMrover2/GCS_Mavlink.pde b/APMrover2/GCS_Mavlink.pde index da4ee673db..80a0f86070 100644 --- a/APMrover2/GCS_Mavlink.pde +++ b/APMrover2/GCS_Mavlink.pde @@ -240,7 +240,7 @@ static void NOINLINE send_nav_controller_output(mavlink_channel_t chan) mavlink_msg_nav_controller_output_send( chan, lateral_acceleration, // use nav_roll to hold demanded Y accel - ins.get_accel().y, // use nav_pitch to hold actual Y accel + g_gps->ground_speed_cm * 0.01f * ins.get_gyro().z, // use nav_pitch to hold actual Y accel nav_controller->nav_bearing_cd() * 0.01f, nav_controller->target_bearing_cd() * 0.01f, wp_distance, diff --git a/APMrover2/Steering.pde b/APMrover2/Steering.pde index a899f35efa..1f6f1dfef7 100644 --- a/APMrover2/Steering.pde +++ b/APMrover2/Steering.pde @@ -286,10 +286,16 @@ static void steering_learning(void) return; } /* - the idea is to slowly adjust the turning circle + the idea is to slowly adjust the turning circle to bring the + actual and desired turn rates into line */ float demanded = lateral_acceleration; - float actual = ins.get_accel().y; + /* + for Y accel use the gyro times the velocity, as that is less + noise sensitive, and is a more direct measure of steering rate, + which is what we are really trying to control + */ + float actual = ins.get_gyro().z * 0.01f * g_gps->ground_speed_cm; if (fabsf(actual) < 0.1f) { // too little acceleration to really measure accurately return;