Ocean
|
This class implements the base class for all tracker devices. More...
Data Structures | |
class | TrackerObjectEventSubscription |
This class manages the lifetime of an event subscription for tracker object events. More... | |
class | TrackerSample |
Definition of a sample holding one measurement values of a tracker. More... | |
Public Types | |
enum | TrackerType : uint32_t { TRACKER_INVALID = MINOR_INVALID , TRACKER_ORIENTATION_3DOF = (1u << 0u) , TRACKER_POSITION_3DOF = (1u << 1u) , TRACKER_6DOF = TRACKER_ORIENTATION_3DOF | TRACKER_POSITION_3DOF , SCENE_TRACKER_6DOF = (1u << 2u) | TRACKER_6DOF , TRACKER_GPS = (1u << 3u) , TRACKER_MAGNETIC = (1u << 4u) , TRACKER_VISUAL = (1u << 5u) , TRACKER_OBJECT = (1u << 6u) } |
Definition of different minor device types. More... | |
enum | ReferenceSystem { RS_OBJECT_IN_DEVICE , RS_DEVICE_IN_OBJECT } |
Definition of different tracking reference system. More... | |
typedef float | Frequency |
Definition of a tracker frequency in Hz. More... | |
typedef SmartObjectRef< TrackerSample, Sample > | TrackerSampleRef |
Definition of a smart object reference for tracker samples. More... | |
typedef Callback< void, const Tracker *, const bool, const ObjectIdSet &, const Timestamp & > | TrackerObjectCallback |
Definition of a callback function to subscribe for lost and found tracker events. More... | |
Public Types inherited from Ocean::Devices::Measurement | |
enum | InterpolationStrategy { IS_INVALID , IS_TIMESTAMP_NEAREST , IS_TIMESTAMP_INTERPOLATE } |
Definition of individual interpolation strategies for samples. More... | |
typedef unsigned int | ObjectId |
Definition of an object id. More... | |
typedef std::vector< ObjectId > | ObjectIds |
Definition of a vector holding object ids. More... | |
typedef std::unordered_set< ObjectId > | ObjectIdSet |
Definition of an unordered set holding object ids. More... | |
typedef std::unordered_map< std::string, Value > | Metadata |
Definition of an unordered map mapping keys to values. More... | |
typedef ObjectRef< Sample > | SampleRef |
Definition of an object reference for samples. More... | |
typedef Callback< void, const Measurement *, const SampleRef & > | SampleCallback |
Definition of a callback function to subscribe for new measurement sample events. More... | |
Public Types inherited from Ocean::Devices::Device | |
enum | MajorType : uint32_t { DEVICE_INVALID = 0u , DEVICE_MEASUREMENT = (1u << 0u) , DEVICE_SENSOR = (1u << 1u) | DEVICE_MEASUREMENT , DEVICE_TRACKER = (1u << 2u) | DEVICE_MEASUREMENT } |
Definition of all major device types. More... | |
enum | MinorType : uint32_t { MINOR_INVALID = 0u } |
Base definition of a minor type. More... | |
Public Member Functions | |
virtual Frequency | frequency () const |
Returns the frequency of this tracker. More... | |
virtual bool | isObjectTracked (const ObjectId &objectId) const |
Returns whether a specific object is currently actively tracked by this tracker. More... | |
TrackerObjectEventSubscription | subscribeTrackerObjectEvent (TrackerObjectCallback &&callback) |
Subscribes a callback event function for tracker object (found or lost) events. More... | |
virtual HomogenousMatrixD4 | reference () const |
Returns the reference coordinate system of this tracker. More... | |
Public Member Functions inherited from Ocean::Devices::Measurement | |
size_t | sampleCapacity () const |
Returns the capacity of the internal sample container. More... | |
bool | setSampleCapacity (const size_t capacity) |
Sets the capacity of the internal sample container. More... | |
virtual SampleRef | sample () const |
Returns the most recent sample. More... | |
virtual SampleRef | sample (const Timestamp timestamp) const |
Returns the sample with a specific timestamp. More... | |
virtual SampleRef | sample (const Timestamp ×tamp, const InterpolationStrategy interpolationStrategy) const |
Returns the sample best matching with a specified timestamp. More... | |
SampleEventSubscription | subscribeSampleEvent (SampleCallback &&callback) |
Subscribes a callback event function for new measurement sample events. More... | |
ObjectId | objectId (const std::string &description) const |
Returns the object id for an object description. More... | |
Strings | objectDescriptions () const |
Returns descriptions of all objects currently available. More... | |
std::string | objectDescription (const ObjectId objectId) const |
Returns the description of one object of this measurement. More... | |
Public Member Functions inherited from Ocean::Devices::Device | |
const std::string & | name () const |
Returns the name of this device. More... | |
virtual const std::string & | library () const =0 |
Returns the name of the owner library. More... | |
virtual bool | isStarted () const |
Returns whether this device is active. More... | |
bool | isValid () const |
Returns whether this device is valid. More... | |
bool | isExclusive () const |
Returns whether this device can be use exclusively. More... | |
virtual bool | start () |
Starts the device. More... | |
virtual bool | pause () |
Pauses the device. More... | |
virtual bool | stop () |
Stops the device. More... | |
virtual bool | setParameter (const std::string ¶meter, const Value &value) |
Sets an abstract parameter of this device. More... | |
virtual bool | parameter (const std::string ¶meter, Value &value) |
Returns an abstract parameter of this device. More... | |
DeviceType | type () const |
Returns the major and minor type of this device. More... | |
Static Public Member Functions | |
static std::string | translateTrackerType (const TrackerType trackerType) |
Translates the tracker type to a readable string. More... | |
static TrackerType | translateTrackerType (const std::string &trackerType) |
Translates the tracker type from a readable string to a value. More... | |
static constexpr Frequency | unknownFrequency () |
Definition of a constant as unknown frequency. More... | |
Static Public Member Functions inherited from Ocean::Devices::Measurement | |
static constexpr ObjectId | invalidObjectId () |
Returns an invalid object id. More... | |
Static Public Member Functions inherited from Ocean::Devices::Device | |
static std::string | translateMajorType (const MajorType majorType) |
Translates the major devices type to a readable string. More... | |
static MajorType | translateMajorType (const std::string &majorType) |
Translates the major devices type from a readable string to a value. More... | |
Protected Types | |
typedef std::unordered_map< SubscriptionId, TrackerObjectCallback > | TrackerObjectSubscriptionMap |
Definition of a map mapping subscription ids to tracker object event callback functions. More... | |
Protected Types inherited from Ocean::Devices::Measurement | |
typedef std::map< Timestamp, SampleRef > | SampleMap |
Definition of a map holding the most recent samples. More... | |
typedef std::unordered_map< std::string, ObjectId > | ObjectDescriptionToIdMap |
Definition of an unordered map mapping descriptions to unique object ids. More... | |
typedef std::unordered_map< ObjectId, std::string > | ObjectIdToDescriptionMap |
Definition of an unordered map mapping unique object ids to descriptions. More... | |
typedef std::unordered_map< SubscriptionId, SampleCallback > | SampleSubscriptionMap |
Definition of a map mapping subscription ids to event sample callback functions. More... | |
Protected Types inherited from Ocean::Devices::Device | |
typedef unsigned int | SubscriptionId |
Definition of a subscription id for event callbacks. More... | |
Protected Member Functions | |
Tracker (const std::string &name, const DeviceType type) | |
Creates a new tracker object. More... | |
~Tracker () override | |
Destructs a tracker object. More... | |
void | postFoundTrackerObjects (const ObjectIdSet &objectIds, const Timestamp ×tamp) |
Posts a new found tracker objects event. More... | |
void | postLostTrackerObjects (const ObjectIdSet &objectIds, const Timestamp ×tamp) |
Posts a new lost tracker objects event. More... | |
void | unsubscribeTrackerObjectEvent (const SubscriptionId subscriptionId) |
Unsubscribes a tracker object event callback function. More... | |
Protected Member Functions inherited from Ocean::Devices::Measurement | |
Measurement (const std::string &name, const DeviceType type) | |
Creates a new measurement object. More... | |
~Measurement () override | |
Destructs a measurement object. More... | |
void | postNewSample (const SampleRef &newSample) |
Posts a new measurement sample. More... | |
ObjectId | addUniqueObjectId (const std::string &description) |
Creates a unique object id for a new object (e.g., a tracking object like an image, a marker, or a location). More... | |
void | unsubscribeSampleEvent (const SubscriptionId subscriptionId) |
Unsubscribes a sample event callback function. More... | |
Protected Member Functions inherited from Ocean::Devices::Device | |
Device (const Device &device)=delete | |
Disabled copy constructor. More... | |
Device (const std::string &name, const DeviceType type) | |
Creates a new device by is name. More... | |
virtual | ~Device () |
Destructs a device. More... | |
Device & | operator= (const Device &device)=delete |
Disabled copy operator. More... | |
Static Protected Member Functions | |
static ObjectIdSet | determineFoundObjects (const ObjectIdSet &previousObjects, const ObjectIdSet ¤tObjects) |
Determines the ids which were not tracked in the previous iteration but tracked in the current iteration. More... | |
static ObjectIdSet | determineLostObjects (const ObjectIdSet &previousObjects, const ObjectIdSet ¤tObjects) |
Determines the ids which were tracked in the previous iteration but not tracked in the current iteration. More... | |
Static Protected Member Functions inherited from Ocean::Devices::Device | |
static constexpr SubscriptionId | invalidSubscriptionId () |
Returns an invalid subscription id. More... | |
Protected Attributes | |
TrackerObjectSubscriptionMap | trackerObjectSubscriptionMap_ |
Map holding all tracker object event subscriptions. More... | |
SubscriptionId | nextTrackerObjectSubscriptionId_ = SubscriptionId(invalidSubscriptionId() + 1u) |
The subscription id of the next event subscription. More... | |
Protected Attributes inherited from Ocean::Devices::Measurement | |
Lock | samplesLock_ |
Sample lock. More... | |
Lock | subscriptionLock_ |
Subscription lock. More... | |
Protected Attributes inherited from Ocean::Devices::Device | |
std::string | deviceName |
Name of this device. More... | |
DeviceType | deviceType |
Major and minor type of this device. More... | |
bool | deviceIsValid |
Flag determining whether this device is valid. More... | |
Lock | deviceLock |
Device lock. More... | |
This class implements the base class for all tracker devices.
typedef float Ocean::Devices::Tracker::Frequency |
Definition of a tracker frequency in Hz.
typedef Callback<void, const Tracker*, const bool, const ObjectIdSet&, const Timestamp&> Ocean::Devices::Tracker::TrackerObjectCallback |
Definition of a callback function to subscribe for lost and found tracker events.
The first parameter is the tracker producing the event.
The second parameter determines whether a tracker object has been found (true) or lost (false). The third parameter hold the ids of the tracker object. The last parameter hold the event timestamp.
|
protected |
Definition of a map mapping subscription ids to tracker object event callback functions.
Definition of a smart object reference for tracker samples.
Definition of different tracking reference system.
Beware: Both reference systems are mutual inverse.
enum Ocean::Devices::Tracker::TrackerType : uint32_t |
Definition of different minor device types.
Enumerator | |
---|---|
TRACKER_INVALID | Invalid tracker. |
TRACKER_ORIENTATION_3DOF | 3DOF orientation tracker. |
TRACKER_POSITION_3DOF | 3DOF position tracker. |
TRACKER_6DOF | 6DOF orientation and position tracker. |
SCENE_TRACKER_6DOF | 6DOF scene tracker. |
TRACKER_GPS | GPS tracker. |
TRACKER_MAGNETIC | Tracker using a magnetic measurements. |
TRACKER_VISUAL | Tracker using a visual input for their measurements. |
TRACKER_OBJECT | Tracker allowing to register tracking objects at runtime. |
|
protected |
Creates a new tracker object.
name | The name of the tracker, must be valid |
type | Major and minor device type of the device, must be valid |
|
overrideprotected |
Destructs a tracker object.
|
staticprotected |
Determines the ids which were not tracked in the previous iteration but tracked in the current iteration.
previousObjects | The ids of all objects tracked in the previous iteration |
currentObjects | The ids of all objects tracked in the current iteration |
|
staticprotected |
Determines the ids which were tracked in the previous iteration but not tracked in the current iteration.
previousObjects | The ids of all objects tracked in the previous iteration |
currentObjects | The ids of all objects tracked in the current iteration |
|
virtual |
Returns the frequency of this tracker.
|
virtual |
Returns whether a specific object is currently actively tracked by this tracker.
objectId | The id of the object to be checked, must be valid |
Reimplemented in Ocean::Devices::SLAM::SLAMTracker6DOF, Ocean::Devices::RMV::RMVTracker6DOF, Ocean::Devices::Pattern::PatternTracker6DOF, Ocean::Devices::MapBuilding::OnDeviceRelocalizerTracker6DOF, Ocean::Devices::MapBuilding::OnDeviceMapCreatorTracker6DOF, Ocean::Devices::ARKit::AKWorldTracker6DOF, Ocean::Devices::ARKit::AKSceneTracker6DOF, Ocean::Devices::ARKit::AKRoomPlanTracker6DOF, Ocean::Devices::ARKit::AKPlaneTracker6DOF, Ocean::Devices::ARKit::AKGeoAnchorsTracker6DOF, Ocean::Devices::ARKit::AKFaceTracker6DOF, Ocean::Devices::ARKit::AKDepthTracker6DOF, and Ocean::Devices::ARCore::ACDevice.
|
protected |
Posts a new found tracker objects event.
objectIds | The ids of all objects which have been found recently, nothing will be done if empty |
timestamp | Event timestamp |
|
protected |
Posts a new lost tracker objects event.
objectIds | The ids of all objects which have been lost recently, nothing will be done if empty |
timestamp | Event timestamp |
|
virtual |
Returns the reference coordinate system of this tracker.
Whenever a reference coordinate system is defined, all tracker samples are defined in relation to this reference coordinate system.
TrackerObjectEventSubscription Ocean::Devices::Tracker::subscribeTrackerObjectEvent | ( | TrackerObjectCallback && | callback | ) |
Subscribes a callback event function for tracker object (found or lost) events.
Do not subscribe or unsubscribe from inside an event thread.
callback | The callback function receiving the event calls, must be valid |
|
static |
Translates the tracker type from a readable string to a value.
trackerType | The tracker type to translate |
|
static |
Translates the tracker type to a readable string.
trackerType | The tracker type to translate |
|
staticconstexpr |
Definition of a constant as unknown frequency.
|
protected |
Unsubscribes a tracker object event callback function.
subscriptionId | The id of the event subscription to unsubscribe |
|
protected |
The subscription id of the next event subscription.
|
protected |
Map holding all tracker object event subscriptions.