Rover: fix G_Dt when SCHED_LOOP_RATE increased

This fixes a bug in the G_Dt calculation which is used in the motors library and PID controllers.  The issue occurred in cases where the ahrs_update was not being run which could happen because it's estimated time was too long.
This also properly runs the critical functions (update ahrs, run flight mode code, send outputs to motors) at up to 400hz
This commit is contained in:
Randy Mackay 2018-08-25 15:26:22 +09:00 committed by Andrew Tridgell
parent ff9a7b3f44
commit 9ae9f84498

View File

@ -45,10 +45,10 @@ Rover rover;
const AP_Scheduler::Task Rover::scheduler_tasks[] = {
// Function name, Hz, us,
SCHED_TASK(read_radio, 50, 200),
SCHED_TASK(ahrs_update, 50, 1500),
SCHED_TASK(ahrs_update, 400, 400),
SCHED_TASK(read_rangefinders, 50, 200),
SCHED_TASK(update_current_mode, 50, 200),
SCHED_TASK(set_servos, 50, 200),
SCHED_TASK(update_current_mode, 400, 200),
SCHED_TASK(set_servos, 400, 200),
SCHED_TASK(update_GPS, 50, 300),
SCHED_TASK_CLASS(AP_Baro, &rover.barometer, update, 10, 200),
SCHED_TASK_CLASS(AP_Beacon, &rover.g2.beacon, update, 50, 200),
@ -84,7 +84,7 @@ const AP_Scheduler::Task Rover::scheduler_tasks[] = {
#if LOGGING_ENABLED == ENABLED
SCHED_TASK_CLASS(DataFlash_Class, &rover.DataFlash, periodic_tasks, 50, 300),
#endif
SCHED_TASK_CLASS(AP_InertialSensor, &rover.ins, periodic, 50, 200),
SCHED_TASK_CLASS(AP_InertialSensor, &rover.ins, periodic, 400, 200),
SCHED_TASK_CLASS(AP_Scheduler, &rover.scheduler, update_logging, 0.1, 200),
SCHED_TASK_CLASS(AP_Button, &rover.button, update, 5, 200),
#if STATS_ENABLED == ENABLED