Ocean
ACDevice.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_ARCORE_AC_DEVICE_H
9 #define META_OCEAN_DEVICES_ARCORE_AC_DEVICE_H
10 
12 
13 #include "ocean/devices/Device.h"
15 
17 
18 #include <arcore_c_api.h>
19 
20 namespace Ocean
21 {
22 
23 namespace Devices
24 {
25 
26 namespace ARCore
27 {
28 
29 /**
30  * This class implements a device for the ARCore library.
31  * @ingroup devicearcore
32  */
33 class OCEAN_DEVICES_ARCORE_EXPORT ACDevice :
34  virtual public Device,
35  virtual public VisualTracker
36 {
37  friend class ACFactory;
38  friend class ARSessionManager;
39 
40  protected:
41 
42  /**
43  * Definition of individual capabilities.
44  */
45  enum TrackerCapabilities : uint32_t
46  {
47  /// An invalid capability.
48  TC_INVALID = 0u,
49  /// The tracker provides basic SLAM.
50  TC_SLAM = 1u << 0u,
51  /// The tracker provide plane detection.
52  TC_PLANE_DETECTION = 1u << 1u,
53  /// The tracker provides depth information.
54  TC_DEPTH = 1u << 2u
55  };
56 
57  public:
58 
59  /**
60  * Returns the name of the owner library.
61  * @see Device::library().
62  */
63  const std::string& library() const override;
64 
65  /**
66  * Starts the device.
67  * @see Device::start().
68  */
69  bool start() override;
70 
71  /**
72  * Pauses the device.
73  * @see Device::pause().
74  */
75  bool pause() override;
76 
77  /**
78  * Stops the device.
79  * @see Device::stop().
80  */
81  bool stop() override;
82 
83  /**
84  * Sets the multi-view visual input of this tracker.
85  * @see VisualTracker::setInput().
86  */
87  void setInput(Media::FrameMediumRefs&& frameMediums) override;
88 
89  /**
90  * Returns whether a specific object is currently actively tracked by this tracker.
91  * @see Tracker::isObjectTracked().
92  */
93  bool isObjectTracked(const ObjectId& objectId) const override;
94 
95  /**
96  * Returns the capabilities of the tracker necessary for this device.
97  * @return The tracker capabilities
98  */
99  inline TrackerCapabilities trackerCapabilities() const;
100 
101  protected:
102 
103  /**
104  * Creates a new device by is name.
105  * @param trackerCapabilities The capabilities of the tracker necessary for this device
106  * @param name The name of the device
107  * @param type Major and minor device type of the device
108  */
109  ACDevice(const TrackerCapabilities trackerCapabilities, const std::string& name, const DeviceType type);
110 
111  /**
112  * Destructs this tracker.
113  */
114  ~ACDevice() override;
115 
116  protected:
117 
118  /// The capabilities of the tracker for this device.
119  TrackerCapabilities trackerCapabilities_ = TC_INVALID;
120 
121  /// True, if this tracker has been registered with the session mananager.
122  bool hasBeenRegistered_ = false;
123 
124  /// The id of the world object (the world coodinate system).
125  ObjectId worldObjectId_ = invalidObjectId();
126 
127  /// True, if the world is currently tracked.
128  bool worldIsTracked_ = false;
129 };
130 
132 {
133  return trackerCapabilities_;
134 }
135 
136 }
137 
138 }
139 
140 }
141 
142 #endif // META_OCEAN_DEVICES_ARCORE_AC_DEVICE_H
This class implements a device for the ARCore library.
Definition: ACDevice.h:36
TrackerCapabilities
Definition of individual capabilities.
Definition: ACDevice.h:46
bool stop() override
Stops the device.
void setInput(Media::FrameMediumRefs &&frameMediums) override
Sets the multi-view visual input of this tracker.
const std::string & library() const override
Returns the name of the owner library.
TrackerCapabilities trackerCapabilities_
The capabilities of the tracker for this device.
Definition: ACDevice.h:119
bool pause() override
Pauses the device.
bool start() override
Starts the device.
bool isObjectTracked(const ObjectId &objectId) const override
Returns whether a specific object is currently actively tracked by this tracker.
ACDevice(const TrackerCapabilities trackerCapabilities, const std::string &name, const DeviceType type)
Creates a new device by is name.
TrackerCapabilities trackerCapabilities() const
Returns the capabilities of the tracker necessary for this device.
Definition: ACDevice.h:131
~ACDevice() override
Destructs this tracker.
This class implements a device factory for the ARCore tracking library.
Definition: ACFactory.h:29
This class implements a wrapper around the actual ARCore tracker which may be used by several devices...
Definition: ARSessionManager.h:41
Definition of a class holding the major and minor device type.
Definition: devices/Device.h:62
This class is the base class for all devices of any type.
Definition: devices/Device.h:28
unsigned int ObjectId
Definition of an object id.
Definition: Measurement.h:46
This class is the base class for all tracker using visual input to create the tracking results.
Definition: devices/VisualTracker.h:41
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