mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-24 16:03:34 +08:00
format
This commit is contained in:
@@ -174,6 +174,7 @@ void SensorAirspeedSim::check_failure_injection()
|
|||||||
const int failure_type = static_cast<int>(vehicle_command.param2 + 0.5f);
|
const int failure_type = static_cast<int>(vehicle_command.param2 + 0.5f);
|
||||||
|
|
||||||
if (failure_unit == vehicle_command_s::FAILURE_UNIT_SENSOR_AIRSPEED) {
|
if (failure_unit == vehicle_command_s::FAILURE_UNIT_SENSOR_AIRSPEED) {
|
||||||
|
|
||||||
handled = true;
|
handled = true;
|
||||||
|
|
||||||
if (failure_type == vehicle_command_s::FAILURE_TYPE_OFF) {
|
if (failure_type == vehicle_command_s::FAILURE_TYPE_OFF) {
|
||||||
|
|||||||
@@ -149,7 +149,8 @@ void SensorBaroSim::Run()
|
|||||||
} else {
|
} else {
|
||||||
// no need to repeat the calculation - use the second value from last update
|
// no need to repeat the calculation - use the second value from last update
|
||||||
y1 = _baro_rnd_y2;
|
y1 = _baro_rnd_y2;
|
||||||
_baro_rnd_use_last = false; }
|
_baro_rnd_use_last = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply noise and drift
|
// Apply noise and drift
|
||||||
|
|||||||
@@ -121,8 +121,10 @@ void SensorGpsSim::Run()
|
|||||||
_vehicle_global_position_sub.copy(&gpos);
|
_vehicle_global_position_sub.copy(&gpos);
|
||||||
|
|
||||||
float _noise_scale = _sih_noise_scale.get();
|
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 latitude = gpos.lat + (double) _noise_scale * math::degrees((double)generate_wgn() * 0.2 /
|
||||||
double longitude = gpos.lon + (double) _noise_scale * math::degrees((double)generate_wgn() * 0.2 / CONSTANTS_RADIUS_OF_EARTH);
|
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));
|
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);
|
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_e_m_s = gps_vel(1);
|
||||||
sensor_gps.vel_d_m_s = gps_vel(2);
|
sensor_gps.vel_d_m_s = gps_vel(2);
|
||||||
sensor_gps.cog_rad = atan2(gps_vel(1),
|
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.timestamp_time_relative = 0;
|
||||||
sensor_gps.heading = NAN;
|
sensor_gps.heading = NAN;
|
||||||
sensor_gps.heading_offset = NAN;
|
sensor_gps.heading_offset = NAN;
|
||||||
|
|||||||
Reference in New Issue
Block a user