AMS Advanced Air Mobility Sensors UG
Loading...
Searching...
No Matches
CSerialProtocol Class Reference

The class that describes and implements the BAHRS serial protocol. More...

Classes

struct  SAccuracyData
 Accuracy message payload. More...
 
struct  SAccuracyDataMessage
 Navigation data accuracy message. More...
 
struct  SInertialData
 Inertial data message payload. More...
 
struct  SInertialDataMessage
 Inertial data message. More...
 
struct  SMessageHeader
 Message header struct. More...
 
struct  SNavigationData
 Navigation data message payload. More...
 
struct  SNavigationDataMessage
 Navigation data message. More...
 
struct  SPacketNVMPage
 Diagnostic message: One NVM page ( both: RX & TX ) More...
 
struct  SPacketReadNVMPage
 Diagnostic Mode Messages. More...
 
struct  SPacketReceiveConfirmation
 Diagnostic message: confirmation of request processing by the device. More...
 
struct  SRunnableCallEventData
 Debug information on runnable call. More...
 
struct  SRunnableCallEventDebugMessage
 A debug message with runnable call data. More...
 
struct  SSoftwareVersionData
 Payload of the "software version" message. More...
 
struct  SSoftwareVersionMessage
 Software version message. More...
 
struct  STimeOfInertialData
 Payload of the time of inertial data message. More...
 
struct  STimeOfInertialDataMessage
 Time of inertial data message. More...
 
struct  STimeOfLatestSyncPulse
 Payload of the "time of the latest pulse" message. More...
 
struct  STimeOfLatestSyncPulseMessage
 Time of the latest sync pulse message. More...
 
struct  STimeOfNavigationData
 Payload of the "time of navigation data" message. More...
 
struct  STimeOfNavigationDataMessage
 Time of navigation data message. More...
 
struct  SWriteToPortEventPartialData
 Partial data of the "write to port event". The struct does not include a variable size array of data written to a port. More...
 

Public Types

enum class  EMessageIds : uint8_t {
  eInvalid = 0x00 , eInertialData = 0x01 , eNavigationData = 0x02 , eAccuracy = 0x03 ,
  eTimeOfNavigationData = 0x04 , eTimeOfInertialData = 0x05 , eTimeOfSyncPulse = 0x06 , eSoftwareVersion = 0x0F ,
  eDebugEventWriteToPort = 0xC0 , eDebugEventRunnableCall = 0xC1 , eTypeOpenDiagnostic = 0xF0 , eTypeCloseDiagnostic = 0xF1 ,
  eTypeReadNVMPage = 0xF2 , eTypeNVMPageData = 0xF3 , eTypeAccept = 0xFF
}
 
typedef uint32_t CrcType_t
 

Public Member Functions

 CSerialProtocol ()=default
 
 ~CSerialProtocol ()=default
 
SInertialDataMessage BuildInertialDataMessage (const SOutputImuData &korImuData)
 Build inertial data message from IMU measurements.
 
STimeOfInertialDataMessage BuildTimeOfInertialDataMessage (const SOutputImuData &korImuData)
 Build the "Time of inertial data message" from IMU measurements.
 
SNavigationDataMessage BuildNavigationDataMessage (const SVerticalChannelData &korVerticalChannelData, const SAttitudeData &korVehicleAttitude, const SMagneticHeading &korMagneticHeading)
 Build navigation data message.
 
STimeOfNavigationDataMessage BuildTimeOfNavigationDataMessage (const SAttitudeData &korVehicleAttitude)
 Build time of navigation data message.
 
SAccuracyDataMessage BuildAccuracyDataMessage (const SAttitudeData &korVehicleAttitude)
 Build navigation data accuracy message.
 
STimeOfLatestSyncPulseMessage BuildTimeOfLatestSyncPulseMessage (uint64_t uTimestamp)
 Build time of the latest sync pulse message.
 
SSoftwareVersionMessage BuildSoftwareVersionMessage ()
 Build the software version message.
 

Static Public Member Functions

static uint32_t CalculateCrc (uint32_t *pData, uint32_t uNumberOfWords_)
 Calculate CRC.
 

Static Public Attributes

static constexpr uint8_t uMarker1_ { 0x4E }
 Sync byte 1, symbol 'N'.
 
static constexpr uint8_t uMarker2_ { 0x45 }
 Sync char 2, symbol 'E'.
 
