mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 14:38:30 -04:00
HAL_SITL: fix for multi-compass SITL
This commit is contained in:
parent
91b4ba3588
commit
3370ec62a1
@ -39,10 +39,11 @@ void SITL_State::_update_compass(float rollDeg, float pitchDeg, float yawDeg)
|
||||
if (yawDeg < -180.0f) {
|
||||
yawDeg += 360.0f;
|
||||
}
|
||||
_compass->setHIL(radians(rollDeg), radians(pitchDeg), radians(yawDeg));
|
||||
_compass->setHIL(0, radians(rollDeg), radians(pitchDeg), radians(yawDeg));
|
||||
_compass->setHIL(1, radians(rollDeg), radians(pitchDeg), radians(yawDeg));
|
||||
Vector3f noise = _rand_vec3f() * _sitl->mag_noise;
|
||||
Vector3f motor = _sitl->mag_mot.get() * _current;
|
||||
Vector3f new_mag_data = _compass->getHIL() + noise + motor;
|
||||
Vector3f new_mag_data = _compass->getHIL(0) + noise + motor;
|
||||
|
||||
uint32_t now = hal.scheduler->millis();
|
||||
// add delay
|
||||
@ -77,7 +78,8 @@ void SITL_State::_update_compass(float rollDeg, float pitchDeg, float yawDeg)
|
||||
|
||||
new_mag_data -= _sitl->mag_ofs.get();
|
||||
|
||||
_compass->setHIL(new_mag_data);
|
||||
_compass->setHIL(0, new_mag_data);
|
||||
_compass->setHIL(1, new_mag_data);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user