1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
#[cfg(feature = "serde")]
use super::SerializeUbxPacketFields;
#[cfg(feature = "serde")]
use crate::serde::ser::SerializeMap;
use crate::{error::ParserError, UbxPacketMeta};
use ublox_derive::{ubx_extend, ubx_packet_recv};
/// Protection Level Information
///
/// This message provides protection level (PL) values per protection level state
/// (e.g. position ECEF X/Y/Z) and w.r.t. the given target misleading information
/// risk (TMIR) per coordinate axis.
///
/// Target misleading information risk is expressed as X [%MI/epoch] (read: X%
/// probability of having an MI per epoch). Misleading information (MI) occurs
/// when the Protection Level value is smaller than the true position error.
#[ubx_packet_recv]
#[ubx(class = 0x01, id = 0x62, fixed_payload_len = 52)]
struct NavPl {
/// Message version (0x01 for this version)
version: u8,
/// Target misleading information risk (TMIR) [%MI/epoch], coefficient
/// integer number of base 10 scientific notation.
/// TMIR = tmirCoeff * 10^tmirExp
tmir_coeff: u8,
/// Target misleading information risk (TMIR) [%MI/epoch], exponent
/// integer number of base 10 scientific notation.
/// TMIR = tmirCoeff * 10^tmirExp
tmir_exp: i8,
/// Position protection level validity
/// 0: Invalid (Protection level should not be used)
/// 1: Protection level is valid
#[ubx(map_type = PlPosValid)]
pl_pos_valid: u8,
/// Position protection level frame
#[ubx(map_type = PlPosFrame)]
pl_pos_frame: u8,
/// Velocity protection level validity
/// 0: Invalid (Protection level should not be used)
/// 1: Protection level is valid
#[ubx(map_type = PlVelValid)]
pl_vel_valid: u8,
/// Velocity protection level frame
#[ubx(map_type = PlVelFrame)]
pl_vel_frame: u8,
/// Time protection level validity
/// 0: Invalid (Protection level should not be used)
/// 1: Protection level is valid
#[ubx(map_type = PlTimeValid)]
pl_time_valid: u8,
/// Position protection level invalidity reason
#[ubx(map_type = PlInvalidityReason)]
pl_pos_invalidity_reason: u8,
/// Velocity protection level invalidity reason
#[ubx(map_type = PlInvalidityReason)]
pl_vel_invalidity_reason: u8,
/// Time protection level invalidity reason
#[ubx(map_type = PlInvalidityReason)]
pl_time_invalidity_reason: u8,
/// Reserved
reserved0: u8,
/// GPS time of week (ms)
itow: u32,
/// First axis of position protection level value (m),
/// given in coordinate frame of plPosFrame
#[ubx(map_type = f64, scale = 0.001)]
pl_pos1: u32,
/// Second axis of position protection level value (m),
/// given in coordinate frame of plPosFrame
#[ubx(map_type = f64, scale = 0.001)]
pl_pos2: u32,
/// Third axis of position protection level value (m),
/// given in coordinate frame of plPosFrame
#[ubx(map_type = f64, scale = 0.001)]
pl_pos3: u32,
/// First axis of velocity protection level value (m/s),
/// given in coordinate frame of plVelFrame
#[ubx(map_type = f64, scale = 0.001)]
pl_vel1: u32,
/// Second axis of velocity protection level value (m/s),
/// given in coordinate frame of plVelFrame
#[ubx(map_type = f64, scale = 0.001)]
pl_vel2: u32,
/// Third axis of velocity protection level value (m/s),
/// given in coordinate frame of plVelFrame
#[ubx(map_type = f64, scale = 0.001)]
pl_vel3: u32,
/// Orientation of HorizSemiMajorAxis of horizontal ellipse position
/// protection level (clockwise degrees from true North),
/// if plPosFrame==3; zero otherwise.
/// Scale: 1e-2 degrees
#[ubx(map_type = f64, scale = 0.01)]
pl_pos_horiz_orient: u16,
/// Orientation of HorizSemiMajorAxis of horizontal ellipse velocity
/// protection level (clockwise degrees from true North),
/// if plVelFrame==3; zero otherwise.
/// Scale: 1e-2 degrees
#[ubx(map_type = f64, scale = 0.01)]
pl_vel_horiz_orient: u16,
/// Time protection level value (ns), w.r.t. the given target
/// misleading information risk (TMIR) of [tmirCoeff * 10^(tmirExp)]
pl_time: u32,
/// Reserved
reserved1: [u8; 4],
}
/// Position protection level validity
#[ubx_extend]
#[ubx(from, rest_reserved)]
#[repr(u8)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum PlPosValid {
/// Invalid - Protection level should not be used
Invalid = 0,
/// Protection level is valid
Valid = 1,
}
/// Velocity protection level validity
#[ubx_extend]
#[ubx(from, rest_reserved)]
#[repr(u8)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum PlVelValid {
/// Invalid - Protection level should not be used
Invalid = 0,
/// Protection level is valid
Valid = 1,
}
/// Time protection level validity
#[ubx_extend]
#[ubx(from, rest_reserved)]
#[repr(u8)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum PlTimeValid {
/// Invalid - Protection level should not be used
Invalid = 0,
/// Protection level is valid
Valid = 1,
}
/// Position protection level reference frame
#[ubx_extend]
#[ubx(from, rest_reserved)]
#[repr(u8)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum PlPosFrame {
/// Invalid (not possible to calculate frame conversion)
Invalid = 0,
/// North-East-Down
Ned = 1,
/// Longitudinal-Lateral-Vertical
LongLatVert = 2,
/// HorizSemiMajorAxis-HorizSemiMinorAxis-Vertical
HorizSemiMajorMinorVert = 3,
}
/// Velocity protection level reference frame
#[ubx_extend]
#[ubx(from, rest_reserved)]
#[repr(u8)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum PlVelFrame {
/// Invalid (not possible to calculate frame conversion)
Invalid = 0,
/// North-East-Down
Ned = 1,
/// Longitudinal-Lateral-Vertical
LongLatVert = 2,
/// HorizSemiMajorAxis-HorizSemiMinorAxis-Vertical
HorizSemiMajorMinorVert = 3,
}
/// Protection level invalidity reason
#[ubx_extend]
#[ubx(from, rest_reserved)]
#[repr(u8)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum PlInvalidityReason {
/// Not available
NotAvailable = 0,
/// Solution not trustworthy (values 1-29 map to this)
SolutionNotTrustworthy = 1,
/// PL not verified for this receiver configuration (values 30-100)
NotVerifiedForConfig = 30,
}