-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add compensated IMU message [AP-1475] (#1446)
# Description Adding a new MSG_IMU_COMP according to the corresponding design doc. <img width="938" alt="Screenshot 2024-10-01 at 8 57 33 PM" src="https://github.com/user-attachments/assets/796be85d-99e9-46df-a9c3-420895d042c7"> # API compatibility No, this is a new message ## API compatibility plan n/a # JIRA Reference https://swift-nav.atlassian.net/browse/AP-1475 --------- Co-authored-by: Ivan Smolyakov <[email protected]> Co-authored-by: Ivan Smolyakov <[email protected]> Co-authored-by: Ivan Smolyakov <[email protected]> Co-authored-by: Rodrigo Reichert <[email protected]>
- Loading branch information
1 parent
4ca4b5c
commit d775e3d
Showing
42 changed files
with
3,124 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,215 @@ | ||
/* | ||
* Copyright (C) 2015-2021 Swift Navigation Inc. | ||
* Contact: https://support.swiftnav.com | ||
* | ||
* This source is subject to the license found in the file 'LICENSE' which must | ||
* be distributed together with this source. All other rights reserved. | ||
* | ||
* THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, | ||
* EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED | ||
* WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. | ||
*/ | ||
|
||
/***************************************************************************** | ||
* Automatically generated from yaml/swiftnav/sbp/imu.yaml | ||
* with generate.py. Please do not hand edit! | ||
*****************************************************************************/ | ||
|
||
#ifndef LIBSBP_IMU_MSG_IMU_COMP_H | ||
#define LIBSBP_IMU_MSG_IMU_COMP_H | ||
|
||
#include <math.h> | ||
#include <stdarg.h> | ||
#include <stdbool.h> | ||
#include <stddef.h> | ||
#include <stdint.h> | ||
#include <string.h> | ||
|
||
#include <libsbp/common.h> | ||
#include <libsbp/imu_macros.h> | ||
#include <libsbp/string/sbp_string.h> | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/****************************************************************************** | ||
* | ||
* SBP_MSG_IMU_COMP | ||
* | ||
*****************************************************************************/ | ||
/** Compensated IMU data | ||
* | ||
* Data from the Inertial Measurement Unit, containing accelerometer and | ||
* gyroscope readings compensated for estimated errors and constant physical | ||
* effects. The output is valid for inertially referenced center of navigation | ||
* (IMU body frame) represented in vehicle body frame. | ||
*/ | ||
typedef struct { | ||
/** | ||
* Microseconds since reference epoch [microseconds] | ||
*/ | ||
u64 time; | ||
|
||
/** | ||
* Contains the applied compensation parameters and time synchronization mode | ||
*/ | ||
u16 flags; | ||
|
||
/** | ||
* Compensated acceleration X axis [1e-6 m/s^2] | ||
*/ | ||
s32 acc_comp_x; | ||
|
||
/** | ||
* Compensated acceleration Y axis [1e-6 m/s^2] | ||
*/ | ||
s32 acc_comp_y; | ||
|
||
/** | ||
* Compensated acceleration Z axis [1e-6 m/s^2] | ||
*/ | ||
s32 acc_comp_z; | ||
|
||
/** | ||
* Compensated angular rate X axis [1e-6 deg/s] | ||
*/ | ||
s32 gyr_comp_x; | ||
|
||
/** | ||
* Compensated angular rate Y axis [1e-6 deg/s] | ||
*/ | ||
s32 gyr_comp_y; | ||
|
||
/** | ||
* Compensated angular rate Z axis [1e-6 deg/s] | ||
*/ | ||
s32 gyr_comp_z; | ||
} sbp_msg_imu_comp_t; | ||
|
||
/** | ||
* Get encoded size of an instance of sbp_msg_imu_comp_t | ||
* | ||
* @param msg sbp_msg_imu_comp_t instance | ||
* @return Length of on-wire representation | ||
*/ | ||
static inline size_t sbp_msg_imu_comp_encoded_len( | ||
const sbp_msg_imu_comp_t *msg) { | ||
(void)msg; | ||
return SBP_MSG_IMU_COMP_ENCODED_LEN; | ||
} | ||
|
||
/** | ||
* Encode an instance of sbp_msg_imu_comp_t to wire representation | ||
* | ||
* This function encodes the given instance in to the user provided buffer. The | ||
* buffer provided to this function must be large enough to store the encoded | ||
* message otherwise it will return SBP_ENCODE_ERROR without writing anything to | ||
* the buffer. | ||
* | ||
* Specify the length of the destination buffer in the \p len parameter. If | ||
* non-null the number of bytes written to the buffer will be returned in \p | ||
* n_written. | ||
* | ||
* @param buf Destination buffer | ||
* @param len Length of \p buf | ||
* @param n_written If not null, on success will be set to the number of bytes | ||
* written to \p buf | ||
* @param msg Instance of sbp_msg_imu_comp_t to encode | ||
* @return SBP_OK on success, or other libsbp error code | ||
*/ | ||
SBP_EXPORT s8 sbp_msg_imu_comp_encode(uint8_t *buf, uint8_t len, | ||
uint8_t *n_written, | ||
const sbp_msg_imu_comp_t *msg); | ||
|
||
/** | ||
* Decode an instance of sbp_msg_imu_comp_t from wire representation | ||
* | ||
* This function decodes the wire representation of a sbp_msg_imu_comp_t message | ||
* to the given instance. The caller must specify the length of the buffer in | ||
* the \p len parameter. If non-null the number of bytes read from the buffer | ||
* will be returned in \p n_read. | ||
* | ||
* @param buf Wire representation of the sbp_msg_imu_comp_t instance | ||
* @param len Length of \p buf | ||
* @param n_read If not null, on success will be set to the number of bytes read | ||
* from \p buf | ||
* @param msg Destination | ||
* @return SBP_OK on success, or other libsbp error code | ||
*/ | ||
SBP_EXPORT s8 sbp_msg_imu_comp_decode(const uint8_t *buf, uint8_t len, | ||
uint8_t *n_read, sbp_msg_imu_comp_t *msg); | ||
/** | ||
* Send an instance of sbp_msg_imu_comp_t with the given write function | ||
* | ||
* An equivalent of #sbp_message_send which operates specifically on | ||
* sbp_msg_imu_comp_t | ||
* | ||
* The given message will be encoded to wire representation and passed in to the | ||
* given write function callback. The write callback will be called several | ||
* times for each invocation of this function. | ||
* | ||
* @param s SBP state | ||
* @param sender_id SBP sender id | ||
* @param msg Message to send | ||
* @param write Write function | ||
* @return SBP_OK on success, or other libsbp error code | ||
*/ | ||
SBP_EXPORT s8 sbp_msg_imu_comp_send(sbp_state_t *s, u16 sender_id, | ||
const sbp_msg_imu_comp_t *msg, | ||
sbp_write_fn_t write); | ||
|
||
/** | ||
* Compare two instances of sbp_msg_imu_comp_t | ||
* | ||
* The two instances will be compared and a value returned consistent with the | ||
* return codes of comparison functions from the C standard library | ||
* | ||
* 0 will be returned if \p a and \p b are considered equal | ||
* A value less than 0 will be returned if \p a is considered to be less than \p | ||
* b A value greater than 0 will be returned if \p b is considered to be greater | ||
* than \p b | ||
* | ||
* @param a sbp_msg_imu_comp_t instance | ||
* @param b sbp_msg_imu_comp_t instance | ||
* @return 0, <0, >0 | ||
*/ | ||
SBP_EXPORT int sbp_msg_imu_comp_cmp(const sbp_msg_imu_comp_t *a, | ||
const sbp_msg_imu_comp_t *b); | ||
|
||
#ifdef __cplusplus | ||
} | ||
|
||
static inline bool operator==(const sbp_msg_imu_comp_t &lhs, | ||
const sbp_msg_imu_comp_t &rhs) { | ||
return sbp_msg_imu_comp_cmp(&lhs, &rhs) == 0; | ||
} | ||
|
||
static inline bool operator!=(const sbp_msg_imu_comp_t &lhs, | ||
const sbp_msg_imu_comp_t &rhs) { | ||
return sbp_msg_imu_comp_cmp(&lhs, &rhs) != 0; | ||
} | ||
|
||
static inline bool operator<(const sbp_msg_imu_comp_t &lhs, | ||
const sbp_msg_imu_comp_t &rhs) { | ||
return sbp_msg_imu_comp_cmp(&lhs, &rhs) < 0; | ||
} | ||
|
||
static inline bool operator<=(const sbp_msg_imu_comp_t &lhs, | ||
const sbp_msg_imu_comp_t &rhs) { | ||
return sbp_msg_imu_comp_cmp(&lhs, &rhs) <= 0; | ||
} | ||
|
||
static inline bool operator>(const sbp_msg_imu_comp_t &lhs, | ||
const sbp_msg_imu_comp_t &rhs) { | ||
return sbp_msg_imu_comp_cmp(&lhs, &rhs) > 0; | ||
} | ||
|
||
static inline bool operator>=(const sbp_msg_imu_comp_t &lhs, | ||
const sbp_msg_imu_comp_t &rhs) { | ||
return sbp_msg_imu_comp_cmp(&lhs, &rhs) >= 0; | ||
} | ||
|
||
#endif // ifdef __cplusplus | ||
|
||
#endif /* LIBSBP_IMU_MSG_IMU_COMP_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.