control.h
Go to the documentation of this file.
1 /**************************************************************************/ /**
2  * @brief Device operation control messages.
3  * @file
4  ******************************************************************************/
5 
6 #pragma once
7 
10 
11 namespace point_one {
12 namespace fusion_engine {
13 namespace messages {
14 
15 // Enforce 4-byte alignment and packing of all data structures and values.
16 // Floating point values are aligned on platforms that require it. This is done
17 // with a combination of setting struct attributes, and manual alignment
18 // within the definitions. See the "Message Packing" section of the README.
19 #pragma pack(push, 1)
20 
21 /**
22  * @defgroup config_and_ctrl_messages Device Configuration, Control, And Status Messages
23  * @brief Messages for controlling device configuration and operation.
24  * @ingroup messages
25  *
26  * When a configuration/control message is received, a device typically responds
27  * with either a @ref CommandResponseMessage or another appropriate response.
28  * For example, a @ref MessageRequest requesting @ref MessageType::VERSION_INFO
29  * may result in a @ref VersionInfoMessage response, or a @ref
30  * CommandResponseMessage indicating that directly requesting version messages
31  * is not supported. See the documentation for the individual control messages
32  * for details on the expected response.
33  *
34  * See also @ref messages.
35  */
36 
37 /**************************************************************************/ /**
38  * @defgroup device_control Device Control Messages
39  * @brief Messages for high-level device control (reset, shutdown, etc.).
40  * @ingroup config_and_ctrl_messages
41  ******************************************************************************/
42 
43 /**
44  * @brief Response to indicate if command was processed successfully (@ref
45  * MessageType::COMMAND_RESPONSE, version 1.0).
46  * @ingroup device_control
47  */
49  static constexpr MessageType MESSAGE_TYPE = MessageType::COMMAND_RESPONSE;
50  static constexpr uint8_t MESSAGE_VERSION = 0;
51 
52  /** The sequence number of the command that triggered this response. */
53  uint32_t source_seq_number = 0;
54 
55  /** The response status (success, error, etc.). */
56  Response response = Response::OK;
57 
58  uint8_t reserved[3] = {0};
59 };
60 
61 /**
62  * @brief Request transmission of a specified message type, (@ref
63  * MessageType::MESSAGE_REQUEST, version 1.0).
64  * @ingroup device_control
65  *
66  * On success, the device will output the requested message type.
67  *
68  * Not all message types may be requested explicitly. If a message type cannot
69  * be requested on demand or is not supported, the device will respond with a
70  * @ref Response::UNSUPPORTED_FEATURE message.
71  *
72  * @note
73  * The generated response may not immediately follow the request if other
74  * outbound messages are already enqueued to be sent.
75  *
76  * # Expected Response
77  * The requested message type, or @ref CommandResponseMessage on error.
78  */
80  static constexpr MessageType MESSAGE_TYPE = MessageType::MESSAGE_REQUEST;
81  static constexpr uint8_t MESSAGE_VERSION = 0;
82 
83  /** The desired message type. */
85 
86  uint8_t reserved[2] = {0};
87 };
88 
89 /**
90  * @brief Perform a software or hardware reset (@ref MessageType::RESET_REQUEST,
91  * version 1.0).
92  * @ingroup device_control
93  *
94  * This message contains a bitmask indicating the set of components to be reset.
95  * Helper bitmasks are provided for common reset operations.
96  *
97  * # Expected Response
98  * The device will respond with a @ref CommandResponseMessage indicating whether
99  * or not the request succeeded.
100  */
102  static constexpr MessageType MESSAGE_TYPE = MessageType::RESET_REQUEST;
103  static constexpr uint8_t MESSAGE_VERSION = 0;
104 
105  /**
106  * @name Runtime State Reset
107  * @{
108  */
109  /** Restart the navigation engine, but do not clear its position estimate. */
110  static constexpr uint32_t RESTART_NAVIGATION_ENGINE = 0x00000001;
111  /** Delete all GNSS corrections information. */
112  static constexpr uint32_t RESET_GNSS_CORRECTIONS = 0x00000002;
113  /** Delete all GNSS time information. */
114  static constexpr uint32_t RESET_GNSS_TIME = 0x00000004;
115  /** @} */
116 
117  /**
118  * @name Clear Short Lived Data
119  * @{
120  */
121  /**
122  * Reset the navigation engine's estimate of position, velocity, and
123  * orientation.
124  */
125  static constexpr uint32_t RESET_POSITION_DATA = 0x00000100;
126  /** Delete all saved satellite ephemeris. */
127  static constexpr uint32_t RESET_EPHEMERIS = 0x00000200;
128  /**
129  * Reset bias estimates, and other IMU corrections that are typically
130  * estimated quickly.
131  */
132  static constexpr uint32_t RESET_FAST_IMU_CORRECTIONS = 0x00000400;
133  /** @} */
134 
135  /**
136  * @name Clear Long Lived Data
137  * @{
138  */
139  /**
140  * Reset all stored navigation engine data, including position, velocity, and
141  * orientation state (same as @ref RESET_POSITION_DATA), plus all IMU
142  * corrections and other training data.
143  */
144  static constexpr uint32_t RESET_NAVIGATION_ENGINE_DATA = 0x00001000;
145  /**
146  * Reset the device calibration data.
147  *
148  * @note
149  * This does _not_ reset any existing navigation engine state. It is
150  * recommended that you set @ref RESET_NAVIGATION_ENGINE_DATA as well under
151  * normal circumstances.
152  */
153  static constexpr uint32_t RESET_CALIBRATION_DATA = 0x00002000;
154  /** @} */
155 
156  /**
157  * @name Clear Configuration Data
158  * @{
159  */
160  /** Clear all configuration data. */
161  static constexpr uint32_t RESET_CONFIG = 0x00100000;
162  /** @} */
163 
164  /**
165  * @name Software Reboot And Special Reset Modes
166  * @{
167  */
168  /**
169  * Reboot the GNSS measurement engine (GNSS receiver), in addition to
170  * performing any other requested resets (e.g., @ref RESET_EPHEMERIS). If no
171  * other resets are specified, the GNSS receiver will reboot and should
172  * perform a hot start.
173  */
174  static constexpr uint32_t REBOOT_GNSS_MEASUREMENT_ENGINE = 0x01000000;
175  /** Reboot the navigation processor. */
176  static constexpr uint32_t REBOOT_NAVIGATION_PROCESSOR = 0x02000000;
177  /**
178  * Perform a diagnostic log reset to guarantee deterministic performance for
179  * data post-processing and diagnostic support.
180  *
181  * Diagnostic log resets are useful when capturing data to be sent to Point
182  * One for analysis and support. Performing a diagnostic reset guarantees that
183  * the performance of the device seen in real time can be reproduced during
184  * post-processing.
185  *
186  * This reset performs the following:
187  * - Restart the navigation engine (@ref RESTART_NAVIGATION_ENGINE)
188  * - Clear any stored data in RAM that was received since startup such as
189  * ephemeris or GNSS corrections
190  * - This is _not_ the same as @ref RESET_EPHEMERIS; this action does not
191  * reset ephemeris data stored in persistent storage
192  * - Flush internal data buffers on the device
193  *
194  * Note that this does _not_ reset the navigation engine's position data,
195  * GNSS times, training parameters, or calibration. If the navigation engine
196  * has existing position information, it will be used.
197  *
198  * This reset may be combined with other resets as needed to clear additional
199  * information.
200  */
201  static constexpr uint32_t DIAGNOSTIC_LOG_RESET = 0x04000000;
202  /** @} */
203 
204  /**
205  * @name Device Reset Bitmasks
206  * @{
207  */
208  /**
209  * Perform a device hot start.
210  *
211  * This will reset the navigation engine into a known state, using previously
212  * stored position and time information. The device will begin navigating
213  * immediately if possible.
214  *
215  * To be reset:
216  * - The navigation engine (@ref RESTART_NAVIGATION_ENGINE)
217  *
218  * Not reset/performed:
219  * - All runtime data (GNSS corrections (@ref RESET_GNSS_CORRECTIONS), etc.)
220  * - GNSS times (@ref RESET_GNSS_TIME)
221  * - Position, velocity, orientation (@ref RESET_POSITION_DATA)
222  * - GNSS ephemeris data (@ref RESET_EPHEMERIS)
223  * - Fast IMU corrections (@ref RESET_FAST_IMU_CORRECTIONS)
224  * - Training parameters (slowly estimated IMU corrections, temperature
225  * compensation, etc.; @ref RESET_NAVIGATION_ENGINE_DATA)
226  * - Calibration data (@ref RESET_CALIBRATION_DATA)
227  * - User configuration settings (@ref RESET_CONFIG)
228  * - Reboot GNSS measurement engine (@ref REBOOT_GNSS_MEASUREMENT_ENGINE)
229  * - Reboot navigation processor (@ref REBOOT_NAVIGATION_PROCESSOR)
230  */
231  static constexpr uint32_t HOT_START = 0x00000001;
232 
233  /**
234  * Perform a device warm start.
235  *
236  * During a warm start, the device retains its knowledge of approximate
237  * position and time, plus almanac data if available, but resets all ephemeris
238  * data. As a result, the device will need to download ephemeris data before
239  * continuing to navigate with GNSS.
240  *
241  * To be reset:
242  * - The navigation engine (i.e., perform a hot start, @ref
243  * RESTART_NAVIGATION_ENGINE)
244  * - GNSS ephemeris data (@ref RESET_EPHEMERIS)
245  *
246  * Not reset/performed:
247  * - All runtime data (GNSS corrections (@ref RESET_GNSS_CORRECTIONS), etc.)
248  * - GNSS times (@ref RESET_GNSS_TIME)
249  * - Position, velocity, orientation (@ref RESET_POSITION_DATA)
250  * - Fast IMU corrections (@ref RESET_FAST_IMU_CORRECTIONS)
251  * - Training parameters (slowly estimated IMU corrections, temperature
252  * compensation, etc.; @ref RESET_NAVIGATION_ENGINE_DATA)
253  * - Calibration data (@ref RESET_CALIBRATION_DATA)
254  * - User configuration settings (@ref RESET_CONFIG)
255  * - Reboot GNSS measurement engine (@ref REBOOT_GNSS_MEASUREMENT_ENGINE)
256  * - Reboot navigation processor (@ref REBOOT_NAVIGATION_PROCESSOR)
257  */
258  static constexpr uint32_t WARM_START = 0x00000201;
259 
260  /**
261  * Perform a pose reset: reset all position, velocity, and orientation
262  * information (i.e., the navigation engine's kinematic state).
263  *
264  * A pose reset is typically used to reset the kinematic portion of the
265  * navigation engine's state if you are experiencing errors on startup or
266  * after a @ref HOT_START.
267  *
268  * To be reset:
269  * - The navigation engine (@ref RESTART_NAVIGATION_ENGINE)
270  * - All runtime data (GNSS corrections (@ref RESET_GNSS_CORRECTIONS), etc.)
271  * - Position, velocity, orientation (@ref RESET_POSITION_DATA)
272  *
273  * Not reset/performed:
274  * - GNSS times (@ref RESET_GNSS_TIME)
275  * - GNSS ephemeris data (@ref RESET_EPHEMERIS)
276  * - Fast IMU corrections (@ref RESET_FAST_IMU_CORRECTIONS)
277  * - Training parameters (slowly estimated IMU corrections, temperature
278  * compensation, etc.; @ref RESET_NAVIGATION_ENGINE_DATA)
279  * - Calibration data (@ref RESET_CALIBRATION_DATA)
280  * - User configuration settings (@ref RESET_CONFIG)
281  * - Reboot GNSS measurement engine (@ref REBOOT_GNSS_MEASUREMENT_ENGINE)
282  * - Reboot navigation processor (@ref REBOOT_NAVIGATION_PROCESSOR)
283  */
284  static constexpr uint32_t POSE_RESET = 0x000001FB;
285 
286  /**
287  * Perform a device cold start.
288  *
289  * A cold start is typically used to reset the device's state estimate in the
290  * case of error that cannot be resolved by a @ref WARM_START.
291  *
292  * To be reset:
293  * - The navigation engine (@ref RESTART_NAVIGATION_ENGINE)
294  * - All runtime data (GNSS corrections (@ref RESET_GNSS_CORRECTIONS), etc.)
295  * - GNSS times (@ref RESET_GNSS_TIME)
296  * - Position, velocity, orientation (@ref RESET_POSITION_DATA)
297  * - GNSS ephemeris data (@ref RESET_EPHEMERIS)
298  * - Fast IMU corrections (@ref RESET_FAST_IMU_CORRECTIONS)
299  *
300  * Not reset/performed:
301  * - Training parameters (slowly estimated IMU corrections, temperature
302  * compensation, etc.; @ref RESET_NAVIGATION_ENGINE_DATA)
303  * - Calibration data (@ref RESET_CALIBRATION_DATA)
304  * - User configuration settings (@ref RESET_CONFIG)
305  * - Reboot GNSS measurement engine (@ref REBOOT_GNSS_MEASUREMENT_ENGINE)
306  * - Reboot navigation processor (@ref REBOOT_NAVIGATION_PROCESSOR)
307  *
308  * @note
309  * To reset training or calibration data as well, set the @ref
310  * RESET_NAVIGATION_ENGINE_DATA and @ref RESET_CALIBRATION_DATA bits.
311  */
312  static constexpr uint32_t COLD_START = 0x00000FFF;
313 
314  /**
315  * Restart mask to set all persistent data, including calibration and user
316  * configuration, back to factory defaults.
317  */
318  static constexpr uint32_t FACTORY_RESET = 0xFFFFFFFF;
319  /** @} */
320 
321  /** Bit mask of functionality to reset. */
322  uint32_t reset_mask = 0;
323 };
324 
325 /**
326  * @brief Perform a device shutdown (@ref
327  * MessageType::SHUTDOWN_REQUEST, version 1.0).
328  * @ingroup device_control
329  *
330  * # Expected Response
331  * The device will respond with a @ref CommandResponseMessage indicating whether
332  * or not the request succeeded.
333  */
335  static constexpr MessageType MESSAGE_TYPE = MessageType::SHUTDOWN_REQUEST;
336  static constexpr uint8_t MESSAGE_VERSION = 0;
337 
338  /**
339  * Stop navigation engine and flush state to non-volatile storage.
340  */
341  static constexpr uint64_t STOP_ENGINE = 0x0000000000000001;
342  /**
343  * If a log is being generated, end that log.
344  */
345  static constexpr uint64_t STOP_CURRENT_LOG = 0x0000000000000002;
346 
347  /**
348  * A bitmask of flags associated with the event.
349  *
350  * @note For backwards compatibility, a value of `0` is treated as if the
351  * @ref STOP_ENGINE bit is set (`0x0000000000000001`).
352  */
353  uint64_t shutdown_flags = 0;
354  uint8_t reserved1[8] = {0};
355 };
356 
357 /**
358  * @brief Start up a device (@ref
359  * MessageType::STARTUP_REQUEST, version 1.0).
360  * @ingroup device_control
361  *
362  * # Expected Response
363  * The device will respond with a @ref CommandResponseMessage indicating whether
364  * or not the request succeeded.
365  */
367  static constexpr MessageType MESSAGE_TYPE = MessageType::STARTUP_REQUEST;
368  static constexpr uint8_t MESSAGE_VERSION = 0;
369 
370  /**
371  * Start navigation engine if not running.
372  */
373  static constexpr uint64_t START_ENGINE = 0x0000000000000001;
374  /**
375  * If a log is not being generated, start a new log. If a log is active, end
376  * it, and immediately start a new log.
377  */
378  static constexpr uint64_t START_NEW_LOG = 0x0000000000000002;
379 
380  /**
381  * A bitmask of flags associated with the event.
382  *
383  * @note For backwards compatibility, a value of `0` is treated as if the
384  * @ref START_ENGINE bit is set (`0x0000000000000001`).
385  */
386  uint64_t startup_flags = 0;
387  uint8_t reserved1[8] = {0};
388 };
389 
390 #pragma pack(pop)
391 
392 } // namespace messages
393 } // namespace fusion_engine
394 } // namespace point_one
MessageType
Identifiers for the defined output message types.
Definition: defs.h:34
Library portability helper definitions.
@ OK
Request transmission of a specified message type, (MessageType::MESSAGE_REQUEST, version 1....
Definition: control.h:79
Start up a device (MessageType::STARTUP_REQUEST, version 1.0).
Definition: control.h:366
@ COMMAND_RESPONSE
CommandResponseMessage
#define P1_ALIGNAS(N)
Definition: portability.h:57
@ SHUTDOWN_REQUEST
ShutdownRequest
@ INVALID
Invalid message type.
The base class for all message payloads.
Definition: defs.h:687
@ RESET_REQUEST
ResetRequest
GNSS signal and frequency type definitions.
Definition: logging.h:38
Perform a software or hardware reset (MessageType::RESET_REQUEST, version 1.0).
Definition: control.h:101
Response
Command response status indicators.
Definition: defs.h:406
Response to indicate if command was processed successfully (MessageType::COMMAND_RESPONSE,...
Definition: control.h:48
Perform a device shutdown (MessageType::SHUTDOWN_REQUEST, version 1.0).
Definition: control.h:334
Point One FusionEngine output message common definitions.
@ STARTUP_REQUEST
StartupRequest
@ MESSAGE_REQUEST
MessageRequest