Ocean
IOSGravityTracker3DOF.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_IOS_IOS_GRAVITY_TRACKER_3_DOF_H
9 #define META_OCEAN_DEVICES_IOS_IOS_GRAVITY_TRACKER_3_DOF_H
10 
11 #include "ocean/devices/ios/IOS.h"
14 
16 
17 namespace Ocean
18 {
19 
20 namespace Devices
21 {
22 
23 namespace IOS
24 {
25 
26 /**
27  * This class implements a tracker providing the gravity direction as 3-DOF orientation.
28  * The resulting transformation (3DOF orientation) is defined w.r.t. the device's coordinate system and rotates the negative y-axis so that it points towards gravity (the rotated positive y-axis points towards sky).<br>
29  * @ingroup devicesios
30  */
31 class OCEAN_DEVICES_IOS_EXPORT IOSGravityTracker3DOF :
32  virtual public IOSDevice,
33  virtual public OrientationTracker3DOF
34 {
35  friend class IOSFactory;
36 
37  public:
38 
39  /**
40  * Starts the device.
41  * @see Device::start().
42  */
43  bool start() override;
44 
45  /**
46  * Pauses the device.
47  * @see Device::pause().
48  */
49  bool pause() override;
50 
51  /**
52  * Stops the device.
53  * @see Device::stop().
54  */
55  bool stop() override;
56 
57  /**
58  * Returns the name of this sensor.
59  * @return The sensor's name
60  */
61  static inline std::string deviceNameIOSGravityTracker3DOF();
62 
63  protected:
64 
65  /**
66  * Creates a new 3DOF gravity tracker device.
67  */
69 
70  /**
71  * Destructs a 3DOF gravity sensor device.
72  */
74 
75  private:
76 
77  /**
78  * Callback function for obtaining new samples from the device.
79  * @param deviceMotion iOS DeviceMotion readout
80  */
81  void onDeviceMotion(CMDeviceMotion* deviceMotion);
82 
83  private:
84 
85  // Callback id for this tracker.
87 
88  /// The object id of this tracker.
89  ObjectId trackerObjectId_ = invalidObjectId();
90 };
91 
93 {
94  return std::string("IOS 3DOF Gravity Tracker");
95 }
96 
97 }
98 
99 }
100 
101 }
102 
103 #endif // META_OCEAN_DEVICES_IOS_IOS_GRAVITY_TRACKER_3_DOF_H
This class implements a device for the IOS library.
Definition: IOSDevice.h:29
This class implements a device factory for the IOS feature based tracking system.
Definition: IOSFactory.h:29
This class implements a tracker providing the gravity direction as 3-DOF orientation.
Definition: IOSGravityTracker3DOF.h:34
static std::string deviceNameIOSGravityTracker3DOF()
Returns the name of this sensor.
Definition: IOSGravityTracker3DOF.h:92
void onDeviceMotion(CMDeviceMotion *deviceMotion)
Callback function for obtaining new samples from the device.
bool start() override
Starts the device.
IOSGravityTracker3DOF()
Creates a new 3DOF gravity tracker device.
~IOSGravityTracker3DOF() override
Destructs a 3DOF gravity sensor device.
bool pause() override
Pauses the device.
bool stop() override
Stops the device.
static constexpr ListenerId invalidListenerId()
Returns an invalid listener id.
Definition: MotionManager.h:121
unsigned int ListenerId
Definition of a listener id for a registered callbacks.
Definition: MotionManager.h:43
unsigned int ObjectId
Definition of an object id.
Definition: Measurement.h:46
This class is the base class for all 3DOF orientation tracker objects.
Definition: OrientationTracker3DOF.h:38
const ObjectId invalidObjectId
Definition of an invalid object id.
Definition: rendering/Rendering.h:65
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15