Ocean
OrientationTracker3DOF.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 #ifndef META_OCEAN_DEVICES_ORIENTATION_TRACKER_3DOF_H
9 #define META_OCEAN_DEVICES_ORIENTATION_TRACKER_3DOF_H
10 
11 #include "ocean/devices/Devices.h"
13 #include "ocean/devices/Tracker.h"
14 
15 #include "ocean/math/Quaternion.h"
16 
17 namespace Ocean
18 {
19 
20 namespace Devices
21 {
22 
23 // Forward declaration.
24 class OrientationTracker3DOF;
25 
26 /**
27  * Definition of a 3DOF orientation tracker reference object.
28  * @see OrientationTracker3DOF.
29  * @ingroup devices
30  */
32 
33 /**
34  * This class is the base class for all 3DOF orientation tracker objects.
35  * @ingroup devices
36  */
37 class OCEAN_DEVICES_EXPORT OrientationTracker3DOF : virtual public Tracker
38 {
39  public:
40 
41  /**
42  * Definition of a sample holding 3DOF orientation measurements.
43  */
44  class OCEAN_DEVICES_EXPORT OrientationTracker3DOFSample : virtual public TrackerSample
45  {
46  public:
47 
48  /**
49  * Definition of a vector holding orientation values.
50  */
51  typedef std::vector<Quaternion> Orientations;
52 
53  public:
54 
55  /**
56  * Creates a new 3DOF orientation sample.
57  * @param timestamp Sample timestamp
58  * @param referenceSystem Tracking reference system used by the underlying tracker
59  * @param objectIds Measurement unit object ids each id corresponds to a different orientation measurement
60  * @param orientations Sample orientation measurements
61  * @param metadata Optional metadata of the new sample
62  */
63  OrientationTracker3DOFSample(const Timestamp& timestamp, const ReferenceSystem referenceSystem, const ObjectIds& objectIds, const Orientations& orientations, const Metadata& metadata = Metadata());
64 
65  /**
66  * Creates a new 3DOF orientation sample.
67  * @param timestamp Sample timestamp
68  * @param referenceSystem Tracking reference system used by the underlying tracker
69  * @param objectIds Measurement unit object ids each id corresponds to a different orientation measurement
70  * @param orientations Sample orientation measurements
71  * @param metadata Optional metadata of the new sample
72  */
73  OrientationTracker3DOFSample(const Timestamp& timestamp, const ReferenceSystem referenceSystem, ObjectIds&& objectIds, Orientations&& orientations, Metadata&& metadata = Metadata());
74 
75  /**
76  * Returns the 3DOF orientation measurement values.
77  * Each 3DOF measurement corresponds to a different object id.
78  * @return Orientation measurement values as quaternion
79  */
80  inline const Orientations& orientations() const;
81 
82  protected:
83 
84  /// Orientation measurement values stored as unit quaternion.
86  };
87 
88  /**
89  * Definition of a smart object reference for 3DOF orientation tracker samples.
90  */
92 
93  public:
94 
95  /**
96  * Return the device type of this tracker.
97  * @return Device type
98  */
99  static inline DeviceType deviceTypeOrientationTracker3DOF();
100 
101  protected:
102 
103  /**
104  * Creates a new 3DOF orientation tracker object.
105  * @param name The name of the orientation tracker, must be valid
106  */
107  explicit OrientationTracker3DOF(const std::string& name);
108 
109  /**
110  * Destructs a 3DOF orientation tracker.
111  */
113 };
114 
116 {
118 }
119 
121 {
122  return orientations_;
123 }
124 
125 }
126 
127 }
128 
129 #endif // META_OCEAN_DEVICES_ORIENTATION_TRACKER_3DOF_H
Definition of a class holding the major and minor device type.
Definition: devices/Device.h:62
@ DEVICE_TRACKER
Tracker device.
Definition: devices/Device.h:46
std::unordered_map< std::string, Value > Metadata
Definition of an unordered map mapping keys to values.
Definition: Measurement.h:61
std::vector< ObjectId > ObjectIds
Definition of a vector holding object ids.
Definition: Measurement.h:51
Definition of a sample holding 3DOF orientation measurements.
Definition: OrientationTracker3DOF.h:45
OrientationTracker3DOFSample(const Timestamp &timestamp, const ReferenceSystem referenceSystem, const ObjectIds &objectIds, const Orientations &orientations, const Metadata &metadata=Metadata())
Creates a new 3DOF orientation sample.
const Orientations & orientations() const
Returns the 3DOF orientation measurement values.
Definition: OrientationTracker3DOF.h:120
OrientationTracker3DOFSample(const Timestamp &timestamp, const ReferenceSystem referenceSystem, ObjectIds &&objectIds, Orientations &&orientations, Metadata &&metadata=Metadata())
Creates a new 3DOF orientation sample.
std::vector< Quaternion > Orientations
Definition of a vector holding orientation values.
Definition: OrientationTracker3DOF.h:51
Orientations orientations_
Orientation measurement values stored as unit quaternion.
Definition: OrientationTracker3DOF.h:85
This class is the base class for all 3DOF orientation tracker objects.
Definition: OrientationTracker3DOF.h:38
OrientationTracker3DOF(const std::string &name)
Creates a new 3DOF orientation tracker object.
static DeviceType deviceTypeOrientationTracker3DOF()
Return the device type of this tracker.
Definition: OrientationTracker3DOF.h:115
~OrientationTracker3DOF() override
Destructs a 3DOF orientation tracker.
SmartObjectRef< OrientationTracker3DOFSample, Sample > OrientationTracker3DOFSampleRef
Definition of a smart object reference for 3DOF orientation tracker samples.
Definition: OrientationTracker3DOF.h:91
Definition of a sample holding one measurement values of a tracker.
Definition: devices/Tracker.h:88
This class implements the base class for all tracker devices.
Definition: devices/Tracker.h:39
@ TRACKER_ORIENTATION_3DOF
3DOF orientation tracker.
Definition: devices/Tracker.h:50
ReferenceSystem
Definition of different tracking reference system.
Definition: devices/Tracker.h:72
This class implements a timestamp.
Definition: Timestamp.h:36
SmartObjectRef< OrientationTracker3DOF, Device > OrientationTracker3DOFRef
Definition of a 3DOF orientation tracker reference object.
Definition: OrientationTracker3DOF.h:24
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15