0.5.1
Loading...
Searching...
No Matches
NAV::vendor::ln::Ln200UartSensor Class Reference

Class to read out LN-200 Sensors. More...

Public Member Functions

std::unique_ptr< uart::protocol::Packet > findPacket (uint8_t dataByte)
 Collects data bytes and searches for packages inside of them.
 Ln200UartSensor ()=default
 Default constructor.
 Ln200UartSensor (const Ln200UartSensor &)=delete
 Copy constructor.
 Ln200UartSensor (Ln200UartSensor &&)=delete
 Move constructor.
 Ln200UartSensor (std::string name)
 Constructor.
uart::sensors::UartSensor * operator-> ()
 Arrow operator overload.
Ln200UartSensoroperator= (const Ln200UartSensor &)=delete
 Copy assignment operator.
Ln200UartSensoroperator= (Ln200UartSensor &&)=delete
 Move assignment operator.
 ~Ln200UartSensor ()=default
 Destructor.

Private Types

enum class  State : uint8_t {
  Idle ,
  Receiving
}
 Operational states of the LN-200 UART sensor node. More...

Static Private Member Functions

static bool checksumFunction (const uart::protocol::Packet &packet)
 Function which is called to verify packet integrity.
static bool isErrorFunction (const uart::protocol::Packet &packet)
 Function which determines, if the packet is an Error Packet.
static bool isResponseFunction (const uart::protocol::Packet &packet)
 Function which determines, if the packet is a Response.
static void packetFinderFunction (const std::vector< uint8_t > &data, const uart::xplat::TimeStamp &timestamp, uart::sensors::UartSensor::ValidPacketFoundHandler dispatchPacket, void *dispatchPacketUserData, void *userData)
 Function which is called to find packets in the provided data buffer.
static uart::protocol::Packet::Type packetTypeFunction (const uart::protocol::Packet &packet)
 Function which is called to determine the packet type (ascii/binary)

Private Attributes

ScrollingBuffer< bool > _bitBuffer
 Buffer to accumulate bits of the current frame.
int _consecutiveOnes
 Counter for bit insertion.
ScrollingBuffer< bool > _flagWindow
 Sliding window buffer to detect flags.
const std::string _name
 Name of the Parent Node.
size_t _runningDataIndex
 Used for correlating raw data with where the packet was found for the end user.
uart::sensors::UartSensor _sensor
 UartSensor object which handles the UART interface.
State _state
 Internal state of the sensor.
bool _wasIdle
 Flag to detect the start of a frame.

Static Private Attributes

static constexpr uart::Endianness ENDIANNESS
 Endianess of the sensor.
static constexpr size_t MAX_SIZE_ASCII_PACKET
 Maximum size of a ascii packet before resetting it.
static constexpr size_t PACKET_HEADER_LENGTH
 Length of the packet header.

Detailed Description

Class to read out LN-200 Sensors.

The class is used to read out the LN-200 IMU via UART with 2000

Note
The UART interface is configured to 2Mbit/s, 8N1 set by the IMU Uart interface microcontroller. The following commands are needed to set up the UART interface: sudo usermod -a -G dialout "username" sudo dmesg | grep -i tty -> find connected device stty -F /dev/"device" -raw 2000000 cs8 -cstopb -parenb

Message content mapping:

  • Word Index 0: X_VEL - X Delta Velocity
  • Word Index 1: Y_VEL - Y Delta Velocity
  • Word Index 2: Z_VEL - Z Delta Velocity
  • Word Index 3: X_ANG - X Delta Angle
  • Word Index 4: Y_ANG - Y Delta Angle
  • Word Index 5: Z_ANG - Z Delta Angle
  • Word Index 6: STATUS - IMU Status Summary Word
  • Word Index 7: MUX_ID - Mode Bit/MUX ID
  • Word Index 8: MUX_DATA - Mux Data Word
  • Word Index 9: X_RAW_COUNT - X Raw Gyro Counts
  • Word Index 10: Y_RAW_COUNT - Y Raw Gyro Counts
  • Word Index 11: Z_RAW_COUNT - Z Raw Gyro Counts
  • Word Index 12: INTERNAL_CHECK_SUM - Internal Check Sum
  • Word Index 13: EXTERNAL_CHECK_SUM - External Check Sum

Definition at line 46 of file Ln200UartSensor.hpp.

Member Enumeration Documentation

◆ State

enum class NAV::vendor::ln::Ln200UartSensor::State : uint8_t
strongprivate

Operational states of the LN-200 UART sensor node.

Enumerator
Idle 

Sensor is idle.

Receiving 

Sensor is receiving data.

Definition at line 121 of file Ln200UartSensor.hpp.

Constructor & Destructor Documentation

◆ Ln200UartSensor() [1/4]

NAV::vendor::ln::Ln200UartSensor::Ln200UartSensor ( std::string name)
explicit

Constructor.

Parameters
[in]nameName of the Parent Node

Definition at line 13 of file Ln200UartSensor.cpp.

◆ Ln200UartSensor() [2/4]

NAV::vendor::ln::Ln200UartSensor::Ln200UartSensor ( )
default

Default constructor.

◆ ~Ln200UartSensor()

NAV::vendor::ln::Ln200UartSensor::~Ln200UartSensor ( )
default

Destructor.

◆ Ln200UartSensor() [3/4]

NAV::vendor::ln::Ln200UartSensor::Ln200UartSensor ( const Ln200UartSensor & )
delete

Copy constructor.

◆ Ln200UartSensor() [4/4]

NAV::vendor::ln::Ln200UartSensor::Ln200UartSensor ( Ln200UartSensor && )
delete

Move constructor.

Member Function Documentation

