robotics_signals/sensors/nav_sat_fix.rs
1use cdds_derive::*;
2use cyclonedds_rs::*;
3use serde_derive::{Deserialize, Serialize};
4
5use crate::standard::Header;
6
7/// Navigation Satellite fix for any Global Navigation Satellite System
8///
9/// Specified using the WGS 84 reference ellipsoid
10///
11#[repr(C)]
12#[derive(Serialize, Deserialize, Topic)]
13pub struct NavSatFix {
14 /// header.stamp specifies the local time for this measurement (the
15 /// corresponding satellite time may be reported using the
16 /// TimeReference message).
17 ///
18 pub header: Header,
19
20 pub status: NavSatStatus,
21
22 /// Latitude [degrees]. Positive is north of equator
23 pub latitude: f64,
24
25 /// Longiture [degrees]. Positive is east of the prime meridian.
26 pub longitude: f64,
27
28 /// altitude [m]. NaN if altitude is not available.
29 pub altitude: f64,
30
31 /// Position covariance [m^2] defined relative to a tangential plane
32 /// through the reported position. The components are East, North, and
33 /// Up (ENU), in row-major order.
34 ///
35 /// Beware: this coordinate system exhibits singularities at the poles.
36 ///
37 pub position_covariance: [f64; 9],
38
39 /// If the covariance of the fix is known, fill it in completely. If the
40 /// GPS receiver provides the variance of each measurement, put them
41 /// along the diagonal. If only Dilution of Precision is available,
42 /// estimate an approximate covariance from that.
43 pub covariance_type: CovarianceType,
44}
45
46///
47#[repr(C)]
48#[derive(Serialize, Deserialize)]
49pub struct NavSatStatus {
50 pub status: NavSatFixType,
51 /// Which Global Navigation Satellite System signals were
52 /// used by the receiver.
53 pub service: Vec<NavService>,
54}
55
56#[repr(C)]
57#[derive(Serialize, Deserialize)]
58pub enum NavSatFixType {
59 /// No fix
60 NoFix = -1,
61 /// unaugmented fix
62 Fix = 0,
63 /// with satellite based augmentation
64 SbasFix = 1,
65 /// with ground based augmentation
66 GbasFix = 2,
67}
68
69#[repr(C)]
70#[derive(Serialize, Deserialize)]
71pub enum NavService {
72 Gps,
73 Glonass,
74 Compass,
75 Galileo,
76 Irnss,
77}
78
79#[repr(C)]
80#[derive(Serialize, Deserialize)]
81pub enum CovarianceType {
82 Unknown,
83 Approximated,
84 DiagonalKnown,
85 Known,
86}