[37] | 1 | /*********************************************************************
|
---|
| 2 | // created: 2014/02/11 - 12:08
|
---|
| 3 | // filename: SickLDMRSData.h
|
---|
| 4 | //
|
---|
| 5 | // author: Cyril Fougeray
|
---|
| 6 | // Copyright Heudiasyc UMR UTC/CNRS 6599
|
---|
| 7 | //
|
---|
| 8 | // version: $Id: $
|
---|
| 9 | //
|
---|
| 10 | // purpose: Structures to store Sick LDMRS data
|
---|
| 11 | //
|
---|
| 12 | *********************************************************************/
|
---|
| 13 |
|
---|
| 14 | #ifndef __SICKLDMRS_DATA_H__
|
---|
| 15 | #define __SICKLDMRS_DATA_H__
|
---|
| 16 |
|
---|
| 17 | #include "Pacpus/kernel/cstdint.h"
|
---|
| 18 | #include "Pacpus/kernel/road_time.h"
|
---|
[104] | 19 | #include <QVector>
|
---|
[37] | 20 |
|
---|
| 21 | // Export macro for SickLDMRS DLL for Windows only
|
---|
| 22 | #ifdef WIN32
|
---|
| 23 | # ifdef SICKLDMRS_EXPORTS
|
---|
| 24 | // make DLL
|
---|
| 25 | # define SICKLDMRS_API __declspec(dllexport)
|
---|
| 26 | # else
|
---|
| 27 | // use DLL
|
---|
| 28 | # define SICKLDMRS_API __declspec(dllimport)
|
---|
| 29 | # endif
|
---|
| 30 | #else
|
---|
| 31 | // On other platforms, simply ignore this
|
---|
| 32 | # define SICKLDMRS_API
|
---|
| 33 | #endif
|
---|
| 34 |
|
---|
| 35 | namespace pacpus{
|
---|
[71] | 36 | static const uint32_t MAX_SICKSCAN_POINT = 1100;
|
---|
| 37 | static const uint32_t MAX_SCAN_POINT_PER_LAYER = 1100;
|
---|
[37] | 38 |
|
---|
| 39 | /*!
|
---|
| 40 | * \brief The DataHeader struct
|
---|
| 41 | *
|
---|
| 42 | * The DataHeader struct describes general information about the message used with.
|
---|
| 43 | * On Sick LDMRS, DataHeader corresponds exactly to the very first data carried into the whole message.
|
---|
| 44 | * See [Ethernet data protocol LD-MRS, page 4](docs/BAMessdatenProtokoll_LDMRSen_8014492_20110601.pdf).
|
---|
| 45 | * > Warning : the data from the sensor is coded in Big Endian format.
|
---|
| 46 | */
|
---|
| 47 | struct DataHeader {
|
---|
[61] | 48 | uint32_t magicWord; //!< 0xAFFEC0C2 for the Sick LDMRS sensor (this value must be found in order to decode the message).
|
---|
| 49 | uint32_t sizePreviousMessage; //!< Size in bytes of the previous message.
|
---|
| 50 | uint32_t sizeCurrentMessage; //!< Size of the message content without the header (DataHeader).
|
---|
| 51 | // uint8_t reserved
|
---|
| 52 | uint8_t deviceId; //!< Unused in data received directly from LD-MRS sensors.
|
---|
| 53 | uint16_t dataType; //!< Type of information carried into the message.
|
---|
[37] | 54 | ///< Types used are :
|
---|
| 55 | ///< - Points : 0x2202
|
---|
| 56 | ///< - Objects : 0x2221
|
---|
[61] | 57 | uint64_t ntpTime; //!< Time of the sensor when the message is created
|
---|
[37] | 58 | };
|
---|
[52] | 59 |
|
---|
| 60 |
|
---|
[37] | 61 | /*!
|
---|
| 62 | * \brief The ScanHeader struct
|
---|
| 63 | *
|
---|
| 64 | * General information about points measured.
|
---|
| 65 | * Data type is 0x2202
|
---|
| 66 | * @see DataHeader
|
---|
| 67 | *
|
---|
| 68 | * see Ethernet data protocol LD-MRS page 5
|
---|
| 69 | */
|
---|
| 70 | struct SICKLDMRS_API ScanHeader {
|
---|
[61] | 71 | uint16_t scanNumber; //!< Number of the scan since the sensor started measuring.
|
---|
| 72 | uint16_t scannerStatus; //!< Status of the scanner
|
---|
[37] | 73 | /**<
|
---|
| 74 | * - 0x0007: reserved,
|
---|
| 75 | * - 0x0008: set frequency reached,
|
---|
| 76 | * - 0x0010: external sync signal detected,
|
---|
| 77 | * - 0x0020: sync ok,
|
---|
| 78 | * - 0x0040: sync master (instead of slave),
|
---|
| 79 | * - 0xFF80: reserved
|
---|
| 80 | */
|
---|
| 81 |
|
---|
[61] | 82 | uint16_t phaseOffset; ///<
|
---|
| 83 | uint64_t startNtpTime; //!< NTP time first measurement
|
---|
| 84 | uint64_t endNtpTime; //!< NTP time last measurement
|
---|
| 85 | uint16_t ticksPerRot; //!< Angle ticks per rotation (used to compute the real angle of a point)
|
---|
[104] | 86 | int16_t startAngle; //!< Angle of the first measured value
|
---|
| 87 | int16_t endAngle; //!< Angle of the last measured value
|
---|
[61] | 88 | uint16_t numPoints; //!< Number of scanned points during this scan @see ScanPoint
|
---|
[37] | 89 |
|
---|
| 90 | // mounting position; reference ?
|
---|
| 91 | // int16_t mountingYawAngle;
|
---|
| 92 | // int16_t mountingPitchAngle;
|
---|
| 93 | // int16_t mountingRollAngle;
|
---|
| 94 | // int16_t mountingX;
|
---|
| 95 | // int16_t mountingY;
|
---|
| 96 | // int16_t mountingZ;
|
---|
| 97 |
|
---|
[61] | 98 | // uint16_t reserved;
|
---|
[37] | 99 |
|
---|
| 100 | };
|
---|
| 101 |
|
---|
| 102 |
|
---|
| 103 | /*!
|
---|
| 104 | * \brief The ScanPoint struct
|
---|
| 105 | *
|
---|
| 106 | * Used to describe a point.
|
---|
| 107 | * Data type 0x2202 @see DataHeader
|
---|
| 108 | */
|
---|
| 109 | struct SICKLDMRS_API ScanPoint{
|
---|
[61] | 110 | uchar layerEcho; //!< 4 LSB : Layer (scan layer of the point)
|
---|
[37] | 111 | //!< 4 MSB : Echo
|
---|
[61] | 112 | uchar flags;
|
---|
[71] | 113 | int16_t angle; //!< Angle in number of ticks. You can easily compute the real angle :
|
---|
[37] | 114 | //!< \f$ angle (degree) = \frac{angle (ticks)}{ScanHeader.ticksPerRot}\f$ @see ScanHeader
|
---|
| 115 |
|
---|
[61] | 116 | uint16_t distance; //!< Distance of the point from the sensor in centimeters.
|
---|
| 117 | uint16_t echoPulseWidth; //!< Width of echo pulse (cm)
|
---|
| 118 | // uint16_t reserved;
|
---|
[37] | 119 | };
|
---|
| 120 |
|
---|
| 121 | /*!
|
---|
| 122 | * \brief The ScanObject struct (not used)
|
---|
| 123 | *
|
---|
| 124 | * Used to describe an object.
|
---|
| 125 | * Data type 0x2221 @see DataHeader
|
---|
| 126 | */
|
---|
[104] | 127 |
|
---|
[37] | 128 | struct SICKLDMRS_API ScanObject{
|
---|
| 129 | // TODO
|
---|
| 130 | };
|
---|
| 131 |
|
---|
| 132 |
|
---|
| 133 |
|
---|
| 134 | /*! \brief The SickLDMRS_dbt struct
|
---|
| 135 | *
|
---|
| 136 | * Data recorded in the DBITE file (.dbt).
|
---|
| 137 | */
|
---|
| 138 | typedef struct
|
---|
| 139 | {
|
---|
[104] | 140 | uint64_t timeStartFromSensor; //!< NTP time (creation of the message on sensor).
|
---|
[37] | 141 | ScanHeader hScan; //!< General information about points recorded. @see ScanHeader
|
---|
[43] | 142 | road_time_t time; //!< DBT timestamp.
|
---|
| 143 | road_timerange_t timerange; //!< DBT timerange.
|
---|
[37] | 144 | int32_t dataPos; //!< The position of the data in the binary file associated to the dbt file (utc file).
|
---|
| 145 | } SickLDMRS_dbt;
|
---|
| 146 |
|
---|
[104] | 147 | /*!
|
---|
| 148 | * \brief The Sick LDMRS scan struct
|
---|
| 149 | *
|
---|
| 150 | * Used to describe one complete scan
|
---|
| 151 | * @see DataHeader
|
---|
| 152 | */
|
---|
[105] | 153 | struct /*SICKLDMRS_API*/ SickLDMRSScan{
|
---|
[104] | 154 | uint64_t timeStartFromSensor; //!< NTP time (creation of the message on sensor).
|
---|
| 155 | ScanHeader header; //!< General information about points recorded.
|
---|
| 156 | QVector<ScanPoint> points; //!< Scan point cloud
|
---|
| 157 | road_time_t time; //!< DBT timestamp.
|
---|
| 158 | road_timerange_t timerange; //!< DBT timerange.
|
---|
| 159 | };
|
---|
| 160 |
|
---|
[37] | 161 | #ifdef SICKLDMRS_SH_MEM
|
---|
| 162 | /// Structure to write in shared memory, followed by the points.
|
---|
| 163 | typedef struct{
|
---|
| 164 | ScanHeader scanInfo; //!< General information about points recorded. @see ScanHeader
|
---|
| 165 | road_time_t time; //!< DBT timestamp
|
---|
| 166 | road_timerange_t timerange; //!< DBT timerange
|
---|
| 167 |
|
---|
| 168 | /// In shared memory, followed by ScanPoint[scanInfo.numPoints] @see ScanPoint
|
---|
| 169 |
|
---|
| 170 | } SickLDMRS_shMem;
|
---|
| 171 | #endif
|
---|
| 172 |
|
---|
| 173 | }
|
---|
| 174 |
|
---|
| 175 | #endif
|
---|