◆ checksumFunction()

bool NAV::vendor::ln::Ln200UartSensor::checksumFunction ( const uart::protocol::Packet & packet)
staticprivate

Function which is called to verify packet integrity.

Parameters
[in]packetPacket to calculate the checksum for
Returns
True if the packet is fault free

Definition at line 159 of file Ln200UartSensor.cpp.

◆ findPacket()

std::unique_ptr< uart::protocol::Packet > NAV::vendor::ln::Ln200UartSensor::findPacket ( uint8_t dataByte)

Collects data bytes and searches for packages inside of them.

Parameters
[in]dataByteThe next data byte
Returns
nullptr if no packet found yet, otherwise a pointer to the packet

Definition at line 17 of file Ln200UartSensor.cpp.

◆ isErrorFunction()

bool NAV::vendor::ln::Ln200UartSensor::isErrorFunction ( const uart::protocol::Packet & packet)
staticprivate

Function which determines, if the packet is an Error Packet.

Parameters
[in]packetThe packet to check

Definition at line 170 of file Ln200UartSensor.cpp.

◆ isResponseFunction()

bool NAV::vendor::ln::Ln200UartSensor::isResponseFunction ( const uart::protocol::Packet & packet)
staticprivate

Function which determines, if the packet is a Response.

Parameters
[in]packetThe packet to check

Definition at line 175 of file Ln200UartSensor.cpp.

◆ operator->()

uart::sensors::UartSensor * NAV::vendor::ln::Ln200UartSensor::operator-> ( )
inline

Arrow operator overload.

Definition at line 66 of file Ln200UartSensor.hpp.

◆ operator=() [1/2]

Ln200UartSensor & NAV::vendor::ln::Ln200UartSensor::operator= ( const Ln200UartSensor & )
delete

Copy assignment operator.

◆ operator=() [2/2]

Ln200UartSensor & NAV::vendor::ln::Ln200UartSensor::operator= ( Ln200UartSensor && )
delete

Move assignment operator.

◆ packetFinderFunction()

void NAV::vendor::ln::Ln200UartSensor::packetFinderFunction ( const std::vector< uint8_t > & data,
const uart::xplat::TimeStamp & timestamp,
uart::sensors::UartSensor::ValidPacketFoundHandler dispatchPacket,
void * dispatchPacketUserData,
void * userData )
staticprivate

Function which is called to find packets in the provided data buffer.

Parameters
[in]dataRaw data buffer which has potential packets inside
[in]timestampTimestamp then the data in the buffer was received
[in]dispatchPacketFunction to call when a complete packet was found
[in]dispatchPacketUserDataUser data to forward to the dispatchPacket function
[in]userDataUser data provided when regisering this function. Should contain the sensor object

Definition at line 138 of file Ln200UartSensor.cpp.

◆ packetTypeFunction()

uart::protocol::Packet::Type NAV::vendor::ln::Ln200UartSensor::packetTypeFunction ( const uart::protocol::Packet & packet)
staticprivate

Function which is called to determine the packet type (ascii/binary)

Parameters
[in]packetPacket to check the type of
Returns
The type of the packet

Definition at line 154 of file Ln200UartSensor.cpp.

Field Documentation

◆ _bitBuffer

ScrollingBuffer<bool> NAV::vendor::ln::Ln200UartSensor::_bitBuffer
private

Buffer to accumulate bits of the current frame.

Definition at line 131 of file Ln200UartSensor.hpp.

◆ _consecutiveOnes

int NAV::vendor::ln::Ln200UartSensor::_consecutiveOnes
private

Counter for bit insertion.

Definition at line 140 of file Ln200UartSensor.hpp.

◆ _flagWindow

ScrollingBuffer<bool> NAV::vendor::ln::Ln200UartSensor::_flagWindow
private

Sliding window buffer to detect flags.

Definition at line 134 of file Ln200UartSensor.hpp.

◆ _name

const std::string NAV::vendor::ln::Ln200UartSensor::_name
private

Name of the Parent Node.

Definition at line 75 of file Ln200UartSensor.hpp.

◆ _runningDataIndex

size_t NAV::vendor::ln::Ln200UartSensor::_runningDataIndex
private

Used for correlating raw data with where the packet was found for the end user.

Definition at line 143 of file Ln200UartSensor.hpp.

◆ _sensor

uart::sensors::UartSensor NAV::vendor::ln::Ln200UartSensor::_sensor
private

UartSensor object which handles the UART interface.

Definition at line 78 of file Ln200UartSensor.hpp.

◆ _state

State NAV::vendor::ln::Ln200UartSensor::_state
private

Internal state of the sensor.

Definition at line 128 of file Ln200UartSensor.hpp.

◆ _wasIdle

bool NAV::vendor::ln::Ln200UartSensor::_wasIdle
private

Flag to detect the start of a frame.

Definition at line 137 of file Ln200UartSensor.hpp.

◆ ENDIANNESS

uart::Endianness NAV::vendor::ln::Ln200UartSensor::ENDIANNESS
staticconstexprprivate

Endianess of the sensor.

Definition at line 116 of file Ln200UartSensor.hpp.

◆ MAX_SIZE_ASCII_PACKET

size_t NAV::vendor::ln::Ln200UartSensor::MAX_SIZE_ASCII_PACKET
staticconstexprprivate

Maximum size of a ascii packet before resetting it.

Definition at line 118 of file Ln200UartSensor.hpp.

◆ PACKET_HEADER_LENGTH

size_t NAV::vendor::ln::Ln200UartSensor::PACKET_HEADER_LENGTH
staticconstexprprivate

Length of the packet header.

Definition at line 117 of file Ln200UartSensor.hpp.


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