Sub: re-arrange fast_loop for minimum latency
match Copter changes @72923277
This commit is contained in:
parent
3df1aa09e8
commit
8634fb47ea
@ -166,18 +166,21 @@ void Sub::loop()
|
|||||||
// Main loop - 400hz
|
// Main loop - 400hz
|
||||||
void Sub::fast_loop()
|
void Sub::fast_loop()
|
||||||
{
|
{
|
||||||
|
// update INS immediately to get current gyro data populated
|
||||||
|
ins.update();
|
||||||
|
|
||||||
if (control_mode != MANUAL) { //don't run rate controller in manual mode
|
if (control_mode != MANUAL) { //don't run rate controller in manual mode
|
||||||
// run low level rate controllers that only require IMU data
|
// run low level rate controllers that only require IMU data
|
||||||
attitude_control.rate_controller_run();
|
attitude_control.rate_controller_run();
|
||||||
}
|
}
|
||||||
|
|
||||||
// IMU DCM Algorithm
|
|
||||||
// --------------------
|
|
||||||
read_AHRS();
|
|
||||||
|
|
||||||
// send outputs to the motors library
|
// send outputs to the motors library
|
||||||
motors_output();
|
motors_output();
|
||||||
|
|
||||||
|
// run EKF state estimator (expensive)
|
||||||
|
// --------------------
|
||||||
|
read_AHRS();
|
||||||
|
|
||||||
// Inertial Nav
|
// Inertial Nav
|
||||||
// --------------------
|
// --------------------
|
||||||
read_inertia();
|
read_inertia();
|
||||||
@ -445,8 +448,9 @@ void Sub::read_AHRS(void)
|
|||||||
gcs_check_input();
|
gcs_check_input();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ahrs.update();
|
// <true> tells AHRS to skip INS update as we have already done it in fast_loop()
|
||||||
ahrs_view.update();
|
ahrs.update(true);
|
||||||
|
ahrs_view.update(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// read baro and rangefinder altitude at 10hz
|
// read baro and rangefinder altitude at 10hz
|
||||||
|
Loading…
Reference in New Issue
Block a user