source: pacpussensors/trunk/Sick/SickLDMRSData.h@ 43

Last change on this file since 43 was 43, checked in by cfougera, 10 years ago

XML for sensors and players added. LMSxxx player ok. LDMRS still under development.

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