VectorNav C++ Library
compositedata.h
1 #ifndef _VNSENSORS_COMPOSITEDATA_H_
2 #define _VNSENSORS_COMPOSITEDATA_H_
3 
4 #include <vector>
5 
6 #include "vn/export.h"
7 #include "vn/packet.h"
8 #include "vn/attitude.h"
9 #include "vn/position.h"
10 
11 namespace vn {
12 namespace sensors {
13 
15 class vn_proglib_DLLEXPORT CompositeData
16 {
17 public:
18 
19  CompositeData();
20  CompositeData(const CompositeData& cd);
21 
22  ~CompositeData();
23 
24  CompositeData& operator=(const CompositeData& RHS);
25 
30  static CompositeData parse(protocol::uart::Packet& p);
31 
36  static void parse(protocol::uart::Packet& p, CompositeData& o);
37 
42  static void parse(protocol::uart::Packet& p, std::vector<CompositeData*>& o);
43 
45  void reset();
46 
49  bool hasAnyAttitude();
50 
58  math::AttitudeF anyAttitude();
59 
62  bool hasYawPitchRoll();
63 
67  math::vec3f yawPitchRoll();
68 
71  bool hasQuaternion();
72 
76  math::vec4f quaternion();
77 
80  bool hasDirectionCosineMatrix();
81 
85  math::mat3f directionCosineMatrix();
86 
89  bool hasAnyMagnetic();
90 
98  math::vec3f anyMagnetic();
99 
102  bool hasMagnetic();
103 
107  math::vec3f magnetic();
108 
111  bool hasMagneticUncompensated();
112 
116  math::vec3f magneticUncompensated();
117 
120  bool hasMagneticNed();
121 
125  math::vec3f magneticNed();
126 
129  bool hasMagneticEcef();
130 
134  math::vec3f magneticEcef();
135 
136 
139  bool hasAnyAcceleration();
140 
146  math::vec3f anyAcceleration();
147 
150  bool hasAcceleration();
151 
155  math::vec3f acceleration();
156 
159  bool hasAccelerationLinearBody();
160 
164  math::vec3f accelerationLinearBody();
165 
168  bool hasAccelerationUncompensated();
169 
173  math::vec3f accelerationUncompensated();
174 
177  bool hasAccelerationLinearNed();
178 
182  math::vec3f accelerationLinearNed();
183 
186  bool hasAccelerationLinearEcef();
187 
191  math::vec3f accelerationLinearEcef();
192 
195  bool hasAccelerationNed();
196 
200  math::vec3f accelerationNed();
201 
204  bool hasAccelerationEcef();
205 
209  math::vec3f accelerationEcef();
210 
211 
214  bool hasAnyAngularRate();
215 
221  math::vec3f anyAngularRate();
222 
225  bool hasAngularRate();
226 
230  math::vec3f angularRate();
231 
234  bool hasAngularRateUncompensated();
235 
239  math::vec3f angularRateUncompensated();
240 
241 
244  bool hasAnyTemperature();
245 
251  float anyTemperature();
252 
255  bool hasTemperature();
256 
260  float temperature();
261 
262 
265  bool hasAnyPressure();
266 
272  float anyPressure();
273 
276  bool hasPressure();
277 
281  float pressure();
282 
285  bool hasAnyPosition();
286 
292  math::PositionD anyPosition();
293 
296  bool hasPositionGpsLla();
297 
301  math::vec3d positionGpsLla();
302 
305  bool hasPositionGpsEcef();
306 
310  math::vec3d positionGpsEcef();
311 
314  bool hasPositionEstimatedLla();
315 
319  math::vec3d positionEstimatedLla();
320 
323  bool hasPositionEstimatedEcef();
324 
328  math::vec3d positionEstimatedEcef();
329 
332  bool hasAnyVelocity();
333 
339  math::vec3f anyVelocity();
340 
343  bool hasVelocityGpsNed();
344 
348  math::vec3f velocityGpsNed();
349 
352  bool hasVelocityGpsEcef();
353 
357  math::vec3f velocityGpsEcef();
358 
361  bool hasVelocityEstimatedNed();
362 
366  math::vec3f velocityEstimatedNed();
367 
370  bool hasVelocityEstimatedEcef();
371 
375  math::vec3f velocityEstimatedEcef();
376 
379  bool hasVelocityEstimatedBody();
380 
384  math::vec3f velocityEstimatedBody();
385 
388  bool hasDeltaTime();
389 
393  float deltaTime();
394 
397  bool hasDeltaTheta();
398 
402  math::vec3f deltaTheta();
403 
406  bool hasDeltaVelocity();
407 
411  math::vec3f deltaVelocity();
412 
415  bool hasTimeStartup();
416 
420  uint64_t timeStartup();
421 
424  bool hasTimeGps();
425 
429  uint64_t timeGps();
430 
433  bool hasTow();
434 
438  double tow();
439 
442  bool hasWeek();
443 
447  uint16_t week();
448 
451  bool hasNumSats();
452 
456  uint8_t numSats();
457 
460  bool hasTimeSyncIn();
461 
465  uint64_t timeSyncIn();
466 
469  bool hasVpeStatus();
470 
474  protocol::uart::VpeStatus vpeStatus();
475 
478  bool hasInsStatus();
479 
483  protocol::uart::InsStatus insStatus();
484 
487  bool hasSyncInCnt();
488 
492  uint32_t syncInCnt();
493 
496  bool hasTimeGpsPps();
497 
501  uint64_t timeGpsPps();
502 
505  bool hasGpsTow();
506 
510  uint64_t gpsTow();
511 
514  bool hasTimeUtc();
515 
519  protocol::uart::TimeUtc timeUtc();
520 
523  bool hasSensSat();
524 
528  protocol::uart::SensSat sensSat();
529 
532  bool hasFix();
533 
537  protocol::uart::GpsFix fix();
538 
541  bool hasAnyPositionUncertainty();
542 
548  math::vec3f anyPositionUncertainty();
549 
552  bool hasPositionUncertaintyGpsNed();
553 
557  math::vec3f positionUncertaintyGpsNed();
558 
561  bool hasPositionUncertaintyGpsEcef();
562 
566  math::vec3f positionUncertaintyGpsEcef();
567 
570  bool hasPositionUncertaintyEstimated();
571 
575  float positionUncertaintyEstimated();
576 
579  bool hasAnyVelocityUncertainty();
580 
586  float anyVelocityUncertainty();
587 
590  bool hasVelocityUncertaintyGps();
591 
595  float velocityUncertaintyGps();
596 
599  bool hasVelocityUncertaintyEstimated();
600 
604  float velocityUncertaintyEstimated();
605 
608  bool hasTimeUncertainty();
609 
613  uint32_t timeUncertainty();
614 
617  bool hasAttitudeUncertainty();
618 
622  math::vec3f attitudeUncertainty();
623 
626  bool hasCourseOverGround();
627 
632  float courseOverGround();
633 
636  bool hasSpeedOverGround();
637 
642  float speedOverGround();
643 
644 
645 
646 private:
647  static void parseBinary(protocol::uart::Packet& p, std::vector<CompositeData*>& o);
648  static void parseAscii(protocol::uart::Packet& p, std::vector<CompositeData*>& o);
649  static void parseBinaryPacketCommonGroup(protocol::uart::Packet& p, protocol::uart::CommonGroup gf, std::vector<CompositeData*>& o);
650  static void parseBinaryPacketTimeGroup(protocol::uart::Packet& p, protocol::uart::TimeGroup gf, std::vector<CompositeData*>& o);
651  static void parseBinaryPacketImuGroup(protocol::uart::Packet& p, protocol::uart::ImuGroup gf, std::vector<CompositeData*>& o);
652  static void parseBinaryPacketGpsGroup(protocol::uart::Packet& p, protocol::uart::GpsGroup gf, std::vector<CompositeData*>& o);
653  static void parseBinaryPacketAttitudeGroup(protocol::uart::Packet& p, protocol::uart::AttitudeGroup gf, std::vector<CompositeData*>& o);
654  static void parseBinaryPacketInsGroup(protocol::uart::Packet& p, protocol::uart::InsGroup gf, std::vector<CompositeData*>& o);
655 
656 private:
657  struct Impl;
658  Impl* _i;
659 
660  template<typename T>
661  static void setValues(T val, std::vector<CompositeData*>& o, void (Impl::* function)(T))
662  {
663  for (std::vector<CompositeData*>::iterator i = o.begin(); i != o.end(); ++i)
664  (*((*i)->_i).*function)(val);
665  }
666 };
667 
668 
669 
670 }
671 }
672 
673 #endif
Template for a Euclidean vector.
Definition: vector.h:22
Composite structure of all data types available from VectorNav sensors.
Definition: compositedata.h:15
Template for a matrix.
Definition: matrix.h:20
Representation of a position/location.
Definition: position.h:10
Definition: attitude.h:8
UTC time as represented by the VectorNav sensor.
Definition: types.h:550
Status indicators for VPE.
Definition: types.h:499
Structure representing a UART packet received from the VectorNav sensor.
Definition: packet.h:16
Representation of an orientation/attitude.
Definition: attitude.h:12