Main MRPT website > C++ reference for MRPT 1.5.9
cmtpacket.h
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +---------------------------------------------------------------------------+ */
9 
10 #ifndef _CMTPACKET_H_2006_05_10
11 #define _CMTPACKET_H_2006_05_10
12 
13 #ifndef _CMT_MONOLITHIC
14 # include "cmtdef.h"
15 # include "cmt2.h"
16 #endif
17 
18 namespace xsens {
19 
20  //! Indicates that a data item is not available in the packet
21 #define CMT_DATA_ITEM_NOT_AVAILABLE 65535
22 
23  //! A structure containing MT data + timestamp and formatting information.
24 class Packet
25 {
26 protected:
27  //! Contains information about data in the packet and the format of that data
28  mutable struct PacketInfo {
66  }* m_infoList;
67  CmtDataFormat* m_formatList; //!< A list of the formats of the data items
68  bool m_xm; //!< Indicates that xbus-formatting is used
69 
70 public:
71  uint16_t m_itemCount; //!< The number of data items in the message
72  Message m_msg; //!< The message
73  TimeStamp m_rtc; //!< Sample time in ms, based on the sample counter
74  TimeStamp m_toa; //!< Time of arrival
75 
76  Packet(uint16_t items, bool xbus);
77  Packet(const Packet& pack);
78  ~Packet();
79 
80  void operator = (const Packet& pack);
81 
82  bool setDataFormat(const CmtDataFormat& format, const uint16_t index = 0);
83  bool setDataFormat(const CmtOutputMode outputMode, const CmtOutputSettings outputSettings, const uint16_t index = 0);
84  CmtDataFormat getDataFormat(const uint16_t index = 0) const;
85  void setXbus(bool xbus, bool convert = false);
86  bool getXbus(void) const;
87 
88  /*! \brief Return the data size.
89 
90  \param index The index of the item of which the size should be returned.
91  */
92  uint16_t getDataSize(const uint16_t index=0) const;
93 
94  /*! \brief Return the floating/fixed point value size
95 
96  \param index The index of the item whose fp size should be returned.
97  */
99 
100  /*! \brief Return the Raw Accelerometer component of a data item.
101 
102  \param index The index of the item of which the data should be returned.
103  */
104  CmtShortVector getRawAcc(const uint16_t index=0) const;
105  //! Check if data item contains Raw Accelerometer data
106  bool containsRawAcc(const uint16_t index=0) const;
107  //! Add/update Raw Accelerometer data for the item
108  bool updateRawAcc(const CmtShortVector& vec, const uint16_t index=0);
109  /*! \brief Return the Raw Gyroscope component of a data item.
110 
111  \param index The index of the item of which the data should be returned.
112  */
113  CmtShortVector getRawGyr(const uint16_t index=0) const;
114  //! Check if data item contains Raw Gyroscope data
115  bool containsRawGyr(const uint16_t index=0) const;
116  //! Add/update Raw Gyroscope data for the item
117  bool updateRawGyr(const CmtShortVector& vec, const uint16_t index=0);
118  /*! \brief Return the Raw Magnetometer component of a data item.
119 
120  \param index The index of the item of which the data should be returned.
121  */
122  CmtShortVector getRawMag(const uint16_t index=0) const;
123  //! Check if data item contains Raw Magnetometer data
124  bool containsRawMag(const uint16_t index=0) const;
125  //! Add/update Raw Magnetometer data for the item
126  bool updateRawMag(const CmtShortVector& vec, const uint16_t index=0);
127  /*! \brief Return the Raw Temperature component of a data item.
128 
129  \param index The index of the item of which the data should be returned.
130  */
131  uint16_t getRawTemp(const uint16_t index=0) const;
132  //! Check if data item contains Raw Temperature data
133  bool containsRawTemp(const uint16_t index=0) const;
134  //! Add/update Raw Temperature data for the item
135  bool updateRawTemp(uint16_t temp, const uint16_t index=0);
136  /*! \brief Return the Raw Data component of a data item.
137 
138  \param index The index of the item of which the data should be returned.
139  */
140  CmtRawData getRawData(const uint16_t index=0) const;
141  //! Check if data item contains Raw Data
142  bool containsRawData(const uint16_t index=0) const;
143  //! Add/update Raw Data for the item
144  bool updateRawData(const CmtRawData& data, const uint16_t index=0);
145  /*! \brief Return the Raw GpsPrint Data component of a data item.
146  // TODO: Implement in COM interface!!!
147  \param index The index of the item of which the data should be returned.
148  */
149  CmtRawGpsData getRawGpsData(const uint16_t index=0) const;
150  //! Check if data item contains Raw GpsPrint Data
151  bool containsRawGpsData(const uint16_t index=0) const;
152  //! Add/update Raw GpsPrint Data for the item
153  bool updateRawGpsData(const CmtRawGpsData& data, const uint16_t index=0);
154  /*! \brief Return the Temperature component of a data item.
155 
156  \param index The index of the item of which the data should be returned.
157  */
158  double getTemp(const uint16_t index=0) const;
159  //! Check if data item contains Temperature data
160  bool containsTemp(const uint16_t index=0) const;
161  //! Add/update Calibrated Accelerometer data for the item
162  bool updateTemp(const double& temp, const uint16_t index=0);
163  /*! \brief Return the Calibrated Accelerometer component of a data item.
164 
165  \param index The index of the item of which the data should be returned.
166  */
167  CmtVector getCalAcc(const uint16_t index=0) const;
168  //! Check if data item contains Calibrated Accelerometer data
169  bool containsCalAcc(const uint16_t index=0) const;
170  //! Add/update Calibrated Accelerometer data for the item
171  bool updateCalAcc(const CmtVector& vec, const uint16_t index=0);
172  /*! \brief Return the Calibrated Gyroscope component of a data item.
173 
174  \param index The index of the item of which the data should be returned.
175  */
176  CmtVector getCalGyr(const uint16_t index=0) const;
177  //! Check if data item contains Calibrated Gyroscope data
178  bool containsCalGyr(const uint16_t index=0) const;
179  //! Add/update Calibrated Gyroscope data for the item
180  bool updateCalGyr(const CmtVector& vec, const uint16_t index=0);
181  /*! \brief Return the Calibrated Magnetometer component of a data item.
182 
183  \param index The index of the item of which the data should be returned.
184  */
185  CmtVector getCalMag(const uint16_t index=0) const;
186  //! Check if data item contains Calibrated Magnetometer data
187  bool containsCalMag(const uint16_t index=0) const;
188  //! Add/update Calibrated Magnetometer data for the item
189  bool updateCalMag(const CmtVector& vec, const uint16_t index=0);
190  /*! \brief Return the Calibrated Data component of a data item.
191 
192  \param index The index of the item of which the data should be returned.
193  */
194  CmtCalData getCalData(const uint16_t index=0) const;
195  //! Check if data item contains Calibrated Data
196  bool containsCalData(const uint16_t index=0) const;
197  //! Add/update Calibrated Data for the item
198  bool updateCalData(const CmtCalData& data, const uint16_t index=0);
199 
200  /*! \brief Return the Orientation component of a data item as a Quaternion.
201 
202  \param index The index of the item of which the data should be returned.
203  */
204  CmtQuat getOriQuat(const uint16_t index=0) const;
205  //! Check if data item contains Quaternion Orientation data
206  bool containsOriQuat(const uint16_t index=0) const;
207  //! Add/update Quaternion Orientation data for the item
208  bool updateOriQuat(const CmtQuat& data, const uint16_t index=0);
209  /*! \brief Return the Orientation component of a data item as Euler angles.
210 
211  \param index The index of the item of which the data should be returned.
212  */
213  CmtEuler getOriEuler(const uint16_t index=0) const;
214  //! Check if data item contains Euler Orientation data
215  bool containsOriEuler(const uint16_t index=0) const;
216  //! Add/update Euler Orientation data for the item
217  bool updateOriEuler(const CmtEuler& data, const uint16_t index=0);
218  /*! \brief Return the Orientation component of a data item as an Orientation Matrix.
219 
220  \param index The index of the item of which the data should be returned.
221  */
222  CmtMatrix getOriMatrix(const uint16_t index=0) const;
223  //! Check if data item contains Matrix Orientation data
224  bool containsOriMatrix(const uint16_t index=0) const;
225  //! Add/update Matrix Orientation data for the item
226  bool updateOriMatrix(const CmtMatrix& data, const uint16_t index=0);
227 
228  /*! \brief Return the AnalogIn 1 component of a data item.
229 
230  \param index The index of the item of which the data should be returned.
231  */
233  //! Check if data item contains AnalogIn 1
234  bool containsAnalogIn1(const uint16_t index=0) const;
235  //! Add/update AnalogIn 1 for the item
236  bool updateAnalogIn1(const CmtAnalogInData& data, const uint16_t index=0);
237 
238  /*! \brief Return the AnalogIn 2 component of a data item.
239 
240  \param index The index of the item of which the data should be returned.
241  */
243  //! Check if data item contains AnalogIn 2
244  bool containsAnalogIn2(const uint16_t index=0) const;
245  //! Add/update AnalogIn 2 for the item
246  bool updateAnalogIn2(const CmtAnalogInData& data, const uint16_t index=0);
247 
248  /*! \brief Return the Position Lat Lon Alt component of a data item.
249 
250  \param index The index of the item of which the data should be returned.
251  */
252  CmtVector getPositionLLA(const uint16_t index=0) const;
253  //! Check if data item contains Position Lat Lon Alt
254  bool containsPositionLLA(const uint16_t index=0) const;
255  //! Add/update Position Lat Lon Alt for the item
256  bool updatePositionLLA(const CmtVector& data, const uint16_t index=0);
257 
258  /*! \brief Return the Velocity component of a data item.
259 
260  \param index The index of the item of which the data should be returned.
261  */
262  CmtVector getVelocity(const uint16_t index=0) const;
263  //! Check if data item contains Velocity
264  bool containsVelocity(const uint16_t index=0) const;
265  //! Add/update Velocity for the item
266  bool updateVelocity(const CmtVector& data, const uint16_t index=0);
267 
268  /*! \brief Return the Status component of a data item.
269 
270  \param index The index of the item of which the data should be returned.
271  */
272  uint8_t getStatus(const uint16_t index=0) const;
273  //! Check if data item contains Velocity
274  bool containsStatus(const uint16_t index=0) const;
275  //! Add/update Status information for the item
276  bool updateStatus(const uint8_t data, const uint16_t index=0);
277 
278  /*! \brief Return the Sample Counter component of the packet.
279 
280  \param index The index of the item of which the data should be returned. (ignored)
281  */
282  uint16_t getSampleCounter(const uint16_t index=0) const;
283  //! Check if data item contains Sample Counter
284  bool containsSampleCounter(const uint16_t index=0) const;
285  //! Add/update Sample Counter for all items
287  /*! \brief Return the RTC of the packet.
288 
289  \param index The index of the item of which the data should be returned. (ignored)
290  */
291  CmtTimeStamp getRtc(const uint16_t index=0) const;
292 
293 
294  /*! \brief Return the XKF-3 Acc-G component of the packet.
295 
296  \param index The index of the item of which the data should be returned.
297  */
298  CmtVector getAccG(const uint16_t index=0) const;
299  //! Check if data item contains XKF-3 Acc-G data
300  bool containsAccG(const uint16_t index=0) const;
301  //! Add/update XKF-3 Acc-G data for the item
302  bool updateAccG(const CmtVector& g, const uint16_t index=0);
303 
304  #ifdef _CMT_DLL_EXPORT
305  //! Interpolate so resulting packet is (1-f)*pa + pb OR pb if pa and pb are non-matching types
306  void interpolate(const Packet& pa, const Packet& pb, const double f);
307  #endif
308 };
309 
310 } // end of xsens namespace
311 
312 #endif // _CMTPACKET_H_2006_05_10
bool updateOriQuat(const CmtQuat &data, const uint16_t index=0)
Add/update Quaternion Orientation data for the item.
Definition: cmtpacket.cpp:896
bool updatePositionLLA(const CmtVector &data, const uint16_t index=0)
Add/update Position Lat Lon Alt for the item.
Definition: cmtpacket.cpp:1096
bool updateRawTemp(uint16_t temp, const uint16_t index=0)
Add/update Raw Temperature data for the item.
Definition: cmtpacket.cpp:538
uint64_t CmtTimeStamp
Definition: cmtdef.h:1188
bool containsCalAcc(const uint16_t index=0) const
Check if data item contains Calibrated Accelerometer data.
Definition: cmtpacket.cpp:724
double getTemp(const uint16_t index=0) const
Return the Temperature component of a data item.
Definition: cmtpacket.cpp:679
CmtVector getPositionLLA(const uint16_t index=0) const
Return the Position Lat Lon Alt component of a data item.
Definition: cmtpacket.cpp:1079
TimeStamp m_toa
Time of arrival.
Definition: cmtpacket.h:74
unsigned __int16 uint16_t
Definition: rptypes.h:46
A structure for storing data formats.
Definition: cmtdef.h:900
bool containsAccG(const uint16_t index=0) const
Check if data item contains XKF-3 Acc-G data.
Definition: cmtpacket.cpp:1238
CmtRawData getRawData(const uint16_t index=0) const
Return the Raw Data component of a data item.
Definition: cmtpacket.cpp:556
struct xsens::Packet::PacketInfo * m_infoList
bool updateAnalogIn1(const CmtAnalogInData &data, const uint16_t index=0)
Add/update AnalogIn 1 for the item.
Definition: cmtpacket.cpp:1027
CmtVector getAccG(const uint16_t index=0) const
Return the XKF-3 Acc-G component of the packet.
Definition: cmtpacket.cpp:1228
bool containsAnalogIn2(const uint16_t index=0) const
Check if data item contains AnalogIn 2.
Definition: cmtpacket.cpp:1053
bool containsRawAcc(const uint16_t index=0) const
Check if data item contains Raw Accelerometer data.
Definition: cmtpacket.cpp:424
CmtVector getVelocity(const uint16_t index=0) const
Return the Velocity component of a data item.
Definition: cmtpacket.cpp:1118
T interpolate(const T &x, const VECTOR &ys, const T &x0, const T &x1)
Interpolate a data sequence "ys" ranging from "x0" to "x1" (equally spaced), to obtain the approximat...
Definition: interp_fit.hpp:17
bool updateCalData(const CmtCalData &data, const uint16_t index=0)
Add/update Calibrated Data for the item.
Definition: cmtpacket.cpp:850
CmtDataFormat getDataFormat(const uint16_t index=0) const
Definition: cmtpacket.cpp:69
uint16_t getRawTemp(const uint16_t index=0) const
Return the Raw Temperature component of a data item.
Definition: cmtpacket.cpp:523
uint16_t m_itemCount
The number of data items in the message.
Definition: cmtpacket.h:71
bool containsPositionLLA(const uint16_t index=0) const
Check if data item contains Position Lat Lon Alt.
Definition: cmtpacket.cpp:1088
uint16_t getSampleCounter(const uint16_t index=0) const
Return the Sample Counter component of the packet.
Definition: cmtpacket.cpp:1191
CmtRawGpsData getRawGpsData(const uint16_t index=0) const
Return the Raw GpsPrint Data component of a data item. TODO: Implement in COM interface!!! ...
Definition: cmtpacket.cpp:602
bool updateRawAcc(const CmtShortVector &vec, const uint16_t index=0)
Add/update Raw Accelerometer data for the item.
Definition: cmtpacket.cpp:432
bool containsCalData(const uint16_t index=0) const
Check if data item contains Calibrated Data.
Definition: cmtpacket.cpp:842
bool containsRawGpsData(const uint16_t index=0) const
Check if data item contains Raw GpsPrint Data.
Definition: cmtpacket.cpp:628
A structure containing MT data + timestamp and formatting information.
Definition: cmtpacket.h:24
unsigned char uint8_t
Definition: rptypes.h:43
bool updateRawGpsData(const CmtRawGpsData &data, const uint16_t index=0)
Add/update Raw GpsPrint Data for the item.
Definition: cmtpacket.cpp:636
bool containsRawTemp(const uint16_t index=0) const
Check if data item contains Raw Temperature data.
Definition: cmtpacket.cpp:530
bool containsOriMatrix(const uint16_t index=0) const
Check if data item contains Matrix Orientation data.
Definition: cmtpacket.cpp:978
TimeStamp m_rtc
Sample time in ms, based on the sample counter.
Definition: cmtpacket.h:73
CmtDataFormat * m_formatList
A list of the formats of the data items.
Definition: cmtpacket.h:67
bool updateOriEuler(const CmtEuler &data, const uint16_t index=0)
Add/update Euler Orientation data for the item.
Definition: cmtpacket.cpp:938
bool updateCalGyr(const CmtVector &vec, const uint16_t index=0)
Add/update Calibrated Gyroscope data for the item.
Definition: cmtpacket.cpp:771
bool containsCalGyr(const uint16_t index=0) const
Check if data item contains Calibrated Gyroscope data.
Definition: cmtpacket.cpp:763
CmtVector getCalGyr(const uint16_t index=0) const
Return the Calibrated Gyroscope component of a data item.
Definition: cmtpacket.cpp:754
bool updateVelocity(const CmtVector &data, const uint16_t index=0)
Add/update Velocity for the item.
Definition: cmtpacket.cpp:1136
GLuint index
Definition: glext.h:3891
bool updateAccG(const CmtVector &g, const uint16_t index=0)
Add/update XKF-3 Acc-G data for the item.
Definition: cmtpacket.cpp:1246
bool containsCalMag(const uint16_t index=0) const
Check if data item contains Calibrated Magnetometer data.
Definition: cmtpacket.cpp:802
CmtQuat getOriQuat(const uint16_t index=0) const
Return the Orientation component of a data item as a Quaternion.
Definition: cmtpacket.cpp:878
bool updateCalAcc(const CmtVector &vec, const uint16_t index=0)
Add/update Calibrated Accelerometer data for the item.
Definition: cmtpacket.cpp:732
bool m_xm
Indicates that xbus-formatting is used.
Definition: cmtpacket.h:68
GLubyte g
Definition: glext.h:5575
bool containsRawGyr(const uint16_t index=0) const
Check if data item contains Raw Gyroscope data.
Definition: cmtpacket.cpp:460
CmtShortVector getRawAcc(const uint16_t index=0) const
Return the Raw Accelerometer component of a data item.
Definition: cmtpacket.cpp:415
bool updateTemp(const double &temp, const uint16_t index=0)
Add/update Calibrated Accelerometer data for the item.
Definition: cmtpacket.cpp:694
uint16_t m_rawGpsPressureAge
Definition: cmtpacket.h:52
bool containsOriQuat(const uint16_t index=0) const
Check if data item contains Quaternion Orientation data.
Definition: cmtpacket.cpp:888
bool containsTemp(const uint16_t index=0) const
Check if data item contains Temperature data.
Definition: cmtpacket.cpp:686
uint64_t TimeStamp
A real-time timestamp (ms)
Definition: xsens_time.h:24
uint16_t getDataSize(const uint16_t index=0) const
Return the data size.
Definition: cmtpacket.cpp:175
CmtMatrix getOriMatrix(const uint16_t index=0) const
Return the Orientation component of a data item as an Orientation Matrix.
Definition: cmtpacket.cpp:962
Contains information about data in the packet and the format of that data.
Definition: cmtpacket.h:28
CmtShortVector getRawGyr(const uint16_t index=0) const
Return the Raw Gyroscope component of a data item.
Definition: cmtpacket.cpp:451
uint16_t getFPValueSize(const uint16_t index) const
Return the floating/fixed point value size.
Definition: cmtpacket.cpp:146
bool containsRawMag(const uint16_t index=0) const
Check if data item contains Raw Magnetometer data.
Definition: cmtpacket.cpp:496
bool containsVelocity(const uint16_t index=0) const
Check if data item contains Velocity.
Definition: cmtpacket.cpp:1128
bool setDataFormat(const CmtDataFormat &format, const uint16_t index=0)
Definition: cmtpacket.cpp:80
bool updateOriMatrix(const CmtMatrix &data, const uint16_t index=0)
Add/update Matrix Orientation data for the item.
Definition: cmtpacket.cpp:986
bool updateRawMag(const CmtShortVector &vec, const uint16_t index=0)
Add/update Raw Magnetometer data for the item.
Definition: cmtpacket.cpp:504
bool updateSampleCounter(uint16_t counter, const uint16_t index=0)
Add/update Sample Counter for all items.
Definition: cmtpacket.cpp:1205
uint32_t CmtOutputMode
An output mode bit-field.
Definition: cmtdef.h:895
bool containsOriEuler(const uint16_t index=0) const
Check if data item contains Euler Orientation data.
Definition: cmtpacket.cpp:930
bool containsAnalogIn1(const uint16_t index=0) const
Check if data item contains AnalogIn 1.
Definition: cmtpacket.cpp:1019
void setXbus(bool xbus, bool convert=false)
Definition: cmtpacket.cpp:111
bool containsStatus(const uint16_t index=0) const
Check if data item contains Velocity.
Definition: cmtpacket.cpp:1164
The namespace of all Xsens software since 2006.
Definition: cmt1.cpp:92
bool updateRawData(const CmtRawData &data, const uint16_t index=0)
Add/update Raw Data for the item.
Definition: cmtpacket.cpp:578
GLenum GLsizei GLenum format
Definition: glext.h:3513
CmtVector getCalMag(const uint16_t index=0) const
Return the Calibrated Magnetometer component of a data item.
Definition: cmtpacket.cpp:793
bool updateCalMag(const CmtVector &vec, const uint16_t index=0)
Add/update Calibrated Magnetometer data for the item.
Definition: cmtpacket.cpp:810
Packet(uint16_t items, bool xbus)
Definition: cmtpacket.cpp:48
bool updateAnalogIn2(const CmtAnalogInData &data, const uint16_t index=0)
Add/update AnalogIn 2 for the item.
Definition: cmtpacket.cpp:1061
bool getXbus(void) const
Definition: cmtpacket.cpp:105
bool containsSampleCounter(const uint16_t index=0) const
Check if data item contains Sample Counter.
Definition: cmtpacket.cpp:1197
CmtTimeStamp getRtc(const uint16_t index=0) const
Return the RTC of the packet.
Definition: cmtpacket.cpp:1220
CmtAnalogInData getAnalogIn2(const uint16_t index=0) const
Return the AnalogIn 2 component of a data item.
Definition: cmtpacket.cpp:1045
bool containsRawData(const uint16_t index=0) const
Check if data item contains Raw Data.
Definition: cmtpacket.cpp:570
CmtVector getCalAcc(const uint16_t index=0) const
Return the Calibrated Accelerometer component of a data item.
Definition: cmtpacket.cpp:715
CmtAnalogInData getAnalogIn1(const uint16_t index=0) const
Return the AnalogIn 1 component of a data item.
Definition: cmtpacket.cpp:1011
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: glext.h:3520
CmtCalData getCalData(const uint16_t index=0) const
Return the Calibrated Data component of a data item.
Definition: cmtpacket.cpp:832
CmtShortVector getRawMag(const uint16_t index=0) const
Return the Raw Magnetometer component of a data item.
Definition: cmtpacket.cpp:487
Class for storing a single message.
Definition: cmtmessage.h:76
bool updateRawGyr(const CmtShortVector &vec, const uint16_t index=0)
Add/update Raw Gyroscope data for the item.
Definition: cmtpacket.cpp:468
uint64_t CmtOutputSettings
An output settings bit-field.
Definition: cmtdef.h:897
void operator=(const Packet &pack)
Definition: cmtpacket.cpp:1276
CmtEuler getOriEuler(const uint16_t index=0) const
Return the Orientation component of a data item as Euler angles.
Definition: cmtpacket.cpp:918
Message m_msg
The message.
Definition: cmtpacket.h:72
bool updateStatus(const uint8_t data, const uint16_t index=0)
Add/update Status information for the item.
Definition: cmtpacket.cpp:1172
uint8_t getStatus(const uint16_t index=0) const
Return the Status component of a data item.
Definition: cmtpacket.cpp:1158



Page generated by Doxygen 1.8.14 for MRPT 1.5.9 Git: 690a4699f Wed Apr 15 19:29:53 2020 +0200 at miƩ abr 15 19:30:12 CEST 2020