libvisiontransfer  7.0.0
sensordata.h
1 /*******************************************************************************
2  * Copyright (c) 2019 Nerian Vision GmbH
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a copy
5  * of this software and associated documentation files (the "Software"), to deal
6  * in the Software without restriction, including without limitation the rights
7  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8  * copies of the Software, and to permit persons to whom the Software is
9  * furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *******************************************************************************/
14 
15 #ifndef VISIONTRANSFER_SENSORDATA_H
16 #define VISIONTRANSFER_SENSORDATA_H
17 
18 namespace visiontransfer {
19 
23 class SensorRecord {
24 protected:
25  int timestampSec;
26  int timestampUSec;
27  unsigned char status;
28 public:
29  SensorRecord(int timestampSec, int timestampUSec, unsigned char status): timestampSec(timestampSec), timestampUSec(timestampUSec), status(status) {}
30  void getTimestamp(int& s, int& us) const { s = timestampSec; us = timestampUSec; }
31  unsigned char getStatus() const { return status; }
32 };
33 
38 public:
39  double value() const { return valueIntl; }
40  TimestampedScalar(int timestampSec, int timestampUSec, unsigned char status, double value): SensorRecord(timestampSec, timestampUSec, status), valueIntl(value) {}
41  TimestampedScalar(): SensorRecord(0, 0, 0), valueIntl(0) { }
42 private:
43  double valueIntl;
44 };
45 
46 
51 public:
52  double x() const { return xIntl; }
53  double y() const { return yIntl; }
54  double z() const { return zIntl; }
55  TimestampedVector(int timestampSec, int timestampUSec, unsigned char status, double x, double y, double z): SensorRecord(timestampSec, timestampUSec, status), xIntl(x), yIntl(y), zIntl(z) {}
56  TimestampedVector(): SensorRecord(0, 0, 0), xIntl(0), yIntl(0), zIntl(0) { }
57 private:
58  double xIntl, yIntl, zIntl;
59 };
60 
67 public:
68  double i() const { return iIntl; }
69  double j() const { return jIntl; }
70  double k() const { return kIntl; }
71  double r() const { return rIntl; }
72  double accuracy() const { return accuracyIntl; }
73  TimestampedQuaternion(int timestampSec, int timestampUSec, unsigned char status, double i, double j, double k, double r, double accuracy): SensorRecord(timestampSec, timestampUSec, status), iIntl(i), jIntl(j), kIntl(k), rIntl(r), accuracyIntl(accuracy) {}
74  TimestampedQuaternion(): SensorRecord(0, 0, 0), iIntl(0), jIntl(0), kIntl(0), rIntl(0), accuracyIntl(0) { }
75 private:
76  double iIntl, jIntl, kIntl, rIntl;
77  double accuracyIntl;
78 };
79 
80 } // namespace
81 
82 #endif
83 
Base class for sensor records with timestamp and status (reliability) fields.
Definition: sensordata.h:23
Encapsulate a 4D (quaternion) sensor report, containing i, j, k, r, as well as timestamp and status f...
Definition: sensordata.h:66
Encapsulate a scalar sensor measurement, containing the value, as well as timestamp and status fields...
Definition: sensordata.h:37
Encapsulate a 3D sensor report, containing X, Y, Z, as well as timestamp and status fields...
Definition: sensordata.h:50
Nerian Vision Technologies