Ocean
Loading...
Searching...
No Matches
OnDeviceMapCreatorTracker6DOF.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_MAPBUILDING_ON_DEVICE_MAP_CREATOR_TRACKER_6DOF_H
9#define META_OCEAN_DEVICES_MAPBUILDING_ON_DEVICE_MAP_CREATOR_TRACKER_6DOF_H
10
13
14#include "ocean/base/Thread.h"
15
19
22
24
25namespace Ocean
26{
27
28namespace Devices
29{
30
31namespace MapBuilding
32{
33
34/**
35 * This class implements an On-Device map creator.
36 * @ingroup devicesmapbuilding
37 */
38class OCEAN_DEVICES_MAPBUILDING_EXPORT OnDeviceMapCreatorTracker6DOF :
39 virtual public MapBuildingDevice,
40 virtual public SceneTracker6DOF,
41 virtual public VisualTracker,
42 protected Thread
43{
44 friend class MapBuildingFactory;
45
46 public:
47
48 /**
49 * Returns whether this device is active.
50 * @see Devices::isStarted().
51 */
52 bool isStarted() const override;
53
54 /**
55 * Starts the device.
56 * @see Device::start().
57 */
58 bool start() override;
59
60 /**
61 * Stops the device.
62 * @see Device::stop().
63 */
64 bool stop() override;
65
66 /**
67 * Returns whether a specific object is currently actively tracked by this tracker.
68 * @see Tracker::isObjectTracked().
69 */
70 bool isObjectTracked(const ObjectId& objectId) const override;
71
72 /**
73 * Exports the determined scene elements.
74 * Supported formats: 'ocean_map'
75 * Supported options: empty or 'optimized'
76 * @see SceneTracker6DOF::exportSceneElements().
77 */
78 bool exportSceneElements(const std::string& format, std::ostream& outputStream, const std::string& options = std::string()) const override;
79
80 /**
81 * Returns the name of this tracker.
82 * @return Tracker name
83 */
84 static inline std::string deviceNameOnDeviceMapCreatorTracker6DOF();
85
86 /**
87 * Returns the type of this tracker.
88 * @return Tracker type
89 */
91
92 private:
93
94 /**
95 * Creates a new 6DOF tracker object.
96 */
98
99 /**
100 * Destructs a 6DOF tracker object.
101 */
103
104 /**
105 * Thread function.
106 * @see Thread::threadRun().
107 */
108 void threadRun() override;
109
110 /**
111 * Event function for new tracking samples from the world tracker.
112 * @param measurement The measurement object sending the sample
113 * @param sample The new samples with resulting from world tracker
114 */
115 void onWorldTrackerSample(const Measurement* measurement, const SampleRef& sample);
116
117 private:
118
119 /// The object tracking id of the map.
121
122 /// True, if the map is currently tracked; False, if e.g., the SLAM tracker is failing.
123 bool isMapTracked_ = false;
124
125 /// The world tracker to be used.
127
128 /// The subscription for world tracker sample events.
130
131 /// The camera profile from the tracker's last execution.
133
134 /// The tracking database from the tracker's last execution.
136
137 /// The descriptor map form the tracker's last execution.
138 mutable std::shared_ptr<Tracking::MapBuilding::UnifiedDescriptorMap> lastUnifiedDescriptorMap_;
139
140 /// The recent 3D object points of the current state of the created map.
142
143 /// The recent object point ids of the current state of the created map.
145
146 /// The lock for the recent points.
148};
149
151{
152 return std::string("On-Device Map Creator 6DOF Tracker");
153}
154
159
160}
161
162}
163
164}
165
166#endif // META_OCEAN_DEVICES_MAPBUILDING_ON_DEVICE_MAP_CREATOR_TRACKER_6DOF_H
Definition of a class holding the major and minor device type.
Definition devices/Device.h:62
MapBuildingDevice(const std::string &name, const DeviceType type)
Creates a new device by is name.
SharedAnyCamera lastAnyCamera_
The camera profile from the tracker's last execution.
Definition OnDeviceMapCreatorTracker6DOF.h:132
bool isStarted() const override
Returns whether this device is active.
SampleEventSubscription worldTrackerSampleSubscription_
The subscription for world tracker sample events.
Definition OnDeviceMapCreatorTracker6DOF.h:129
Lock pointLock_
The lock for the recent points.
Definition OnDeviceMapCreatorTracker6DOF.h:147
OnDeviceMapCreatorTracker6DOF()
Creates a new 6DOF tracker object.
~OnDeviceMapCreatorTracker6DOF() override
Destructs a 6DOF tracker object.
ObjectId mapObjectId_
The object tracking id of the map.
Definition OnDeviceMapCreatorTracker6DOF.h:120
Indices64 recentObjectPointIds_
The recent object point ids of the current state of the created map.
Definition OnDeviceMapCreatorTracker6DOF.h:144
Devices::Tracker6DOFRef worldTracker_
The world tracker to be used.
Definition OnDeviceMapCreatorTracker6DOF.h:126
bool isObjectTracked(const ObjectId &objectId) const override
Returns whether a specific object is currently actively tracked by this tracker.
std::shared_ptr< Tracking::MapBuilding::UnifiedDescriptorMap > lastUnifiedDescriptorMap_
The descriptor map form the tracker's last execution.
Definition OnDeviceMapCreatorTracker6DOF.h:138
Tracking::Database lastDatabase_
The tracking database from the tracker's last execution.
Definition OnDeviceMapCreatorTracker6DOF.h:135
static std::string deviceNameOnDeviceMapCreatorTracker6DOF()
Returns the name of this tracker.
Definition OnDeviceMapCreatorTracker6DOF.h:150
void onWorldTrackerSample(const Measurement *measurement, const SampleRef &sample)
Event function for new tracking samples from the world tracker.
Vectors3 recentObjectPoints_
The recent 3D object points of the current state of the created map.
Definition OnDeviceMapCreatorTracker6DOF.h:141
bool exportSceneElements(const std::string &format, std::ostream &outputStream, const std::string &options=std::string()) const override
Exports the determined scene elements.
bool isMapTracked_
True, if the map is currently tracked; False, if e.g., the SLAM tracker is failing.
Definition OnDeviceMapCreatorTracker6DOF.h:123
friend class MapBuildingFactory
Definition OnDeviceMapCreatorTracker6DOF.h:44
static DeviceType deviceTypeOnDeviceMapCreatorTracker6DOF()
Returns the type of this tracker.
Definition OnDeviceMapCreatorTracker6DOF.h:155
This class manages the lifetime of an event subscription for sample events.
Definition Measurement.h:170
ObjectId objectId(const std::string &description) const
Returns the object id for an object description.
virtual SampleRef sample() const
Returns the most recent sample.
static constexpr ObjectId invalidObjectId()
Returns an invalid object id.
Definition Measurement.h:631
ObjectRef< Sample > SampleRef
Definition of an object reference for samples.
Definition Measurement.h:144
uint32_t ObjectId
Definition of an object id.
Definition Measurement.h:47
Measurement(const std::string &name, const DeviceType type)
Creates a new measurement object.
SceneTracker6DOF(const std::string &name)
Creates a new 6-DOF scene tracker object.
static DeviceType deviceTypeTracker6DOF()
Definition of this device type.
Definition Tracker6DOF.h:106
@ TRACKER_VISUAL
Tracker using a visual input for their measurements.
Definition devices/Tracker.h:64
@ SCENE_TRACKER_6DOF
6DOF scene tracker.
Definition devices/Tracker.h:56
VisualTracker(const std::string &name, const DeviceType type)
Creates a new visual tracker object.
This class implements a recursive lock object.
Definition Lock.h:31
Thread(const std::string &name=std::string())
Creates a new thread object.
This class implements a database for 3D object points, 2D image points and 6DOF camera poses.
Definition Database.h:67
std::vector< Index64 > Indices64
Definition of a vector holding 64 bit index values.
Definition Base.h:108
SmartDeviceRef< Tracker6DOF > Tracker6DOFRef
Definition of a smart object reference for a 6DOF tracker.
Definition Tracker6DOF.h:30
std::shared_ptr< AnyCamera > SharedAnyCamera
Definition of a shared pointer holding an AnyCamera object with Scalar precision.
Definition AnyCamera.h:61
std::vector< Vector3 > Vectors3
Definition of a vector holding Vector3 objects.
Definition Vector3.h:65
Namespace of the Devices MapBuilding library.
Definition devices/mapbuilding/jni/JNI.h:22
Namespace of the Devices library.
Definition AccelerationSensor3DOF.h:24
The namespace covering the entire Ocean framework.
Definition Accessor.h:15