sbgECom Library  5.4.1684-stable
Interface SBG Systems IMU/AHRS/INS
Loading...
Searching...
No Matches
sbgEComLogEkf.h File Reference

Parse EKF measurements such as attitude, position and velocity logs. More...

Go to the source code of this file.

Data Structures

struct  _SbgEComLogEkfEuler
 
struct  _SbgEComLogEkfQuat
 
struct  _SbgEComLogEkfNav
 
struct  _SbgEComLogEkfVelBody
 
struct  _SbgEComLogEkfAirData
 

Macros

#define SBG_ECOM_SOL_ATTITUDE_VALID   (0x00000001u << 4)
 
#define SBG_ECOM_SOL_HEADING_VALID   (0x00000001u << 5)
 
#define SBG_ECOM_SOL_VELOCITY_VALID   (0x00000001u << 6)
 
#define SBG_ECOM_SOL_POSITION_VALID   (0x00000001u << 7)
 
#define SBG_ECOM_SOL_VERT_REF_USED   (0x00000001u << 8)
 
#define SBG_ECOM_SOL_MAG_REF_USED   (0x00000001u << 9)
 
#define SBG_ECOM_SOL_GPS1_VEL_USED   (0x00000001u << 10)
 
#define SBG_ECOM_SOL_GPS1_POS_USED   (0x00000001u << 11)
 
#define SBG_ECOM_SOL_VEL_CONSTRAINTS_USED   (0x00000001u << 12)
 
#define SBG_ECOM_SOL_GPS1_HDT_USED   (0x00000001u << 13)
 
#define SBG_ECOM_SOL_GPS2_VEL_USED   (0x00000001u << 14)
 
#define SBG_ECOM_SOL_GPS2_POS_USED   (0x00000001u << 15)
 
#define SBG_ECOM_SOL_GPS2_HDT_USED   (0x00000001u << 17)
 
#define SBG_ECOM_SOL_ODO_USED   (0x00000001u << 18)
 
#define SBG_ECOM_SOL_DVL_BT_USED   (0x00000001u << 19)
 
#define SBG_ECOM_SOL_DVL_WT_USED   (0x00000001u << 20)
 
#define SBG_ECOM_SOL_VEL1_USED   (0x00000001u << 21)
 
#define SBG_ECOM_SOL_RESERVED_01   (0x00000001u << 22)
 
#define SBG_ECOM_SOL_RESERVED_02   (0x00000001u << 23)
 
#define SBG_ECOM_SOL_USBL_USED   (0x00000001u << 24)
 
#define SBG_ECOM_SOL_AIRSPEED_USED   (0x00000001u << 25)
 
#define SBG_ECOM_SOL_ZUPT_USED   (0x00000001u << 26)
 
#define SBG_ECOM_SOL_ALIGN_VALID   (0x00000001u << 27)
 
#define SBG_ECOM_SOL_VERTICAL_AIDING_USED   (0x00000001u << 28)
 
#define SBG_ECOM_SOL_ZARU_USED   (0x00000001u << 29)
 
#define SBG_ECOM_SOL_POS1_USED   (0x00000001u << 30)
 

Typedefs

typedef enum _SbgEComSolutionMode SbgEComSolutionMode
 
typedef struct _SbgEComLogEkfEuler SbgEComLogEkfEuler
 
typedef struct _SbgEComLogEkfQuat SbgEComLogEkfQuat
 
typedef struct _SbgEComLogEkfNav SbgEComLogEkfNav
 
typedef struct _SbgEComLogEkfVelBody SbgEComLogEkfVelBody
 
typedef struct _SbgEComLogEkfAirData SbgEComLogEkfAirData
 

Enumerations

enum  _SbgEComSolutionMode {
  SBG_ECOM_SOL_MODE_UNINITIALIZED = 0 ,
  SBG_ECOM_SOL_MODE_VERTICAL_GYRO = 1 ,
  SBG_ECOM_SOL_MODE_AHRS = 2 ,
  SBG_ECOM_SOL_MODE_NAV_VELOCITY = 3 ,
  SBG_ECOM_SOL_MODE_NAV_POSITION = 4
}
 

Functions

float sbgEComLogEkfEulerGetMagneticHeading (const SbgEComLogEkfEuler *pEkfEuler)
 
