dronecan: gps add noise, jamming, and spoofing data

This commit is contained in:
alexklimaj
2023-10-31 10:25:29 -06:00
committed by Daniel Agar
parent 9da1622436
commit db60bbc46b
3 changed files with 34 additions and 7 deletions
@@ -127,6 +127,11 @@ public:
ecefpositionvelocity.velocity_xyz[1] = NAN;
ecefpositionvelocity.velocity_xyz[2] = NAN;
// Use ecef_position_velocity for now... There are no fields for these
ecefpositionvelocity.position_xyz_mm[0] = gps.noise_per_ms;
ecefpositionvelocity.position_xyz_mm[1] = gps.jamming_indicator;
ecefpositionvelocity.position_xyz_mm[2] = (gps.jamming_state << 8) | gps.spoofing_state;
// Use ecef_position_velocity for now... There is no heading field
if (!std::isnan(gps.heading)) {
ecefpositionvelocity.velocity_xyz[0] = gps.heading;
@@ -138,10 +143,10 @@ public:
if (!std::isnan(gps.heading_accuracy)) {
ecefpositionvelocity.velocity_xyz[2] = gps.heading_accuracy;
}
fix2.ecef_position_velocity.push_back(ecefpositionvelocity);
}
fix2.ecef_position_velocity.push_back(ecefpositionvelocity);
uavcan::Publisher<uavcan::equipment::gnss::Fix2>::broadcast(fix2);
// ensure callback is registered