Plane: avoid copying the DCM matrix

This commit is contained in:
Andrew Tridgell 2013-05-05 15:03:05 +10:00
parent 703a1ba438
commit 55f7d18979
2 changed files with 3 additions and 3 deletions

View File

@ -119,9 +119,9 @@ static void calc_gndspeed_undershoot()
// This prevents flyaway if wind takes plane backwards
if (g_gps && g_gps->status() >= GPS::GPS_OK_FIX_2D) {
Vector2f gndVel = ahrs.groundspeed_vector();
Matrix3f rotMat = ahrs.get_dcm_matrix();
const Matrix3f &rotMat = ahrs.get_dcm_matrix();
Vector2f yawVect = Vector2f(rotMat.a.x,rotMat.b.x);
yawVect = (yawVect).normalized();
yawVect.normalize();
float gndSpdFwd = yawVect * gndVel;
groundspeed_undershoot = (g.min_gndspeed_cm > 0) ? (g.min_gndspeed_cm - gndSpdFwd*100) : 0;
}

View File

@ -561,7 +561,7 @@ test_mag(uint8_t argc, const Menu::arg *argv)
if(medium_loopCounter == 5) {
if (compass.read()) {
// Calculate heading
Matrix3f m = ahrs.get_dcm_matrix();
const Matrix3f &m = ahrs.get_dcm_matrix();
heading = compass.calculate_heading(m);
compass.null_offsets();
}