8#ifndef META_OCEAN_DEVICES_ARCORE_AR_SESSION_MANAGER_H
9#define META_OCEAN_DEVICES_ARCORE_AR_SESSION_MANAGER_H
26#include <arcore_c_api.h>
65 using TrackerMap = std::unordered_map<ACDevice*, unsigned int>;
70 using PlaneIdMap = std::unordered_map<ArPlane*, Index32>;
171 using SessionMap = std::unordered_map<std::string, SharedSession>;
176 using TrackerMap = std::unordered_map<ACDevice*, std::string>;
This class implements a device for the ARCore library.
Definition ACDevice.h:36
TrackerCapabilities
Definition of individual capabilities.
Definition ACDevice.h:46
@ TC_INVALID
An invalid capability.
Definition ACDevice.h:48
size_t registeredTrackers()
Returns the number of registered trackers.
TimestampConverter timestampConverter_
The timestamp converter to convert the timestamps of the ARCore frames to unix timestamps.
Definition ARSessionManager.h:157
bool start(ACDevice *tracker)
Starts the session for a given tracker.
ScopedARSession arSession_
The AR Session object.
Definition ARSessionManager.h:142
void update(unsigned int textureId)
Updates the tracker with the most recent tracking results from ARCore.
std::unordered_map< ArPlane *, Index32 > PlaneIdMap
Definition of an unordered map mapping ArPlane objects to ids.
Definition ARSessionManager.h:70
Media::FrameMediumRef frameMedium_
The frame medium object used as input for the tracker.
Definition ARSessionManager.h:145
bool registerTracker(ACDevice *tracker)
Registers a new tracker with this session.
bool pause(ACDevice *tracker)
Pauses the session for a given tracker.
TrackerCapabilities sessionCapabilities_
The capabilities of the session.
Definition ARSessionManager.h:148
bool stop(ACDevice *tracker)
Stops the session for a given tracker.
bool extractPlanes(ArSession *arSession, ArFrame *arFrame, SceneTracker6DOF::SceneElementPlanes::Planes &planes)
Extracts all planes from an ArFrame.
std::unordered_map< ACDevice *, unsigned int > TrackerMap
Definition of an unordered map mapping trackers to running states.
Definition ARSessionManager.h:65
bool unregisterTracker(ACDevice *tracker)
Unregisters a tracker with this session.
PlaneIdMap planeIdMap_
The map mapping planes to ids.
Definition ARSessionManager.h:160
int64_t lastTimestampNs_
The timestamp of the last ARFrame.
Definition ARSessionManager.h:154
Session(const Media::FrameMediumRef &frameMedium)
Creates a new session for a given frame medium.
TrackerMap trackerMap_
The map mapping tracker to running states.
Definition ARSessionManager.h:151
bool registerTracker(ACDevice *tracker, const Media::FrameMediumRef &frameMedium)
Registers a new tracker.
std::shared_ptr< Session > SharedSession
Definition of a shared pointer holding a session.
Definition ARSessionManager.h:166
static Frame extractImage(ArSession *arSession, ArFrame *arFrame, Media::LiveVideo::ControlMode &exposureMode, double &exposureDuration, Media::LiveVideo::ControlMode &isoMode, float &iso, Media::LiveVideo::ControlMode &focusMode, float &focusValue)
Extracts the image from an ArFrame.
ACDevice::TrackerCapabilities TrackerCapabilities
Redefinition of TrackerCapabilities from ACDevice.
Definition ARSessionManager.h:51
friend class ACFactory
Definition ARSessionManager.h:44
bool start(ACDevice *tracker)
Starts the session for a given tracker.
std::unordered_map< std::string, SharedSession > SessionMap
Definition of an unordered map mapping medium urls to sessions.
Definition ARSessionManager.h:171
bool isARCoreAvailable_
True, if ARCore is available on the device.
Definition ARSessionManager.h:284
TrackerMap trackerMap_
The map mapping trackers to medium urls.
Definition ARSessionManager.h:290
static bool extractPointCloud(ArSession *arSession, ArFrame *arFrame, Vectors3 &objectPoints, Indices64 &objectPointIds)
Extracts the point cloud for an ArFrame.
static Frame extractDepth(const ArSession *arSession, const ArFrame *arFrame)
Extracts the depth from an ArFrame.
bool pause(ACDevice *tracker)
Pauses the session for a given tracker.
Lock lock_
The manager's lock.
Definition ARSessionManager.h:293
bool isARCoreAvailable() const
Returns whether ARCore is available on the device.
Definition ARSessionManager.h:296
void update(unsigned int textureId)
Updates the tracker with the most recent tracking results from ARCore.
std::unordered_map< ACDevice *, std::string > TrackerMap
Definition of an unordered map mapping trackers to medium urls.
Definition ARSessionManager.h:176
bool unregisterTracker(ACDevice *tracker)
Unregisters a given tracker.
ARSessionManager()
Creates a new manager.
bool stop(ACDevice *tracker)
Stops the session for a given tracker.
SessionMap sessionMap_
The map mapping medium urls to sessions.
Definition ARSessionManager.h:287
static bool extractPose(ArSession *arSession, ArFrame *arFrame, HomogenousMatrixF4 &world_T_device, SharedAnyCamera &anyCamera)
Extracts the camera pose and camera profile from an ArFrame.
std::vector< Plane > Planes
Definition of a vector holding planes.
Definition SceneTracker6DOF.h:320
This class implements Ocean's image class.
Definition Frame.h:1969
This class implements a recursive lock object.
Definition Lock.h:31
static constexpr T minValue()
Returns the min scalar value.
Definition Numeric.h:3259
This class implements a scoped lock object for recursive lock objects.
Definition Lock.h:147
This class is a helper class allowing to converter timestamps defined in a specific time domain to un...
Definition Timestamp.h:313
@ TD_BOOTTIME
The monotonically increasing time domain defined in nanoseconds, increasing during system sleep,...
Definition Timestamp.h:328
std::vector< Index64 > Indices64
Definition of a vector holding 64 bit index values.
Definition Base.h:108
ScopedARObject< ArSession, ArSession_destroy > ScopedARSession
Definition of a scoped object for ArSession.
Definition ScopedARObject.h:33
std::shared_ptr< AnyCamera > SharedAnyCamera
Definition of a shared pointer holding an AnyCamera object with Scalar precision.
Definition AnyCamera.h:61
HomogenousMatrixT4< float > HomogenousMatrixF4
Instantiation of the HomogenousMatrixT4 template class using a float precision float data type.
Definition HomogenousMatrix4.h:58
std::vector< Vector3 > Vectors3
Definition of a vector holding Vector3 objects.
Definition Vector3.h:65
Namespace of the Devices ARCore library.
Definition ACDepthTracker6DOF.h:23
Namespace of the Devices library.
Definition AccelerationSensor3DOF.h:24
The namespace covering the entire Ocean framework.
Definition Accessor.h:15