[37] | 1 | /*********************************************************************
|
---|
| 2 | // created: 2014/02/11 - 12:08
|
---|
| 3 | // filename: SickLMSData.cpp
|
---|
| 4 | //
|
---|
| 5 | // author: Cyril Fougeray
|
---|
| 6 | // Copyright Heudiasyc UMR UTC/CNRS 6599
|
---|
| 7 | //
|
---|
| 8 | // version: $Id: $
|
---|
| 9 | //
|
---|
| 10 | // purpose: Structures to store Sick LMS data
|
---|
| 11 | //
|
---|
| 12 | *********************************************************************/
|
---|
| 13 |
|
---|
| 14 | #ifndef __SICKLMS_DATA_H__
|
---|
| 15 | #define __SICKLMS_DATA_H__
|
---|
| 16 |
|
---|
| 17 | #include "Pacpus/kernel/cstdint.h"
|
---|
| 18 | #include "Pacpus/kernel/road_time.h"
|
---|
| 19 |
|
---|
| 20 | // Export macro for SickLMS DLL for Windows only
|
---|
| 21 | #ifdef WIN32
|
---|
| 22 | # ifdef SICKLMS_EXPORTS
|
---|
| 23 | // make DLL
|
---|
| 24 | # define SICKLMS_API __declspec(dllexport)
|
---|
| 25 | # else
|
---|
| 26 | // use DLL
|
---|
| 27 | # define SICKLMS_API __declspec(dllimport)
|
---|
| 28 | # endif
|
---|
| 29 | #else
|
---|
| 30 | // On other platforms, simply ignore this
|
---|
| 31 | # define SICKLMS_API
|
---|
| 32 | #endif
|
---|
| 33 |
|
---|
| 34 |
|
---|
| 35 | namespace pacpus{
|
---|
| 36 |
|
---|
| 37 | /*!
|
---|
| 38 | * \brief Structure containing scan configuration.
|
---|
| 39 | * \author Based on Konrad Banachowicz work.
|
---|
| 40 | */
|
---|
| 41 | typedef struct _scanCfg {
|
---|
| 42 | /*!
|
---|
| 43 | * \brief Scanning frequency.
|
---|
| 44 | * 1/100 Hz
|
---|
| 45 | */
|
---|
| 46 | int scaningFrequency;
|
---|
| 47 |
|
---|
| 48 | /*!
|
---|
| 49 | * \brief Scanning resolution.
|
---|
| 50 | * 1/10000 degree
|
---|
| 51 | */
|
---|
| 52 | int angleResolution;
|
---|
| 53 |
|
---|
| 54 | /*!
|
---|
| 55 | * \brief Start angle.
|
---|
| 56 | * 1/10000 degree
|
---|
| 57 | */
|
---|
| 58 | int startAngle;
|
---|
| 59 |
|
---|
| 60 | /*!
|
---|
| 61 | * \brief Stop angle.
|
---|
| 62 | * 1/10000 degree
|
---|
| 63 | */
|
---|
| 64 | int stopAngle;
|
---|
| 65 | } scanCfg;
|
---|
| 66 |
|
---|
| 67 |
|
---|
| 68 | /*!
|
---|
| 69 | * \brief Structure containing single scan message.
|
---|
| 70 | * \author Based on Konrad Banachowicz work.
|
---|
| 71 | */
|
---|
| 72 | typedef struct _scanData {
|
---|
| 73 |
|
---|
| 74 | /*!
|
---|
| 75 | * \brief Scanning frequency.
|
---|
| 76 | * 1/100 Hz
|
---|
| 77 | */
|
---|
[61] | 78 | uint32_t scanFrequency;
|
---|
[37] | 79 |
|
---|
| 80 | /*!
|
---|
| 81 | * \brief Scanning resolution.
|
---|
| 82 | * 1/10000 degree
|
---|
| 83 | */
|
---|
[61] | 84 | uint32_t angleResolution;
|
---|
[37] | 85 |
|
---|
| 86 | /*!
|
---|
| 87 | * \brief Start angle.
|
---|
| 88 | * 1/10000 degree
|
---|
| 89 | */
|
---|
| 90 | int32_t startAngle;
|
---|
| 91 |
|
---|
| 92 | /////////////////////////////////////////////////////
|
---|
| 93 | ////////////////// LMS1xx & LMS5xx //////////////////
|
---|
| 94 |
|
---|
| 95 | /*!
|
---|
| 96 | * \brief Number of samples in dist1.
|
---|
| 97 | *
|
---|
| 98 | */
|
---|
| 99 | int dist_len1;
|
---|
| 100 |
|
---|
| 101 | /*!
|
---|
| 102 | * \brief Radial distance for the first reflected pulse
|
---|
| 103 | *
|
---|
| 104 | */
|
---|
| 105 | uint16_t* dist1;
|
---|
| 106 |
|
---|
| 107 | /*!
|
---|
| 108 | * \brief Number of samples in dist2.
|
---|
| 109 | *
|
---|
| 110 | */
|
---|
| 111 | int dist_len2;
|
---|
| 112 |
|
---|
| 113 | /*!
|
---|
| 114 | * \brief Radial distance for the second reflected pulse
|
---|
| 115 | *
|
---|
| 116 | */
|
---|
| 117 | uint16_t* dist2;
|
---|
| 118 |
|
---|
| 119 |
|
---|
| 120 | /////////////////////////////////////////////////////
|
---|
| 121 | ////////////////// LMS5xx only //////////////////
|
---|
| 122 |
|
---|
| 123 | /*!
|
---|
| 124 | * \brief Number of samples in dist3.
|
---|
| 125 | *
|
---|
| 126 | */
|
---|
| 127 | int dist_len3;
|
---|
| 128 |
|
---|
| 129 | /*!
|
---|
| 130 | * \brief Radial distance for the first reflected pulse
|
---|
| 131 | *
|
---|
| 132 | */
|
---|
| 133 | uint16_t* dist3;
|
---|
| 134 |
|
---|
| 135 | /*!
|
---|
| 136 | * \brief Number of samples in dist4.
|
---|
| 137 | *
|
---|
| 138 | */
|
---|
| 139 | int dist_len4;
|
---|
| 140 |
|
---|
| 141 | /*!
|
---|
| 142 | * \brief Radial distance for the second reflected pulse
|
---|
| 143 | *
|
---|
| 144 | */
|
---|
| 145 | uint16_t* dist4;
|
---|
| 146 |
|
---|
| 147 | /*!
|
---|
| 148 | * \brief Number of samples in dist5.
|
---|
| 149 | *
|
---|
| 150 | */
|
---|
| 151 | int dist_len5;
|
---|
| 152 |
|
---|
| 153 | /*!
|
---|
| 154 | * \brief Radial distance for the second reflected pulse
|
---|
| 155 | *
|
---|
| 156 | */
|
---|
| 157 | uint16_t* dist5;
|
---|
| 158 |
|
---|
| 159 |
|
---|
| 160 | /////////////////////////////////////////////////////
|
---|
| 161 | ////////////////// LMS1xx only //////////////////
|
---|
| 162 |
|
---|
| 163 | /*!
|
---|
| 164 | * \brief Number of samples in rssi1.
|
---|
| 165 | *
|
---|
| 166 | */
|
---|
| 167 | int rssi_len1;
|
---|
| 168 |
|
---|
| 169 | /*!
|
---|
| 170 | * \brief Energy values for the first reflected pulse
|
---|
| 171 | *
|
---|
| 172 | */
|
---|
| 173 | uint16_t* rssi1;
|
---|
| 174 |
|
---|
| 175 | /*!
|
---|
| 176 | * \brief Number of samples in rssi2.
|
---|
| 177 | *
|
---|
| 178 | */
|
---|
| 179 | int rssi_len2;
|
---|
| 180 |
|
---|
| 181 | /*!
|
---|
| 182 | * \brief Energy values for the second reflected pulse
|
---|
| 183 | *
|
---|
| 184 | */
|
---|
| 185 | uint16_t* rssi2;
|
---|
| 186 | } scanData;
|
---|
| 187 |
|
---|
| 188 |
|
---|
| 189 | /*!
|
---|
| 190 | * \brief Status of the scanner
|
---|
| 191 | */
|
---|
| 192 | typedef enum {
|
---|
| 193 | undefined = 0,
|
---|
| 194 | initialisation = 1,
|
---|
| 195 | configuration = 2,
|
---|
| 196 | idle = 3,
|
---|
| 197 | rotated = 4,
|
---|
| 198 | in_preparation = 5,
|
---|
| 199 | ready = 6,
|
---|
| 200 | ready_for_measurement = 7
|
---|
| 201 | } status_t;
|
---|
| 202 |
|
---|
| 203 |
|
---|
| 204 | typedef struct{
|
---|
[61] | 205 | uint16_t scanNumber; //!< number of the scan
|
---|
| 206 | uint16_t scannerStatus;
|
---|
[37] | 207 | //!< - 00 00 OK
|
---|
| 208 | //!< - 00 01 Error
|
---|
| 209 | //!< - 00 02 Pollution Warning
|
---|
| 210 | //!< - 00 04 Pollution Error
|
---|
| 211 |
|
---|
| 212 | road_time_t time; //!< DBT timestamp
|
---|
| 213 | road_timerange_t timerange; //!< DBT timerange
|
---|
[61] | 214 | uint32_t scanFrequency; //!< Frequency of the scan [1/100 Hz]
|
---|
| 215 | uint32_t angleResolution; //!< Angle resolution (default is 5000 <=> 0.5 degree) [1/10000 degree]
|
---|
[37] | 216 | int32_t startAngle; //!< Angle of the first scanned point.
|
---|
| 217 | int dist_len1; //!< Number of points (1st echo).
|
---|
| 218 | uint32_t dataPos_dist1; //!< Distance between the sensor and the remote point (1st echo).
|
---|
| 219 | int dist_len2; //!< Number of points (2nd echo).
|
---|
| 220 | uint32_t dataPos_dist2; //!< Distance between the sensor and the remote point (2nd echo).
|
---|
| 221 | int dist_len3; //!< Number of points (3rd echo).
|
---|
| 222 | uint32_t dataPos_dist3; //!< Distance between the sensor and the remote point (3rd echo). @b LMS5xx @b only.
|
---|
| 223 | int dist_len4; //!< Number of points (4th echo).
|
---|
| 224 | uint32_t dataPos_dist4; //!< Distance between the sensor and the remote point (4th echo). @b LMS5xx @b only.
|
---|
| 225 | int dist_len5; //!< Number of points (5th echo).
|
---|
| 226 | uint32_t dataPos_dist5; //!< Distance between the sensor and the remote point (5th echo). @b LMS5xx @b only.
|
---|
| 227 | int rssi_len1; //!< Number of energy values (1st echo).
|
---|
| 228 | uint32_t dataPos_rssi1; //!< Energy of the returned pulse (1st echo). @b LMS1xx @b only.
|
---|
| 229 | int rssi_len2; //!< Number of energy values (2nd echo).
|
---|
| 230 | uint32_t dataPos_rssi2; //!< Energy of the returned pulse (2nd echo). @b LMS1xx @b only.
|
---|
| 231 | }SickLMS_dbt;
|
---|
| 232 |
|
---|
| 233 | }
|
---|
| 234 | #endif
|
---|