Ocean
AKWorldTracker6DOF.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_ARKIT_AK_WORLD_TRACKER_6_DOF_H
9 #define META_OCEAN_DEVICES_ARKIT_AK_WORLD_TRACKER_6_DOF_H
10 
13 
16 
17 namespace Ocean
18 {
19 
20 namespace Devices
21 {
22 
23 namespace ARKit
24 {
25 
26 /**
27  * This class implements the 6DOF world tracker.
28  * @ingroup devicesarkit
29  */
30 class OCEAN_DEVICES_ARKIT_EXPORT AKWorldTracker6DOF :
31  virtual public AKDevice,
32  virtual public Tracker6DOF,
33  virtual public VisualTracker
34 {
35  friend class AKFactory;
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  * Sets the multi-view visual input of this tracker.
59  * @see VisualTracker::setInput().
60  */
61  void setInput(Media::FrameMediumRefs&& frameMediums) override;
62 
63  /**
64  * Returns whether a specific object is currently actively tracked by this tracker.
65  * @see Tracker::isObjectTracked().
66  */
67  bool isObjectTracked(const ObjectId& objectId) const override;
68 
69  /**
70  * Event function for a new 6DOF pose.
71  * @param world_T_camera The transformation between camera and world, invalid if unknown/lost
72  * @param timestamp The timestamp of the new transformation
73  * @param arFrame The current ARFRame object containing additional data for the sample, must be valid
74  */
75  API_AVAILABLE(ios(11.0))
76  void onNewSample(const HomogenousMatrix4& world_T_camera, const Timestamp& timestamp, ARFrame* arFrame);
77 
78  /**
79  * Returns the name of this tracker.
80  * @return The trackers's name
81  */
82  static inline std::string deviceNameAKWorldTracker6DOF();
83 
84  /**
85  * Returns the device type of this tracker.
86  * @return The tracker's device type
87  */
88  static inline DeviceType deviceTypeAKWorldTracker6DOF();
89 
90  protected:
91 
92  /**
93  * Creates a new 6DOF world tracker.
94  */
95  explicit AKWorldTracker6DOF();
96 
97  /**
98  * Destructs this 6DOF tracker.
99  */
100  ~AKWorldTracker6DOF() override;
101 
102  protected:
103 
104  /// The unique id for the world object.
105  ObjectId worldObjectId_ = invalidObjectId();
106 
107  /// True, if the tracker has been started.
108  bool isStarted_ = false;
109 
110  /// True, if the world object is currently tracked.
111  bool worldIsTracked_ = false;
112 };
113 
114 inline std::string AKWorldTracker6DOF::deviceNameAKWorldTracker6DOF()
115 {
116  return std::string("ARKit 6DOF World Tracker");
117 }
118 
120 {
121  return DeviceType(deviceTypeTracker6DOF(), TRACKER_VISUAL);
122 }
123 
124 }
125 
126 }
127 
128 }
129 
130 #endif // META_OCEAN_DEVICES_ARKIT_AK_WORLD_TRACKER_6_DOF_H
This class implements a device for the ARKit library.
Definition: AKDevice.h:48
This class implements a device factory for the ARKit tracking library.
Definition: AKFactory.h:32
This class implements the 6DOF world tracker.
Definition: AKWorldTracker6DOF.h:34
void setInput(Media::FrameMediumRefs &&frameMediums) override
Sets the multi-view visual input of this tracker.
bool stop() override
Stops the device.
bool start() override
Starts the device.
bool pause() override
Pauses the device.
static DeviceType deviceTypeAKWorldTracker6DOF()
Returns the device type of this tracker.
Definition: AKWorldTracker6DOF.h:119
API_AVAILABLE(ios(11.0)) void onNewSample(const HomogenousMatrix4 &world_T_camera
Event function for a new 6DOF pose.
bool isObjectTracked(const ObjectId &objectId) const override
Returns whether a specific object is currently actively tracked by this tracker.
Definition of a class holding the major and minor device type.
Definition: devices/Device.h:62
unsigned int ObjectId
Definition of an object id.
Definition: Measurement.h:46
This class implements the base for all 6DOF trackers.
Definition: Tracker6DOF.h:39
This class is the base class for all tracker using visual input to create the tracking results.
Definition: devices/VisualTracker.h:41
This class implements a timestamp.
Definition: Timestamp.h:36
std::vector< FrameMediumRef > FrameMediumRefs
Definition of a vector holding frame medium reference objects.
Definition: FrameMedium.h:46
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