This commit is contained in:
r.koeppe
2024-05-14 02:14:13 +02:00
parent 0052d3984b
commit 2d22ccd2d6
1423 changed files with 354055 additions and 7 deletions

View File

@ -0,0 +1,61 @@
#ifndef _VNCOMMON_H_
#define _VNCOMMON_H_
#ifdef __cplusplus
extern "C" {
#endif
/** \brief Enumeration of the available asynchronous ASCII message types. */
typedef enum
{
VNOFF = 0, /**< Asynchronous output is turned off. */
VNYPR = 1, /**< Asynchronous output type is Yaw, Pitch, Roll. */
VNQTN = 2, /**< Asynchronous output type is Quaternion. */
#ifdef EXTRA
VNQTM = 3, /**< Asynchronous output type is Quaternion and Magnetic. */
VNQTA = 4, /**< Asynchronous output type is Quaternion and Acceleration. */
VNQTR = 5, /**< Asynchronous output type is Quaternion and Angular Rates. */
VNQMA = 6, /**< Asynchronous output type is Quaternion, Magnetic and Acceleration. */
VNQAR = 7, /**< Asynchronous output type is Quaternion, Acceleration and Angular Rates. */
#endif
VNQMR = 8, /**< Asynchronous output type is Quaternion, Magnetic, Acceleration and Angular Rates. */
#ifdef EXTRA
VNDCM = 9, /**< Asynchronous output type is Directional Cosine Orientation Matrix. */
#endif
VNMAG = 10, /**< Asynchronous output type is Magnetic Measurements. */
VNACC = 11, /**< Asynchronous output type is Acceleration Measurements. */
VNGYR = 12, /**< Asynchronous output type is Angular Rate Measurements. */
VNMAR = 13, /**< Asynchronous output type is Magnetic, Acceleration, and Angular Rate Measurements. */
VNYMR = 14, /**< Asynchronous output type is Yaw, Pitch, Roll, Magnetic, Acceleration, and Angular Rate Measurements. */
#ifdef EXTRA
VNYCM = 15, /**< Asynchronous output type is Yaw, Pitch, Roll, and Calibrated Measurements. */
#endif
VNYBA = 16, /**< Asynchronous output type is Yaw, Pitch, Roll, Body True Acceleration. */
VNYIA = 17, /**< Asynchronous output type is Yaw, Pitch, Roll, Inertial True Acceleration. */
#ifdef EXTRA
VNICM = 18, /**< Asynchronous output type is Yaw, Pitch, Roll, Inertial Magnetic/Acceleration, and Angular Rate Measurements. */
#endif
VNIMU = 19, /**< Asynchronous output type is Calibrated Inertial Measurements. */
VNGPS = 20, /**< Asynchronous output type is GPS LLA. */
VNGPE = 21, /**< Asynchronous output type is GPS ECEF. */
VNINS = 22, /**< Asynchronous output type is INS LLA solution. */
VNINE = 23, /**< Asynchronous output type is INS ECEF solution. */
VNISL = 28, /**< Asynchronous output type is INS LLA 2 solution. */
VNISE = 29, /**< Asynchronous output type is INS ECEF 2 solution. */
VNDTV = 30, /**< Asynchronous output type is Delta Theta and Delta Velocity. */
VNRTK = 31 /**< Asynchronous output type is RTK, from the GPS processor. */
#ifdef EXTRA
,
VNRAW = 252, /**< Asynchronous output type is Raw Voltage Measurements. */
VNCMV = 253, /**< Asynchronous output type is Calibrated Measurements. */
VNSTV = 254, /**< Asynchronous output type is Kalman Filter State Vector. */
VNCOV = 255 /**< Asynchronous output type is Kalman Filter Covariance Matrix Diagonal. */
#endif
} VnAsciiAsync;
#ifdef __cplusplus
}
#endif
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,129 @@
#ifndef VNUPACKF_H_INCLUDED
#define VNUPACKF_H_INCLUDED
#include "vn/protocol/upack.h"
/*#include "vnint.h"*/
/*#include "vnbool.h"*/
/*#include "vntypes.h"
#include "vnerror.h"*/
#ifndef VNUART_PROTOCOL_BUFFER_SIZE
/** Default internal buffers size for handling received UART data. */
#define VNUART_PROTOCOL_BUFFER_SIZE 256
#endif
#ifdef __cplusplus
extern "C" {
#endif
/** \brief Defines signature of functions that can handle callback
* notifications of packets successfully received and validated from a
* VectorNav sensor. */
typedef void(*VnUartPacketFinder_PacketFoundHandler)(void *userData, VnUartPacket* packet, size_t runningIndexOfPacketStart);
#ifdef _WIN32
#pragma warning(push)
#pragma warning(disable : 4820)
#endif
/** \brief Data structure holding current parsing status of data received from
* a VectorNav sensor.
*
* This structure contains a buffer which will hold bytes that are currently
* being processed. The size of this buffer can be adjusted by defining the
* size using the preprocesser. For example, the size can be adjusted to use
* 1024 bytes by defining VNUART_PROTOCOL_BUFFER_SIZE=1024. */
typedef struct
{
/** \brief Callback for when a packet has been found and validated. */
VnUartPacketFinder_PacketFoundHandler packetFoundHandler;
/** \brief User data for callbacks on the packetFoundHandler. */
void *packetFoundHandlerUserData;
/** \brief Used for correlating the position in the received raw data
* stream where packets are found. */
size_t runningDataIndex;
/** \brief Indicates if an ASCII packet is currently being built. */
bool asciiCurrentlyBuildingPacket;
/** \brief Indicates a suspected start of an ASCII packet. */
size_t asciiPossibleStartOfPacketIndex;
/** \brief Index of start of ASCII packet in total running index. */
size_t asciiRunningDataIndexOfStart;
/** \brief Indicates if the first ending character has been found. */
bool asciiEndChar1Found;
/** \brief Indicates if we are currently building a binary packet. */
bool binaryCurrentlyBuildingBinaryPacket;
/** \brief Index of start of binary packet in total running index. */
size_t binaryRunningDataIndexOfStart;
/** \brief Holds the size of the receive buffer. */
size_t bufferSize;
/** \brief The current location to append data into the buffer. */
size_t bufferAppendLocation;
/** \brief Indicates if we have found the groups present data field for a
* binary packet we are building. */
bool binaryGroupsPresentFound;
/** \brief The groups present found from a binary packet. */
uint8_t binaryGroupsPresent;
/** \brief Indicates the number of bytes remaining to have all group fields
* for a binary data packet we are processing. */
uint8_t binaryNumOfBytesRemainingToHaveAllGroupFields;
/** \brief Start index of a possible binary packet. */
size_t binaryPossibleStartIndex;
/** \brief Keeps track of the number of bytes remaining for a complete
* binary packet. */
size_t binaryNumberOfBytesRemainingForCompletePacket;
/** \brief The receive buffer. */
uint8_t receiveBuffer[VNUART_PROTOCOL_BUFFER_SIZE];
} VnUartPacketFinder;
#ifdef _WIN32
#pragma warning(pop)
#endif
/** \brief Initializes the VnUartPacketFinder data structure.
*
* \param[in] pf VnUartPacketFinder to init. */
void VnUartPacketFinder_initialize(VnUartPacketFinder* pf);
/** \brief Processes received data from the UART.
*
* \param[in] finder The associated VnUartPacketFinder containing the data
* processing state.
* \param[in] data The received data.
* \param[in] len The number of bytes to process.
* \param[in] bootloaderFilter Enable filtering for bootloader messages. */
VnError VnUartPacketFinder_processData_ex(VnUartPacketFinder* finder, uint8_t* data, size_t len, bool bootloaderFilter);
VnError VnUartPacketFinder_processData(VnUartPacketFinder* finder, uint8_t* data, size_t len);
/** \brief Allows registering for notification of when valid packets are found.
*
* \param[in] handler The callback function for receiving notifications.
* \param[in] userData Pointer to user supplied data which will be sent on all callback notifications.
* \return Any errors encountered. */
VnError VnUartPacketFinder_registerPacketFoundHandler(VnUartPacketFinder* finder, VnUartPacketFinder_PacketFoundHandler handler, void *userData);
#ifdef __cplusplus
}
#endif
#endif