static constexpr uint16_t uVersion_ { 2U }
 Protocol version.
 
static constexpr float skfMaxHeight_ { 10000.0F }
 
static constexpr float skfMinHeight_ { -1000.0F }
 
static constexpr float skfMaxVelocityDown_ { 300.0F }
 
static constexpr float skfMinVelocityDown_ { -300.0F }
 
static constexpr float skfMaxAngularRate_ { 300.0F * (CMathConstants::skfPi_ / 180.0F) }
 +-300 [deg/s] in [rad/s]
 
static constexpr float skfMaxSpecificForce_ { CGeoConstants::skfGravity * 5.0F }
 +-5 [g] in [m/s^2]
 
static constexpr float skfSpecificForceScale_ { skfMaxSpecificForce_ / static_cast<float>(std::numeric_limits<int16_t>::max() - 1) }
 Integer to float, +-5g range.
 
static constexpr float skfAngularRateScale_ { skfMaxAngularRate_ / static_cast<float>(std::numeric_limits<int16_t>::max() - 1) }
 Integer to float, +-300 deg/s range.
 
static constexpr float skfHeightScale_ { 0.16784924F }
 Integer to float, -1000 to 10000 m range.
 
static constexpr float skfHeighOffset_ { 1000.0F }
 An offset to convert unsigned integer to float.
 
static constexpr float skfVelocityDownScale_ { 9.155413e-3F }
 Integer to float, -300 to 300 m/s range.
 
static constexpr float skfAngleScale_ { 9.587526e-5F }
 Integer to float, -pi to pi or 0 to 2 pi range.
 

Detailed Description

The class that describes and implements the BAHRS serial protocol.

Member Typedef Documentation

◆ CrcType_t

typedef uint32_t CSerialProtocol::CrcType_t

Member Enumeration Documentation

◆ EMessageIds

enum class CSerialProtocol::EMessageIds : uint8_t
strong
Enumerator
eInvalid 

Invalid.

eInertialData 

Inertial data message.

eNavigationData 

Navigation data message.

eAccuracy 

Attitude accuracy information.

eTimeOfNavigationData 

"Time of navigation data" message

eTimeOfInertialData 

"Time of inertial data" message

eTimeOfSyncPulse 

"Time of the latest sync pulse" message

eSoftwareVersion 

"Software version" message

eDebugEventWriteToPort 

Debug information: SWC port data.

eDebugEventRunnableCall 

Debug information: SWC API call.

eTypeOpenDiagnostic 

Request to enter diagnostics mode.

eTypeCloseDiagnostic 

Request to exit diagnostics mode.

eTypeReadNVMPage 

Request to read NVM page.

eTypeNVMPageData 

A message with NVM page data.

eTypeAccept 

Acknowledgment of diagnostics message reception.

Constructor & Destructor Documentation

◆ CSerialProtocol()

CSerialProtocol::CSerialProtocol ( )
default

◆ ~CSerialProtocol()

CSerialProtocol::~CSerialProtocol ( )
default

Member Function Documentation

◆ BuildAccuracyDataMessage()

CSerialProtocol::SAccuracyDataMessage CSerialProtocol::BuildAccuracyDataMessage ( const SAttitudeData korVehicleAttitude)

Build navigation data accuracy message.

Parameters
korVehicleAttitudeReference to vehicle attitude data.
Returns
Accuracy data message.

◆ BuildInertialDataMessage()

CSerialProtocol::SInertialDataMessage CSerialProtocol::BuildInertialDataMessage ( const SOutputImuData korImuData)

Build inertial data message from IMU measurements.

Parameters
korImuDataReference to IMU data.
Returns
Inertial data message struct.

◆ BuildNavigationDataMessage()

CSerialProtocol::SNavigationDataMessage CSerialProtocol::BuildNavigationDataMessage ( const SVerticalChannelData korVerticalChannelData,
const SAttitudeData korVehicleAttitude,
const SMagneticHeading korMagneticHeading 
)

Build navigation data message.

Parameters
korVerticalChannelDataReference to vertical channel data.
korVehicleAttitudeReference to vehicle attitude data.
korMagneticHeadingReference to the estimated magnetic heading data compensated for installation alignment
Returns
Navigation data message struct.

◆ BuildSoftwareVersionMessage()

CSerialProtocol::SSoftwareVersionMessage CSerialProtocol::BuildSoftwareVersionMessage ( )

Build the software version message.

