mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-17 20:13:33 +08:00
Add GPS spoofing state
This commit is contained in:
@@ -182,6 +182,8 @@ private:
|
||||
|
||||
sensor_gps_s _report_gps_pos{}; ///< uORB topic for gps position
|
||||
satellite_info_s *_p_report_sat_info{nullptr}; ///< pointer to uORB topic for satellite info
|
||||
uint8_t _spoofing_state{0}; ///< spoofing state
|
||||
uint8_t _jamming_state{0}; ///< jamming state
|
||||
|
||||
uORB::PublicationMulti<sensor_gps_s> _report_gps_pos_pub{ORB_ID(sensor_gps)}; ///< uORB pub for gps position
|
||||
uORB::PublicationMulti<sensor_gnss_relative_s> _sensor_gnss_relative_pub{ORB_ID(sensor_gnss_relative)};
|
||||
@@ -1194,6 +1196,25 @@ GPS::publish()
|
||||
// The uORB message definition requires this data to be set to a NAN if no new valid data is available.
|
||||
_report_gps_pos.heading = NAN;
|
||||
_is_gps_main_advertised.store(true);
|
||||
|
||||
if (_report_gps_pos.spoofing_state != _spoofing_state) {
|
||||
|
||||
if (_report_gps_pos.spoofing_state > sensor_gps_s::SPOOFING_STATE_NONE) {
|
||||
PX4_WARN("GPS spoofing detected! (state: %d)", _report_gps_pos.spoofing_state);
|
||||
}
|
||||
|
||||
_spoofing_state = _report_gps_pos.spoofing_state;
|
||||
}
|
||||
|
||||
if (_report_gps_pos.jamming_state != _jamming_state) {
|
||||
|
||||
if (_report_gps_pos.jamming_state > sensor_gps_s::JAMMING_STATE_OK) {
|
||||
PX4_WARN("GPS jamming detected! (state: %d) (indicator: %d)", _report_gps_pos.jamming_state,
|
||||
(uint8_t)_report_gps_pos.jamming_indicator);
|
||||
}
|
||||
|
||||
_jamming_state = _report_gps_pos.jamming_state;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user