mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-30 00:04:07 +08:00
format
This commit is contained in:
parent
b3c1d91408
commit
96d8a4f089
@ -174,6 +174,7 @@ void SensorAirspeedSim::check_failure_injection()
|
||||
const int failure_type = static_cast<int>(vehicle_command.param2 + 0.5f);
|
||||
|
||||
if (failure_unit == vehicle_command_s::FAILURE_UNIT_SENSOR_AIRSPEED) {
|
||||
|
||||
handled = true;
|
||||
|
||||
if (failure_type == vehicle_command_s::FAILURE_TYPE_OFF) {
|
||||
|
||||
@ -149,7 +149,8 @@ void SensorBaroSim::Run()
|
||||
} else {
|
||||
// no need to repeat the calculation - use the second value from last update
|
||||
y1 = _baro_rnd_y2;
|
||||
_baro_rnd_use_last = false; }
|
||||
_baro_rnd_use_last = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Apply noise and drift
|
||||
|
||||
@ -121,8 +121,10 @@ void SensorGpsSim::Run()
|
||||
_vehicle_global_position_sub.copy(&gpos);
|
||||
|
||||
float _noise_scale = _sih_noise_scale.get();
|
||||
double latitude = gpos.lat + (double) _noise_scale * math::degrees((double)generate_wgn() * 0.2 / CONSTANTS_RADIUS_OF_EARTH);
|
||||
double longitude = gpos.lon + (double) _noise_scale * math::degrees((double)generate_wgn() * 0.2 / CONSTANTS_RADIUS_OF_EARTH);
|
||||
double latitude = gpos.lat + (double) _noise_scale * math::degrees((double)generate_wgn() * 0.2 /
|
||||
CONSTANTS_RADIUS_OF_EARTH);
|
||||
double longitude = gpos.lon + (double) _noise_scale * math::degrees((double)generate_wgn() * 0.2 /
|
||||
CONSTANTS_RADIUS_OF_EARTH);
|
||||
double altitude = (double)(gpos.alt + (_noise_scale * generate_wgn() * 0.5f));
|
||||
|
||||
Vector3f gps_vel = Vector3f{lpos.vx, lpos.vy, lpos.vz} + 0.1f * noiseGauss3f(0.06f, 0.077f, 0.158f);
|
||||
@ -171,7 +173,7 @@ void SensorGpsSim::Run()
|
||||
sensor_gps.vel_e_m_s = gps_vel(1);
|
||||
sensor_gps.vel_d_m_s = gps_vel(2);
|
||||
sensor_gps.cog_rad = atan2(gps_vel(1),
|
||||
gps_vel(0)); // Course over ground (NOT heading, but direction of movement), -PI..PI, (radians)
|
||||
gps_vel(0)); // Course over ground (NOT heading, but direction of movement), -PI..PI, (radians)
|
||||
sensor_gps.timestamp_time_relative = 0;
|
||||
sensor_gps.heading = NAN;
|
||||
sensor_gps.heading_offset = NAN;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user