SbgErrorCode sbgEComLogEkfEulerReadFromStream (SbgEComLogEkfEuler *pLogData, SbgStreamBuffer *pStreamBuffer)
 
SbgErrorCode sbgEComLogEkfEulerWriteToStream (const SbgEComLogEkfEuler *pLogData, SbgStreamBuffer *pStreamBuffer)
 
SbgErrorCode sbgEComLogEkfQuatReadFromStream (SbgEComLogEkfQuat *pLogData, SbgStreamBuffer *pStreamBuffer)
 
SbgErrorCode sbgEComLogEkfQuatWriteToStream (const SbgEComLogEkfQuat *pLogData, SbgStreamBuffer *pStreamBuffer)
 
SbgErrorCode sbgEComLogEkfNavReadFromStream (SbgEComLogEkfNav *pLogData, SbgStreamBuffer *pStreamBuffer)
 
SbgErrorCode sbgEComLogEkfNavWriteToStream (const SbgEComLogEkfNav *pLogData, SbgStreamBuffer *pStreamBuffer)
 
void sbgEComLogEkfVelBodyConstruct (SbgEComLogEkfVelBody *pLogData)
 
SbgErrorCode sbgEComLogEkfVelBodyReadFromStream (SbgEComLogEkfVelBody *pLogData, SbgStreamBuffer *pStreamBuffer)
 
SbgErrorCode sbgEComLogEkfVelBodyWriteToStream (const SbgEComLogEkfVelBody *pLogData, SbgStreamBuffer *pStreamBuffer)
 
void sbgEComLogEkfAirDataConstruct (SbgEComLogEkfAirData *pLogData)
 
SbgErrorCode sbgEComLogEkfAirDataReadFromStream (SbgEComLogEkfAirData *pLogData, SbgStreamBuffer *pStreamBuffer)
 
SbgErrorCode sbgEComLogEkfAirDataWriteToStream (const SbgEComLogEkfAirData *pLogData, SbgStreamBuffer *pStreamBuffer)
 
SbgEComSolutionMode sbgEComLogEkfGetSolutionMode (uint32_t status)
 
uint32_t sbgEComLogEkfBuildSolutionStatus (SbgEComSolutionMode solutionMode, uint32_t masks)
 

Detailed Description

Parse EKF measurements such as attitude, position and velocity logs.

Author
SBG Systems
Date
February 25, 2013
License

The MIT license

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Macro Definition Documentation

◆ SBG_ECOM_SOL_ATTITUDE_VALID

#define SBG_ECOM_SOL_ATTITUDE_VALID   (0x00000001u << 4)

Solution bit masks definitions. Set if attitude data is reliable (Roll/Pitch error within defined criteria).

◆ SBG_ECOM_SOL_HEADING_VALID

#define SBG_ECOM_SOL_HEADING_VALID   (0x00000001u << 5)

Set if heading data is reliable (Heading error within defined criteria).

◆ SBG_ECOM_SOL_VELOCITY_VALID

#define SBG_ECOM_SOL_VELOCITY_VALID   (0x00000001u << 6)

Set if velocity data is reliable (Velocity error within defined criteria).

◆ SBG_ECOM_SOL_POSITION_VALID

#define SBG_ECOM_SOL_POSITION_VALID   (0x00000001u << 7)

Set if position data is reliable (Position error within defined criteria).

◆ SBG_ECOM_SOL_VERT_REF_USED

#define SBG_ECOM_SOL_VERT_REF_USED   (0x00000001u << 8)

Set if the vertical reference is used in the solution.

◆ SBG_ECOM_SOL_MAG_REF_USED

#define SBG_ECOM_SOL_MAG_REF_USED   (0x00000001u << 9)

Set if magnetometer is used in the solution.

◆ SBG_ECOM_SOL_GPS1_VEL_USED

#define SBG_ECOM_SOL_GPS1_VEL_USED   (0x00000001u << 10)

Set if GNSS 1 velocity is used in the solution.

◆ SBG_ECOM_SOL_GPS1_POS_USED

#define SBG_ECOM_SOL_GPS1_POS_USED   (0x00000001u << 11)

Set if GNSS 1 position is used in the solution.

