mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-03 16:28:53 +08:00
simulator: fix noise in airspeed
It turns out the noise of the airspeed depends on the least significant bit of time which is now always 0 because time is quite regular with lockstep. Therefore, we need a better source for the randomness. I chose to use the sign of the y-gyro and it seems to work.
This commit is contained in:
@@ -253,7 +253,9 @@ void Simulator::update_sensors(mavlink_hil_sensor_t *imu)
|
||||
|
||||
RawAirspeedData airspeed = {};
|
||||
airspeed.temperature = imu->temperature;
|
||||
airspeed.diff_pressure = imu->diff_pressure + 0.001f * (hrt_absolute_time() & 0x01);
|
||||
// FIXME: diff_pressure needs some noise to pass preflight checks, so we just take the
|
||||
// noise from the gyro.
|
||||
airspeed.diff_pressure = imu->diff_pressure + ((imu->ygyro > 0) ? 0.001f : 0.0f);
|
||||
|
||||
write_airspeed_data(&airspeed);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user