mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-18 15:43:34 +08:00
Add GPS spoofing state
This commit is contained in:
@@ -670,6 +670,29 @@ void EstimatorChecks::checkGps(const Context &context, Report &reporter, const s
|
||||
mavlink_log_critical(reporter.mavlink_log_pub(), "GPS reports critical jamming state\t");
|
||||
}
|
||||
}
|
||||
|
||||
if (vehicle_gps_position.spoofing_state == sensor_gps_s::SPOOFING_STATE_INDICATED) {
|
||||
/* EVENT
|
||||
*/
|
||||
reporter.armingCheckFailure(NavModes::None, health_component_t::gps,
|
||||
events::ID("check_estimator_gps_spoofing_indicated"),
|
||||
events::Log::Critical, "GPS reports spoofing indicated");
|
||||
|
||||
if (reporter.mavlink_log_pub()) {
|
||||
mavlink_log_critical(reporter.mavlink_log_pub(), "GPS reports spoofing indicated\t");
|
||||
}
|
||||
|
||||
} else if (vehicle_gps_position.spoofing_state == sensor_gps_s::SPOOFING_STATE_MULTIPLE) {
|
||||
/* EVENT
|
||||
*/
|
||||
reporter.armingCheckFailure(NavModes::None, health_component_t::gps,
|
||||
events::ID("check_estimator_gps_multiple_spoofing_indicated"),
|
||||
events::Log::Critical, "GPS reports multiple spoofing indicated");
|
||||
|
||||
if (reporter.mavlink_log_pub()) {
|
||||
mavlink_log_critical(reporter.mavlink_log_pub(), "GPS reports multiple spoofing indicated\t");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EstimatorChecks::lowPositionAccuracy(const Context &context, Report &reporter,
|
||||
|
||||
@@ -2449,6 +2449,7 @@ MavlinkReceiver::handle_message_hil_gps(mavlink_message_t *msg)
|
||||
gps.automatic_gain_control = 0;
|
||||
gps.jamming_indicator = 0;
|
||||
gps.jamming_state = 0;
|
||||
gps.spoofing_state = 0;
|
||||
|
||||
gps.vel_m_s = (float)(hil_gps.vel) / 100.0f; // cm/s -> m/s
|
||||
gps.vel_n_m_s = (float)(hil_gps.vn) / 100.0f; // cm/s -> m/s
|
||||
|
||||
@@ -171,6 +171,7 @@ void SensorGpsSim::Run()
|
||||
sensor_gps.heading_accuracy = 0;
|
||||
sensor_gps.automatic_gain_control = 0;
|
||||
sensor_gps.jamming_state = 0;
|
||||
sensor_gps.spoofing_state = 0;
|
||||
sensor_gps.vel_ned_valid = true;
|
||||
sensor_gps.satellites_used = _sim_gps_used.get();
|
||||
|
||||
|
||||
@@ -421,6 +421,7 @@ void SimulatorMavlink::handle_message_hil_gps(const mavlink_message_t *msg)
|
||||
gps.automatic_gain_control = 0;
|
||||
gps.jamming_indicator = 0;
|
||||
gps.jamming_state = 0;
|
||||
gps.spoofing_state = 0;
|
||||
|
||||
gps.vel_m_s = (float)(hil_gps.vel) / 100.0f; // cm/s -> m/s
|
||||
gps.vel_n_m_s = (float)(hil_gps.vn) / 100.0f; // cm/s -> m/s
|
||||
|
||||
Reference in New Issue
Block a user