◆ SBG_ECOM_SOL_VEL_CONSTRAINTS_USED

#define SBG_ECOM_SOL_VEL_CONSTRAINTS_USED   (0x00000001u << 12)

Set if vehicle velocity constraint is used to improve accuracy.

◆ SBG_ECOM_SOL_GPS1_HDT_USED

#define SBG_ECOM_SOL_GPS1_HDT_USED   (0x00000001u << 13)

Set if GNSS 1 true heading is used in the solution.

◆ SBG_ECOM_SOL_GPS2_VEL_USED

#define SBG_ECOM_SOL_GPS2_VEL_USED   (0x00000001u << 14)

Set if GNSS 2 velocity is used in the solution.

◆ SBG_ECOM_SOL_GPS2_POS_USED

#define SBG_ECOM_SOL_GPS2_POS_USED   (0x00000001u << 15)

Set if GNSS 2 position is used in the solution.

◆ SBG_ECOM_SOL_GPS2_HDT_USED

#define SBG_ECOM_SOL_GPS2_HDT_USED   (0x00000001u << 17)

Set if GNSS 2 true heading is used in the solution.

◆ SBG_ECOM_SOL_ODO_USED

#define SBG_ECOM_SOL_ODO_USED   (0x00000001u << 18)

Set if odometer velocity is used in the solution.

◆ SBG_ECOM_SOL_DVL_BT_USED

#define SBG_ECOM_SOL_DVL_BT_USED   (0x00000001u << 19)

Set if DVL bottom tracking velocity is used in the solution.

◆ SBG_ECOM_SOL_DVL_WT_USED

#define SBG_ECOM_SOL_DVL_WT_USED   (0x00000001u << 20)

Set if DVL water layer velocity is used in the solution.

◆ SBG_ECOM_SOL_VEL1_USED

#define SBG_ECOM_SOL_VEL1_USED   (0x00000001u << 21)

Set if generic velocity 1 is used in the solution.

◆ SBG_ECOM_SOL_RESERVED_01

#define SBG_ECOM_SOL_RESERVED_01   (0x00000001u << 22)

Reserved for future use.

◆ SBG_ECOM_SOL_RESERVED_02

#define SBG_ECOM_SOL_RESERVED_02   (0x00000001u << 23)

Reserved for future use.

◆ SBG_ECOM_SOL_USBL_USED

#define SBG_ECOM_SOL_USBL_USED   (0x00000001u << 24)

Set if USBL position is used in the solution.

◆ SBG_ECOM_SOL_AIRSPEED_USED

#define SBG_ECOM_SOL_AIRSPEED_USED   (0x00000001u << 25)

Set if true airspeed is used in the solution.

◆ SBG_ECOM_SOL_ZUPT_USED

#define SBG_ECOM_SOL_ZUPT_USED   (0x00000001u << 26)

Set if a Zero Velocity Update (ZUPT) is is used in the solution.

◆ SBG_ECOM_SOL_ALIGN_VALID

#define SBG_ECOM_SOL_ALIGN_VALID   (0x00000001u << 27)

Set if sensor alignment and residual sensors errors have fully converged.

◆ SBG_ECOM_SOL_VERTICAL_AIDING_USED

#define SBG_ECOM_SOL_VERTICAL_AIDING_USED   (0x00000001u << 28)

Set if a vertical aiding source (depth or barometric altimeter) is used in the solution.

◆ SBG_ECOM_SOL_ZARU_USED

#define SBG_ECOM_SOL_ZARU_USED   (0x00000001u << 29)

Set if a Zero Angular Rate Update (ZARU) is used in the solution.

◆ SBG_ECOM_SOL_POS1_USED

#define SBG_ECOM_SOL_POS1_USED   (0x00000001u << 30)

Set if generic position 1 is used in the solution.

Typedef Documentation

◆ SbgEComSolutionMode

Solution filter mode enum.

◆ SbgEComLogEkfEuler

EKF computed orientation using euler angles.

Note: In AHRS (Attitude and Heading Reference System) or INS (Inertial Navigation System) modes, the yaw angle represents the geographic (true) heading of the device.

To convert a geographic heading to a magnetic heading, use the following formula: Magnetic Heading = Geographic Heading - Magnetic Declination

