mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-03-11 17:13:56 -03:00
AP_Mount: stop using AHRS as conduit for Compass pointer
This commit is contained in:
parent
b5b4ec94c9
commit
dc82487fae
@ -668,16 +668,15 @@ void SoloGimbalEKF::fuseVelocity()
|
||||
// check for new magnetometer data and update store measurements if available
|
||||
void SoloGimbalEKF::readMagData()
|
||||
{
|
||||
const auto &_ahrs = AP::ahrs();
|
||||
Compass &compass = AP::compass();
|
||||
|
||||
if (_ahrs.get_compass() &&
|
||||
_ahrs.get_compass()->use_for_yaw() &&
|
||||
_ahrs.get_compass()->last_update_usec() != lastMagUpdate) {
|
||||
if (compass.use_for_yaw() &&
|
||||
compass.last_update_usec() != lastMagUpdate) {
|
||||
// store time of last measurement update
|
||||
lastMagUpdate = _ahrs.get_compass()->last_update_usec();
|
||||
lastMagUpdate = compass.last_update_usec();
|
||||
|
||||
// read compass data and scale to improve numerical conditioning
|
||||
magData = _ahrs.get_compass()->get_field();
|
||||
magData = compass.get_field();
|
||||
|
||||
// let other processes know that new compass data has arrived
|
||||
newDataMag = true;
|
||||
@ -877,7 +876,7 @@ float SoloGimbalEKF::calcMagHeadingInnov()
|
||||
if (!earth_magfield.is_zero()) {
|
||||
declination = atan2f(earth_magfield.y,earth_magfield.x);
|
||||
} else {
|
||||
declination = _ahrs.get_compass()->get_declination();
|
||||
declination = AP::compass().get_declination();
|
||||
}
|
||||
|
||||
Vector3f body_magfield = Vector3f(0,0,0);
|
||||
|
Loading…
Reference in New Issue
Block a user