Ocean
Loading...
Searching...
No Matches
SLAMTracker6DOF.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_SLAM_TRACKER_6DOF_H
9#define META_OCEAN_DEVICES_SLAM_TRACKER_6DOF_H
10
13
14#include "ocean/base/Thread.h"
15
18
20
21namespace Ocean
22{
23
24namespace Devices
25{
26
27namespace SLAM
28{
29
30/**
31 * This class implements an SLAM feature based tracker.
32 * @ingroup devicesslam
33 */
34class OCEAN_DEVICES_SLAM_EXPORT SLAMTracker6DOF :
35 virtual public SLAMDevice,
36 virtual public Tracker6DOF,
37 virtual public VisualTracker,
38 protected Thread
39{
40 friend class SLAMFactory;
41
42 public:
43
44 /**
45 * Returns whether this device is active.
46 * @see Devices::isStarted().
47 */
48 bool isStarted() const override;
49
50 /**
51 * Starts the device.
52 * @see Device::start().
53 */
54 bool start() override;
55
56 /**
57 * Stops the device.
58 * @see Device::stop().
59 */
60 bool stop() override;
61
62 /**
63 * Sets an abstract parameter of this device.
64 * @see Device::setParameter().
65 */
66 bool setParameter(const std::string& parameter, const Value& value) override;
67
68 /**
69 * Returns whether a specific object is currently actively tracked by this tracker.
70 * @see Tracker::isObjectTracked().
71 */
72 bool isObjectTracked(const ObjectId& objectId) const override;
73
74 /**
75 * Returns the name of this tracker.
76 * @return Tracker name
77 */
78 static inline std::string deviceNameSLAMTracker6DOF();
79
80 /**
81 * Returns the type of this tracker.
82 * @return Tracker type
83 */
84 static inline DeviceType deviceTypeSLAMTracker6DOF();
85
86 private:
87
88 /**
89 * Creates a new SLAM feature based 6DOF tracker object.
90 */
92
93 /**
94 * Destructs an SLAM feature based 6DOF tracker object.
95 */
96 ~SLAMTracker6DOF() override;
97
98 /**
99 * Thread function.
100 * @see Thread::threadRun().
101 */
102 void threadRun() override;
103
104 /**
105 * Posts a new camera pose.
106 * @param world_T_camera The camera pose to post, must be valid
107 * @param timestamp The timestamp of the frame to which the pose belongs
108 */
109 void postPose(const HomogenousMatrix4& world_T_camera, const Timestamp& timestamp);
110
111 protected:
112
113 /// The actual implementation of the tracker.
115
116 /// The unique object id of this tracker.
117 ObjectId uniqueObjectId_ = invalidObjectId();
118
119 /// True, if the SLAM tracker is currently actively providing a valid camera pose.
120 std::atomic_bool isObjectTracked_ = false;
121
122 /// The preferred width of the camera frame.
123 unsigned int preferredCameraWidth_ = 0u;
124
125 /// The preferred height of the camera frame.
126 unsigned int preferredCameraHeight_ = 0u;
127};
128
130{
131 return std::string("SLAM Feature Based 6DOF Tracker");
132}
133
138
139}
140
141}
142
143}
144
145#endif // META_OCEAN_DEVICES_SLAM_TRACKER_6DOF_H
Definition of a class holding the major and minor device type.
Definition devices/Device.h:62
uint32_t ObjectId
Definition of an object id.
Definition Measurement.h:47
This class implements a device for the SLAM library.
Definition SLAMDevice.h:29
This class implements a device factory for the SLAM feature based tracking system.
Definition SLAMFactory.h:29
This class implements an SLAM feature based tracker.
Definition SLAMTracker6DOF.h:39
bool stop() override
Stops the device.
bool isStarted() const override
Returns whether this device is active.
static std::string deviceNameSLAMTracker6DOF()
Returns the name of this tracker.
Definition SLAMTracker6DOF.h:129
bool setParameter(const std::string &parameter, const Value &value) override
Sets an abstract parameter of this device.
~SLAMTracker6DOF() override
Destructs an SLAM feature based 6DOF tracker object.
SLAMTracker6DOF()
Creates a new SLAM feature based 6DOF tracker object.
void threadRun() override
Thread function.
void postPose(const HomogenousMatrix4 &world_T_camera, const Timestamp &timestamp)
Posts a new camera pose.
static DeviceType deviceTypeSLAMTracker6DOF()
Returns the type of this tracker.
Definition SLAMTracker6DOF.h:134
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.
Tracking::SLAM::TrackerMono trackerMono_
The actual implementation of the tracker.
Definition SLAMTracker6DOF.h:114
This class implements the base for all 6DOF trackers.
Definition Tracker6DOF.h:39
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
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 thread.
Definition Thread.h:115
This class implements a timestamp.
Definition Timestamp.h:64
This class implements a monocular SLAM tracker.
Definition slam/TrackerMono.h:52
This class implements a type independent value.
Definition Value.h:23
The namespace covering the entire Ocean framework.
Definition Accessor.h:15