◆ SbgEComLogEkfQuat

EKF computed orientation using quaternion.

Note: In AHRS (Attitude and Heading Reference System) or INS (Inertial Navigation System) modes, the yaw angle represents the geographic (true) heading of the device.

To convert a geographic heading to a magnetic heading, use the following formula: Magnetic Heading = Geographic Heading - Magnetic Declination

◆ SbgEComLogEkfNav

EKF computed navigation data.

◆ SbgEComLogEkfVelBody

INS body velocity computed by the EKF filter.

◆ SbgEComLogEkfAirData

INS air data computed by the EKF filter.

Enumeration Type Documentation

◆ _SbgEComSolutionMode

Solution filter mode enum.

Enumerator
SBG_ECOM_SOL_MODE_UNINITIALIZED 

The Kalman filter is not initialized and the returned data are all invalid.

SBG_ECOM_SOL_MODE_VERTICAL_GYRO 

The Kalman filter only rely on a vertical reference to compute roll and pitch angles. Heading and navigation data drift freely.

SBG_ECOM_SOL_MODE_AHRS 

A heading reference is available, the Kalman filter provides full orientation but navigation data drift freely.

SBG_ECOM_SOL_MODE_NAV_VELOCITY 

The Kalman filter computes orientation and velocity. Position is freely integrated from velocity estimation.

SBG_ECOM_SOL_MODE_NAV_POSITION 

Nominal mode, the Kalman filter computes all parameters (attitude, velocity, position). Absolute position is provided.

Function Documentation

◆ sbgEComLogEkfEulerGetMagneticHeading()

float sbgEComLogEkfEulerGetMagneticHeading ( const SbgEComLogEkfEuler * pEkfEuler)

Returns the magnetic heading from the true heading by applying the local declination.

Parameters
[in]pEkfEulerLog instance.
Returns
Magnetic heading [-pi;+pi] in radians.

◆ sbgEComLogEkfEulerReadFromStream()

SbgErrorCode sbgEComLogEkfEulerReadFromStream ( SbgEComLogEkfEuler * pLogData,
SbgStreamBuffer * pStreamBuffer )

Parse data for the SBG_ECOM_LOG_EKF_EULER message and fill the corresponding structure.

Parameters
[out]pLogDataLog structure instance to fill.
[in]pStreamBufferInput stream buffer to read the log from.
Returns
SBG_NO_ERROR if a valid log has been read from the stream buffer.

◆ sbgEComLogEkfEulerWriteToStream()

SbgErrorCode sbgEComLogEkfEulerWriteToStream ( const SbgEComLogEkfEuler * pLogData,
SbgStreamBuffer * pStreamBuffer )

Write data for the SBG_ECOM_LOG_EKF_EULER message to the output stream buffer from the provided structure.

Parameters
[in]pLogDataLog structure instance to write.
[out]pStreamBufferOutput stream buffer to write the log to.
Returns
SBG_NO_ERROR if the log has been written to the stream buffer.

◆ sbgEComLogEkfQuatReadFromStream()

SbgErrorCode sbgEComLogEkfQuatReadFromStream ( SbgEComLogEkfQuat * pLogData,
SbgStreamBuffer * pStreamBuffer )

Parse data for the SBG_ECOM_LOG_EKF_QUAT message and fill the corresponding structure.

Parameters
[out]pLogDataLog structure instance to fill.
[in]pStreamBufferInput stream buffer to read the log from.
Returns
SBG_NO_ERROR if a valid log has been read from the stream buffer.

◆ sbgEComLogEkfQuatWriteToStream()

SbgErrorCode sbgEComLogEkfQuatWriteToStream ( const SbgEComLogEkfQuat * pLogData,
SbgStreamBuffer * pStreamBuffer )

Write data for the SBG_ECOM_LOG_EKF_QUAT message to the output stream buffer from the provided structure.

Parameters
[in]pLogDataLog structure instance to write.
[out]pStreamBufferOutput stream buffer to write the log to.
Returns
SBG_NO_ERROR if the log has been written to the stream buffer.

◆ sbgEComLogEkfNavReadFromStream()

SbgErrorCode sbgEComLogEkfNavReadFromStream ( SbgEComLogEkfNav * pLogData,
SbgStreamBuffer * pStreamBuffer )