Returns
The software version message struct.

◆ BuildTimeOfInertialDataMessage()

CSerialProtocol::STimeOfInertialDataMessage CSerialProtocol::BuildTimeOfInertialDataMessage ( const SOutputImuData korImuData)

Build the "Time of inertial data message" from IMU measurements.

Parameters
korImuDataReference to IMU measurement.
Returns
"Time of inertial data message" struct.

◆ BuildTimeOfLatestSyncPulseMessage()

CSerialProtocol::STimeOfLatestSyncPulseMessage CSerialProtocol::BuildTimeOfLatestSyncPulseMessage ( uint64_t  uTimestamp)

Build time of the latest sync pulse message.

Parameters
uTimestampMeasured time of the latest sync pulse.
Returns
The time of the latest sync pulse message.

◆ BuildTimeOfNavigationDataMessage()

CSerialProtocol::STimeOfNavigationDataMessage CSerialProtocol::BuildTimeOfNavigationDataMessage ( const SAttitudeData korVehicleAttitude)

Build time of navigation data message.

Parameters
korVehicleAttitudeReference to vehicle attitude data.
Returns
Time of navigation data message.

◆ CalculateCrc()

uint32_t CSerialProtocol::CalculateCrc ( uint32_t *  pData,
uint32_t  uNumberOfWords_ 
)
static

Calculate CRC.

Parameters
pDataPointer to 32-bit data words aarray.
uNumberOfWords_Number of words in the array.
Returns
32-bit CRC (CRC-32/MPEG2)

Member Data Documentation

◆ skfAngleScale_

constexpr float CSerialProtocol::skfAngleScale_ { 9.587526e-5F }
staticconstexpr

Integer to float, -pi to pi or 0 to 2 pi range.

◆ skfAngularRateScale_

constexpr float CSerialProtocol::skfAngularRateScale_ { skfMaxAngularRate_ / static_cast<float>(std::numeric_limits<int16_t>::max() - 1) }
staticconstexpr

Integer to float, +-300 deg/s range.

◆ skfHeighOffset_

constexpr float CSerialProtocol::skfHeighOffset_ { 1000.0F }
staticconstexpr

An offset to convert unsigned integer to float.

◆ skfHeightScale_

constexpr float CSerialProtocol::skfHeightScale_ { 0.16784924F }
staticconstexpr

Integer to float, -1000 to 10000 m range.

◆ skfMaxAngularRate_

constexpr float CSerialProtocol::skfMaxAngularRate_ { 300.0F * (CMathConstants::skfPi_ / 180.0F) }
staticconstexpr

+-300 [deg/s] in [rad/s]

◆ skfMaxHeight_

constexpr float CSerialProtocol::skfMaxHeight_ { 10000.0F }
staticconstexpr

◆ skfMaxSpecificForce_

constexpr float CSerialProtocol::skfMaxSpecificForce_ { CGeoConstants::skfGravity * 5.0F }
staticconstexpr

+-5 [g] in [m/s^2]

◆ skfMaxVelocityDown_

constexpr float CSerialProtocol::skfMaxVelocityDown_ { 300.0F }
staticconstexpr

◆ skfMinHeight_

constexpr float CSerialProtocol::skfMinHeight_ { -1000.0F }
staticconstexpr

◆ skfMinVelocityDown_

constexpr float CSerialProtocol::skfMinVelocityDown_ { -300.0F }
staticconstexpr

◆ skfSpecificForceScale_

constexpr float CSerialProtocol::skfSpecificForceScale_ { skfMaxSpecificForce_ / static_cast<float>(std::numeric_limits<int16_t>::max() - 1) }
staticconstexpr

Integer to float, +-5g range.

◆ skfVelocityDownScale_

constexpr float CSerialProtocol::skfVelocityDownScale_ { 9.155413e-3F }
staticconstexpr

Integer to float, -300 to 300 m/s range.

◆ uMarker1_

constexpr uint8_t CSerialProtocol::uMarker1_ { 0x4E }
staticconstexpr

Sync byte 1, symbol 'N'.

◆ uMarker2_

constexpr uint8_t CSerialProtocol::uMarker2_ { 0x45 }
staticconstexpr

Sync char 2, symbol 'E'.

◆ uVersion_

constexpr uint16_t CSerialProtocol::uVersion_ { 2U }
staticconstexpr

Protocol version.


The documentation for this class was generated from the following files: