Ocean
OnDeviceRelocalizerTracker6DOF.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_RELOCALIZER_TRACKER_6DOF_H
9 #define META_OCEAN_DEVICES_MAPBUILDING_ON_DEVICE_RELOCALIZER_TRACKER_6DOF_H
10 
13 
14 #include "ocean/base/Thread.h"
15 
19 
21 
22 namespace Ocean
23 {
24 
25 namespace Devices
26 {
27 
28 namespace MapBuilding
29 {
30 
31 /**
32  * This class implements an On-Device Relocalizer based on offline created feature maps.
33  * @ingroup devicesmapbuilding
34  */
35 class OCEAN_DEVICES_MAPBUILDING_EXPORT OnDeviceRelocalizerTracker6DOF :
36  virtual public MapBuildingDevice,
37  virtual public SceneTracker6DOF,
38  virtual public ObjectTracker,
39  virtual public VisualTracker,
40  protected Thread
41 {
42  friend class MapBuildingFactory;
43 
44  public:
45 
46  /**
47  * Adds a new tracking object.
48  * The description must be the url of a file containing the feature map
49  * @see ObjectTracker::registerObject().
50  */
51  ObjectId registerObject(const std::string& description, const Vector3& dimension) override;
52 
53  /**
54  * Returns whether this device is active.
55  * @see Devices::isStarted().
56  */
57  bool isStarted() const override;
58 
59  /**
60  * Starts the device.
61  * @see Device::start().
62  */
63  bool start() override;
64 
65  /**
66  * Stops the device.
67  * @see Device::stop().
68  */
69  bool stop() override;
70 
71  /**
72  * Returns whether a specific object is currently actively tracked by this tracker.
73  * @see Tracker::isObjectTracked().
74  */
75  bool isObjectTracked(const ObjectId& objectId) const override;
76 
77  /**
78  * Returns the name of this tracker.
79  * @return Tracker name
80  */
81  static inline std::string deviceNameOnDeviceRelocalizerTracker6DOF();
82 
83  /**
84  * Returns the type of this tracker.
85  * @return Tracker type
86  */
87  static inline DeviceType deviceTypeOnDeviceRelocalizerTracker6DOF();
88 
89  private:
90 
91  /**
92  * Creates a new 6DOF tracker object.
93  */
95 
96  /**
97  * Destructs a 6DOF tracker object.
98  */
100 
101  /**
102  * Thread function.
103  * @see Thread::threadRun().
104  */
105  void threadRun() override;
106 
107  private:
108 
109  /// The map's unique id.
110  ObjectId mapObjectId_ = invalidObjectId();
111 
112  /// True, if the map is currently tracked.
113  bool isMapTracked_ = false;
114 
115  /// The reusable frame.
117 
118  /// The relocalizer to be used to determine the 6-DOF pose.
120 
121  /// The 3D object points of the relocalizer.
123 
124  /// The ids of the object points of the relocalizer.
126 };
127 
129 {
130  return std::string("On-Device Relocalizer 6DOF Tracker");
131 }
132 
134 {
136 }
137 
138 }
139 
140 }
141 
142 }
143 
144 #endif // META_OCEAN_DEVICES_MAPBUILDING_ON_DEVICE_RELOCALIZER_TRACKER_6DOF_H
Definition of a class holding the major and minor device type.
Definition: devices/Device.h:62
This class implements a base class for all devices of the MapBuilding library.
Definition: MapBuildingDevice.h:29
This class implements a device factory for the MapBuilding feature-based tracking system.
Definition: MapBuildingFactory.h:29
This class implements an On-Device Relocalizer based on offline created feature maps.
Definition: OnDeviceRelocalizerTracker6DOF.h:41
OnDeviceRelocalizerTracker6DOF()
Creates a new 6DOF tracker object.
bool isObjectTracked(const ObjectId &objectId) const override
Returns whether a specific object is currently actively tracked by this tracker.
static std::string deviceNameOnDeviceRelocalizerTracker6DOF()
Returns the name of this tracker.
Definition: OnDeviceRelocalizerTracker6DOF.h:128
Vectors3 objectPoints_
The 3D object points of the relocalizer.
Definition: OnDeviceRelocalizerTracker6DOF.h:122
~OnDeviceRelocalizerTracker6DOF() override
Destructs a 6DOF tracker object.
Tracking::MapBuilding::RelocalizerMono relocalizer_
The relocalizer to be used to determine the 6-DOF pose.
Definition: OnDeviceRelocalizerTracker6DOF.h:119
Indices64 objectPointIds_
The ids of the object points of the relocalizer.
Definition: OnDeviceRelocalizerTracker6DOF.h:125
static DeviceType deviceTypeOnDeviceRelocalizerTracker6DOF()
Returns the type of this tracker.
Definition: OnDeviceRelocalizerTracker6DOF.h:133
ObjectId registerObject(const std::string &description, const Vector3 &dimension) override
Adds a new tracking object.
bool isStarted() const override
Returns whether this device is active.
Frame yFrame_
The reusable frame.
Definition: OnDeviceRelocalizerTracker6DOF.h:116
unsigned int ObjectId
Definition of an object id.
Definition: Measurement.h:46
This class is the base class for all tracker allowing to track an object or location.
Definition: ObjectTracker.h:38
This class implements the base for all 6-DOF scene trackers.
Definition: SceneTracker6DOF.h:42
static DeviceType deviceTypeTracker6DOF()
Definition of this device type.
Definition: Tracker6DOF.h:100
@ TRACKER_VISUAL
Tracker using a visual input for their measurements.
Definition: devices/Tracker.h:62
@ TRACKER_OBJECT
Tracker allowing to register tracking objects at runtime.
Definition: devices/Tracker.h:64
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 Ocean's image class.
Definition: Frame.h:1760
This class implements a thread.
Definition: Thread.h:115
This class implements a relocalizer for mono cameras.
Definition: RelocalizerMono.h:33
std::vector< Index64 > Indices64
Definition of a vector holding 64 bit index values.
Definition: Base.h:108
std::vector< Vector3 > Vectors3
Definition of a vector holding Vector3 objects.
Definition: Vector3.h:65
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