Parse data for the SBG_ECOM_LOG_EKF_NAV message and fill the corresponding structure.

Parameters
[out]pLogDataLog structure instance to fill.
[in]pStreamBufferInput stream buffer to read the log from.
Returns
SBG_NO_ERROR if a valid log has been read from the stream buffer.

◆ sbgEComLogEkfNavWriteToStream()

SbgErrorCode sbgEComLogEkfNavWriteToStream ( const SbgEComLogEkfNav * pLogData,
SbgStreamBuffer * pStreamBuffer )

Write data for the SBG_ECOM_LOG_EKF_NAV message to the output stream buffer from the provided structure.

Parameters
[in]pLogDataLog structure instance to write.
[out]pStreamBufferOutput stream buffer to write the log to.
Returns
SBG_NO_ERROR if the log has been written to the stream buffer.

◆ sbgEComLogEkfVelBodyConstruct()

void sbgEComLogEkfVelBodyConstruct ( SbgEComLogEkfVelBody * pLogData)

Construct an empty / zero initialized instance.

Parameters
[in]pLogDataLog instance.

◆ sbgEComLogEkfVelBodyReadFromStream()

SbgErrorCode sbgEComLogEkfVelBodyReadFromStream ( SbgEComLogEkfVelBody * pLogData,
SbgStreamBuffer * pStreamBuffer )

Read SBG_ECOM_LOG_EKF_VEL_BODY message from a stream buffer.

Parameters
[out]pLogDataLog instance.
[in]pStreamBufferInput stream buffer to read the log from.
Returns
SBG_NO_ERROR if a valid log has been read from the stream buffer.

◆ sbgEComLogEkfVelBodyWriteToStream()

SbgErrorCode sbgEComLogEkfVelBodyWriteToStream ( const SbgEComLogEkfVelBody * pLogData,
SbgStreamBuffer * pStreamBuffer )

Write SBG_ECOM_LOG_EKF_VEL_BODY message to a stream buffer.

Parameters
[in]pLogDataLog instance.
[out]pStreamBufferOutput stream buffer to write the log to.
Returns
SBG_NO_ERROR if the log has been written to the stream buffer.

◆ sbgEComLogEkfAirDataConstruct()

void sbgEComLogEkfAirDataConstruct ( SbgEComLogEkfAirData * pLogData)

Construct an empty / zero initialized instance.

Parameters
[in]pLogDataLog instance.

◆ sbgEComLogEkfAirDataReadFromStream()

SbgErrorCode sbgEComLogEkfAirDataReadFromStream ( SbgEComLogEkfAirData * pLogData,
SbgStreamBuffer * pStreamBuffer )

Parse data for the SBG_ECOM_LOG_EKF_AIR_DATA message and fill the corresponding structure.

Parameters
[out]pLogDataLog structure instance to fill.
[in]pStreamBufferInput stream buffer to read the log from.
Returns
SBG_NO_ERROR if a valid log has been read from the stream buffer.

◆ sbgEComLogEkfAirDataWriteToStream()

SbgErrorCode sbgEComLogEkfAirDataWriteToStream ( const SbgEComLogEkfAirData * pLogData,
SbgStreamBuffer * pStreamBuffer )

Write data for the SBG_ECOM_LOG_EKF_AIR_DATA message to the output stream buffer from the provided structure.

Parameters
[in]pLogDataLog structure instance to write.
[out]pStreamBufferOutput stream buffer to write the log to.
Returns
SBG_NO_ERROR if the log has been written to the stream buffer.

◆ sbgEComLogEkfGetSolutionMode()

SbgEComSolutionMode sbgEComLogEkfGetSolutionMode ( uint32_t status)

Method used to read the solution mode from a solution status field.

Parameters
[in]statusStatus uint32_t value to extract the solution mode from it.
Returns
The extracted solution mode.

◆ sbgEComLogEkfBuildSolutionStatus()

uint32_t sbgEComLogEkfBuildSolutionStatus ( SbgEComSolutionMode solutionMode,
uint32_t masks )

Method used to write the solution status field.

Parameters
[in]solutionModeThe solution mode to set.
[in]masksBit mask to set.
Returns
The build solution status field.