Ocean
PositionTracker3DOF.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_POSITION_TRACKER_3DOF_H
9 #define META_OCEAN_DEVICES_POSITION_TRACKER_3DOF_H
10 
11 #include "ocean/devices/Devices.h"
12 #include "ocean/devices/Tracker.h"
13 
14 #include "ocean/math/Vector3.h"
15 
16 namespace Ocean
17 {
18 
19 namespace Devices
20 {
21 
22 // Forward declaration.
23 class PositionTracker3DOF;
24 
25 /**
26  * Definition of a smart object reference for a 3DOF position tracker.
27  * @see PositionTracker3DOF.
28  * @ingroup devices
29  */
31 
32 /**
33  * This class is the base class for all 3DOF position trackers.
34  * @ingroup devices
35  */
36 class OCEAN_DEVICES_EXPORT PositionTracker3DOF : virtual public Tracker
37 {
38  public:
39 
40  /**
41  * Definition of a sample holding 3DOF position measurements.
42  */
43  class OCEAN_DEVICES_EXPORT PositionTracker3DOFSample : virtual public Tracker::TrackerSample
44  {
45  public:
46 
47  /**
48  * Definition of a vector holding position values.
49  */
50  typedef std::vector<Vector3> Positions;
51 
52  public:
53 
54  /**
55  * Creates a new 3DOF position sample.
56  * @param timestamp Sample timestamp
57  * @param referenceSystem Tracking reference system used by the underlying tracker
58  * @param objectIds Measurement unit object ids each id corresponds to a different position measurement
59  * @param positions Sample position measurements in meter
60  * @param metadata Optional metadata of the new sample
61  */
62  PositionTracker3DOFSample(const Timestamp& timestamp, const ReferenceSystem referenceSystem, const ObjectIds& objectIds, const Positions& positions, const Metadata& metadata = Metadata());
63 
64  /**
65  * Creates a new 3DOF position sample.
66  * @param timestamp Sample timestamp
67  * @param referenceSystem Tracking reference system used by the underlying tracker
68  * @param objectIds Measurement unit object ids each id corresponds to a different position measurement
69  * @param positions Sample position measurements in meter
70  * @param metadata Optional metadata of the new sample
71  */
72  PositionTracker3DOFSample(const Timestamp& timestamp, const ReferenceSystem referenceSystem, ObjectIds&& objectIds, Positions&& positions, Metadata&& metadata = Metadata());
73 
74  /**
75  * Returns all 3DOF position measurement values.
76  * Each 3DOF measurement corresponds to a different object id.
77  * @return Position measurement value in meter
78  */
79  inline const Positions& positions() const;
80 
81  protected:
82 
83  /// position measurement values stored in meter.
85  };
86 
87  /**
88  * Definition of a smart object reference for 3DOF position tracker samples.
89  */
91 
92  public:
93 
94  /**
95  * Returns the device type of this tracker.
96  * @return Device type
97  */
98  static inline DeviceType deviceTypePositionTracker3DOF();
99 
100  protected:
101 
102  /**
103  * Creates a new 3DOF position tracker object.
104  * @param name The name of the position tracker, must be valid
105  */
106  explicit PositionTracker3DOF(const std::string& name);
107 
108  /**
109  * Destructs a 3DOF position tracker object.
110  */
112 };
113 
115 {
117 }
118 
120 {
121  return positions_;
122 }
123 
124 }
125 
126 }
127 
128 #endif // META_OCEAN_DEVICES_POSITION_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 position measurements.
Definition: PositionTracker3DOF.h:44
Positions positions_
position measurement values stored in meter.
Definition: PositionTracker3DOF.h:84
std::vector< Vector3 > Positions
Definition of a vector holding position values.
Definition: PositionTracker3DOF.h:50
const Positions & positions() const
Returns all 3DOF position measurement values.
Definition: PositionTracker3DOF.h:119
PositionTracker3DOFSample(const Timestamp &timestamp, const ReferenceSystem referenceSystem, ObjectIds &&objectIds, Positions &&positions, Metadata &&metadata=Metadata())
Creates a new 3DOF position sample.
PositionTracker3DOFSample(const Timestamp &timestamp, const ReferenceSystem referenceSystem, const ObjectIds &objectIds, const Positions &positions, const Metadata &metadata=Metadata())
Creates a new 3DOF position sample.
This class is the base class for all 3DOF position trackers.
Definition: PositionTracker3DOF.h:37
static DeviceType deviceTypePositionTracker3DOF()
Returns the device type of this tracker.
Definition: PositionTracker3DOF.h:114
SmartObjectRef< PositionTracker3DOFSample, Sample > PositionTracker3DOFSampleRef
Definition of a smart object reference for 3DOF position tracker samples.
Definition: PositionTracker3DOF.h:90
PositionTracker3DOF(const std::string &name)
Creates a new 3DOF position tracker object.
~PositionTracker3DOF() override
Destructs a 3DOF position tracker object.
This class implements a smart device reference.
Definition: DeviceRef.h:36
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_POSITION_3DOF
3DOF position tracker.
Definition: devices/Tracker.h:52
ReferenceSystem
Definition of different tracking reference system.
Definition: devices/Tracker.h:72
This template class implements a smart object reference which is a specialization of an ObjectRef obj...
Definition: SmartObjectRef.h:90
This class implements a timestamp.
Definition: Timestamp.h:36
SmartDeviceRef< PositionTracker3DOF > PositionTracker3DOFRef
Definition of a smart object reference for a 3DOF position tracker.
Definition: PositionTracker3DOF.h:23
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15