Ocean
AndroidOrientationTracker3DOF.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_ANDROID_ANDROID_ORIENTATION_TRACKER_3_DOF_H
9 #define META_OCEAN_DEVICES_ANDROID_ANDROID_ORIENTATION_TRACKER_3_DOF_H
10 
13 
15 
16 namespace Ocean
17 {
18 
19 namespace Devices
20 {
21 
22 namespace Android
23 {
24 
25 /**
26  * This class implements a 3DOF orientation tracker.
27  * The resulting transformation (3DOF orientation) is defined w.r.t. the world coordinate system.<br>
28  * That means the transformation will transform points defined in the coordinate system of the device into points defined in the world coordinate system (pointWorld = wTd * pointDevice).<br>
29  * When holding the device (in portrait mode), the x-axis points towards the right of the device, the y-axis points upwards, and the z-axis points towards the user:<br>
30  * <pre>
31  * device top
32  * ...........................
33  * . .
34  * . ^ .
35  * . Y | .
36  * . | .
37  * . | .
38  * . O ---------> .
39  * . / X .
40  * . / Z .
41  * . v .
42  * . .
43  * ...........................
44  * . home button .
45  * ...........................
46  * device bottom
47  * </pre>
48  * The x-axis and y-axis of the world coordinate system will be arbitrary.<br>
49  * The negative z-axis of the world coordinate system will always point towards the ground (the negative z-axis is identical with the gravity vector).
50  *
51  * Beware: The coordinate system of the camera may be different from the coordinate system of the device.<br>
52  * E.g., the image of an iPhone camera is commonly located in the upper right corner of the device,<br>
53  * with horizontal image axis pointing to the bottom of the device (along the negative y-axis of the device),
54  * and with vertical image axis pointing to the left of the device (along the negative x-axis of the device).
55  * @ingroup devicesandroid
56  */
57 class OCEAN_DEVICES_EXPORT AndroidOrientationTracker3DOF :
58  virtual public AndroidSensor,
59  virtual public OrientationTracker3DOF
60 {
61  friend class AndroidFactory;
62 
63  public:
64 
65  /**
66  * Returns the name of this tracker.
67  * @return The tracker's name
68  */
69  static inline std::string deviceNameAndroidOrientationTracker3DOF();
70 
71  protected:
72 
73  /**
74  * Creates a new 3DOF orientation tracker device.
75  * @param sensor The Android sensor providing the sensor measurements, must be valid
76  */
77  explicit AndroidOrientationTracker3DOF(const ASensor* sensor);
78 
79  /**
80  * Destructs a 3DOF orientation tracker device.
81  */
83 
84  /**
85  * The actual event function of this device.
86  * @see AndroidDevice::onEventFunction().
87  */
88  int onEventFunction() override;
89 
90  protected:
91 
92  /// The Android event timestamp of the first sensor event.
93  int64_t firstAndroidEventTimestamp_ = 0ll;
94 
95  /// The Unix event timestamp of the first sensor event.
96  Timestamp firstUnixEventTimestamp_ = Timestamp(false);
97 };
98 
100 {
101  return std::string("Android 3DOF Orientation Tracker");
102 }
103 
104 }
105 
106 }
107 
108 }
109 
110 #endif // META_OCEAN_DEVICES_ANDROID_ANDROID_ORIENTATION_TRACKER_3_DOF_H
This class implements a device factory for the Android feature based tracking system.
Definition: AndroidFactory.h:31
This class implements a 3DOF orientation tracker.
Definition: AndroidOrientationTracker3DOF.h:60
int onEventFunction() override
The actual event function of this device.
static std::string deviceNameAndroidOrientationTracker3DOF()
Returns the name of this tracker.
Definition: AndroidOrientationTracker3DOF.h:99
AndroidOrientationTracker3DOF(const ASensor *sensor)
Creates a new 3DOF orientation tracker device.
~AndroidOrientationTracker3DOF() override
Destructs a 3DOF orientation tracker device.
This class implements a sensor for the Android library.
Definition: AndroidSensor.h:41
This class is the base class for all 3DOF orientation tracker objects.
Definition: OrientationTracker3DOF.h:38
This class implements a timestamp.
Definition: Timestamp.h:36
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15