[89] | 1 | #ifndef STRUCTURE_TELEMETRE_H
|
---|
| 2 | #define STRUCTURE_TELEMETRE_H
|
---|
| 3 |
|
---|
| 4 | #include "kernel/cstdint.h"
|
---|
| 5 | #include "kernel/road_time.h"
|
---|
| 6 |
|
---|
| 7 | #if QT_VERSION
|
---|
| 8 | #include <QVariant>
|
---|
| 9 | #endif
|
---|
| 10 |
|
---|
| 11 | ////////////////////////////////////////////////////////////////////////////////
|
---|
| 12 | // some constants defined for the Alasca component
|
---|
| 13 | static const uint32_t MAX_SCAN_POINT = 8648;
|
---|
| 14 | static const uint32_t MAX_SCAN_POINT_PER_LAYER = 2162;
|
---|
| 15 | static const int32_t UTC_MAGIC_WORD = 0x55544300;
|
---|
| 16 |
|
---|
| 17 | // Data recorded in the DBITE file
|
---|
| 18 | // Alasca XT laserscanner
|
---|
| 19 | typedef struct
|
---|
| 20 | {
|
---|
| 21 | int8_t scannertype;
|
---|
| 22 | uint32_t timeStart; // time start of the scan
|
---|
| 23 | float startAngle; // the start angle of the measurement (in [rad*e4])
|
---|
| 24 | float endAngle; // the stop angle of the measurement (in [rad*e4])
|
---|
| 25 | uint32_t nbPoint; // number of points
|
---|
| 26 | int32_t dataPos; // the position of the data in the binary file associated to the dbt file
|
---|
| 27 | } AlascaXT;
|
---|
| 28 |
|
---|
| 29 | // An Alasca point
|
---|
| 30 | // see Manual_Alasca.pdf page 27
|
---|
| 31 | // Orientation of the frame regarding the car:
|
---|
| 32 | // X ahead, Y on the left and Z upside
|
---|
| 33 | struct ScanPoint
|
---|
| 34 | {
|
---|
| 35 | uint8_t scannerId; // ID of the scanner that has detected the point - Alasca has type 2
|
---|
| 36 | uint8_t layerNumber; // channel (0 = bottom channel ...)
|
---|
| 37 | uint8_t echoNumber; // subChannel (0 = A, 1 = B ...)
|
---|
| 38 | uint8_t pointStatus; // ground, rain, dirt ...
|
---|
| 39 | int16_t x; // X coordinate in centimeters
|
---|
| 40 | int16_t y; // Y coordinate in centimeters
|
---|
| 41 | int16_t z; // Z coordinate in centimeters
|
---|
| 42 | uint16_t width; // the echo width
|
---|
| 43 | };
|
---|
| 44 |
|
---|
| 45 | // Data obtained after decoding
|
---|
| 46 | // The complete structure is written in shared memory
|
---|
| 47 | // Only the point[MAX_SCAN_POINT] array is recorded in the binary file
|
---|
| 48 | // associated to the DBT file (see struct AlascaXT)
|
---|
| 49 | struct ScanAlascaData
|
---|
| 50 | {
|
---|
| 51 | uint8_t scannertype; // Alasca has type 2
|
---|
| 52 | uint32_t timeStart; // time start of the scan
|
---|
| 53 | float startAngle; // the start angle of the measurement (in [rad*e4])
|
---|
| 54 | float endAngle; // the stop angle of the measurement (in [rad*e4])
|
---|
| 55 | uint32_t nbPoint; // number of points
|
---|
| 56 | road_time_t time; // DBT timestamp
|
---|
| 57 | road_timerange_t timerange; // DBT timerange
|
---|
| 58 | ScanPoint point[MAX_SCAN_POINT]; // the data, see struct ScanPoint
|
---|
| 59 | };
|
---|
| 60 |
|
---|
| 61 | struct SortedScanAlascaData
|
---|
| 62 | {
|
---|
| 63 | double xYellow[MAX_SCAN_POINT_PER_LAYER];
|
---|
| 64 | double yYellow[MAX_SCAN_POINT_PER_LAYER];
|
---|
| 65 | double xGreen[MAX_SCAN_POINT_PER_LAYER];
|
---|
| 66 | double yGreen[MAX_SCAN_POINT_PER_LAYER];
|
---|
| 67 | double xBlue[MAX_SCAN_POINT_PER_LAYER];
|
---|
| 68 | double yBlue[MAX_SCAN_POINT_PER_LAYER];
|
---|
| 69 | double xRed[MAX_SCAN_POINT_PER_LAYER];
|
---|
| 70 | double yRed[MAX_SCAN_POINT_PER_LAYER];
|
---|
| 71 |
|
---|
| 72 | int32_t totalSize;
|
---|
| 73 | int32_t yellowSize;
|
---|
| 74 | int32_t greenSize;
|
---|
| 75 | int32_t blueSize;
|
---|
| 76 | int32_t redSize;
|
---|
| 77 | };
|
---|
| 78 |
|
---|
| 79 | /// Sick LMS 221 laserscanner
|
---|
| 80 | typedef struct
|
---|
| 81 | {
|
---|
| 82 | static const std::size_t DATA_COUNT = 101;
|
---|
| 83 | float data[DATA_COUNT];
|
---|
| 84 | } TELEMETRE_100;
|
---|
| 85 |
|
---|
| 86 | /// Sick LMS 291 laserscanner
|
---|
| 87 | typedef struct
|
---|
| 88 | {
|
---|
| 89 | static const std::size_t DATA_COUNT = 181;
|
---|
| 90 | float data[DATA_COUNT];
|
---|
| 91 | } TELEMETRE_180;
|
---|
| 92 |
|
---|
| 93 | // cf. page 23
|
---|
| 94 | // faire une structure avec le nb de secteurs
|
---|
| 95 |
|
---|
| 96 | // pour chaque secteur :
|
---|
| 97 | // donnees statiques : timestamp debut et fin - angles debut et fin - pas de l'angle nb de pts dans le secteur
|
---|
| 98 | // tableaux => donnees de base : distance direction et echo amplitude
|
---|
| 99 | typedef struct
|
---|
| 100 | {
|
---|
| 101 | // TODO
|
---|
| 102 | } SickLdoemData;
|
---|
| 103 |
|
---|
| 104 | #if QT_VERSION
|
---|
| 105 |
|
---|
| 106 | Q_DECLARE_METATYPE(ScanPoint)
|
---|
| 107 | inline QDataStream & operator << (QDataStream & out, const ScanPoint & Valeur)
|
---|
| 108 | {
|
---|
| 109 | out << Valeur.scannerId << Valeur.layerNumber << Valeur.echoNumber << Valeur.pointStatus <<
|
---|
| 110 | Valeur.x << Valeur.y << Valeur.z << Valeur.width;
|
---|
| 111 | }
|
---|
| 112 |
|
---|
| 113 | inline QDataStream & operator >> (QDataStream & in, ScanPoint & Valeur)
|
---|
| 114 | {
|
---|
| 115 | in >> Valeur.scannerId >> Valeur.layerNumber >> Valeur.echoNumber >> Valeur.pointStatus >>
|
---|
| 116 | Valeur.x >> Valeur.y >> Valeur.z >> Valeur.width;
|
---|
| 117 | }
|
---|
| 118 | Q_DECLARE_METATYPE(ScanAlascaData)
|
---|
| 119 | inline QDataStream & operator << (QDataStream & out, const ScanAlascaData & Valeur)
|
---|
| 120 | {
|
---|
| 121 | out << ((quint64)Valeur.time) << Valeur.timerange << Valeur.timeStart << Valeur.scannertype <<
|
---|
| 122 | Valeur.startAngle << Valeur.endAngle << Valeur .nbPoint;
|
---|
| 123 | for (int i =0; i< Valeur.nbPoint;i++)
|
---|
| 124 | out << Valeur.point[i];
|
---|
| 125 | return out;
|
---|
| 126 | }
|
---|
| 127 |
|
---|
| 128 | inline QDataStream & operator >> (QDataStream & in, ScanAlascaData & Valeur)
|
---|
| 129 | {
|
---|
| 130 | in >> (quint64&)Valeur.time >> Valeur.timerange >> Valeur.timeStart >> Valeur.scannertype >>
|
---|
| 131 | Valeur.startAngle >> Valeur.endAngle >> Valeur .nbPoint;
|
---|
| 132 | for (int i =0; i< Valeur.nbPoint;i++)
|
---|
| 133 | in >> Valeur.point[i];
|
---|
| 134 |
|
---|
| 135 | return in;
|
---|
| 136 | }
|
---|
| 137 |
|
---|
| 138 | #endif
|
---|
| 139 |
|
---|
| 140 | #endif // STRUCTURE_TELEMETRE_H
|
---|