diff --git a/libraries/AP_HAL_AVR_SITL/sitl_compass.cpp b/libraries/AP_HAL_AVR_SITL/sitl_compass.cpp index 3adaecb284..bfa7c7d9fa 100644 --- a/libraries/AP_HAL_AVR_SITL/sitl_compass.cpp +++ b/libraries/AP_HAL_AVR_SITL/sitl_compass.cpp @@ -40,9 +40,7 @@ void SITL_State::_update_compass(float rollDeg, float pitchDeg, float yawDeg) } _compass->setHIL(radians(rollDeg), radians(pitchDeg), radians(yawDeg)); Vector3f noise = _rand_vec3f() * _sitl->mag_noise; - _compass->mag_x += noise.x; - _compass->mag_y += noise.y; - _compass->mag_z += noise.z; + _compass->set_field(_compass->get_field() + noise); } #endif