gramods
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
gramods::gmTrack::SampleCollector Class Reference

The SampleCollector is a utility for sampling tracker data. More...

#include <SampleCollector.hh>

Inheritance diagram for gramods::gmTrack::SampleCollector:
Inheritance graph
[legend]
Collaboration diagram for gramods::gmTrack::SampleCollector:
Collaboration graph
[legend]

Public Member Functions

 SampleCollector (Impl *impl=nullptr)
 
void update (clock::time_point time, size_t frame)
 Updates the internal states. More...
 
void setController (std::shared_ptr< Controller > controller)
 Sets the controller to use for reading tracker samples. More...
 
void addTrackerPosition (Eigen::Vector3f p)
 Adds a tracker position. More...
 
void addTrackerOrientation (Eigen::Quaternionf o)
 Adds a tracker orientation. More...
 
void setSamplesPerSecond (float n)
 Sets the frequency at which samples are collected when the controller button is pressed. More...
 
void setWarningThreshold (float d)
 Sets the data offset required to trigger a warning. More...
 
void setInlierThreshold (float r)
 Set the maximum positional distance from the average allowed for a sample to be included in the average. More...
 
void setOrientationWarningThreshold (float d)
 Sets the data offset required to trigger a warning. More...
 
void setOrientationInlierThreshold (float r)
 Set the maximum orientational distance (in radians) from the average allowed for a sample to be included in the average. More...
 
const std::vector< Eigen::Vector3f > & getTrackerPositions () const
 Returns the current list of tracker positions. More...
 
const std::vector< Eigen::Quaternionf > & getTrackerOrientations () const
 Returns the current list of tracker orientations. More...
 
void traverse (Visitor *visitor) override
 Propagates the specified visitor. More...
 
- Public Member Functions inherited from gramods::gmCore::Object
 Object ()
 Initializes internal data. More...
 
virtual ~Object ()
 Cleaning up internal data. More...
 
virtual void initialize ()
 Called to initialize the Object. More...
 
virtual void accept (Visitor *visitor)
 Calls the visitors apply method with this as argument. More...
 
virtual std::string getDefaultKey ()
 Returns the default key for the Object when automatically instantiated in a Configuration, i.e. More...
 
bool isInitialized ()
 Returns true if the Object is initialized. More...
 
- Public Member Functions inherited from gramods::gmCore::Updateable
 Updateable (int priority=0)
 Configures the Updateable properties to the specified priority. More...
 

Static Public Member Functions

static Eigen::Vector3f getAverage (std::vector< Eigen::Vector3f > samples, float *stddev=nullptr, float *maxdev=nullptr, float inlier_dist=-1.f, size_t *inlier_count=nullptr)
 Calculates and returns the average point of a set of samples. More...
 
static Eigen::Quaternionf getAverage (std::vector< Eigen::Quaternionf > samples, float *stddev=nullptr, float *maxdev=nullptr, float inlier_dist=-1.f, size_t *inlier_count=nullptr)
 Calculates and returns the average point of a set of samples. More...
 
- Static Public Member Functions inherited from gramods::gmCore::Updateable
static void updateAll (clock::time_point t=clock::now(), std::optional< size_t > frame=std::nullopt)
 Updates all currently instanciated updateable objects. More...
 

Static Public Attributes

static gramods::gmCore::OFactory::OFactoryInformation _gm_ofi
 

Protected Attributes

std::unique_ptr< Impl_impl
 

Additional Inherited Members

- Public Types inherited from gramods::gmCore::Updateable
typedef std::chrono::steady_clock clock
 

Detailed Description

The SampleCollector is a utility for sampling tracker data.

Member Function Documentation

◆ addTrackerOrientation()

void gramods::gmTrack::SampleCollector::addTrackerOrientation ( Eigen::Quaternionf  o)

Adds a tracker orientation.

XML-attribute: trackerOrientation

◆ addTrackerPosition()

void gramods::gmTrack::SampleCollector::addTrackerPosition ( Eigen::Vector3f  p)

Adds a tracker position.

XML-attribute: trackerPosition

◆ getAverage() [1/2]

Eigen::Quaternionf gramods::gmTrack::SampleCollector::getAverage ( std::vector< Eigen::Quaternionf >  samples,
float *  stddev = nullptr,
float *  maxdev = nullptr,
float  inlier_dist = -1.f,
size_t *  inlier_count = nullptr 
)
static

Calculates and returns the average point of a set of samples.

Optionally also standard deviation and maximum deviation can be estimated (expressed in radians).

Parameters
[in]samplesThe samples to estimate average of
[out]stddevOptional pointer to variable to write standard deviation to
[out]maxdevOptional pointer to variable to write maximum deviation to
[in]inlier_distOptional threshold (in radians) for counting as inlier
[out]inlier_countOptional pointer to variable to write inlier count to

◆ getAverage() [2/2]

Eigen::Vector3f gramods::gmTrack::SampleCollector::getAverage ( std::vector< Eigen::Vector3f >  samples,
float *  stddev = nullptr,
float *  maxdev = nullptr,
float  inlier_dist = -1.f,
size_t *  inlier_count = nullptr 
)
static

Calculates and returns the average point of a set of samples.

Optionally also standard deviation and maximum deviation can be estimated.

Parameters
[in]samplesThe samples to estimate average of
[out]stddevOptional pointer to variable to write standard deviation to
[out]maxdevOptional pointer to variable to write maximum deviation to
[in]inlier_distOptional threshold for counting as inlier
[out]inlier_countOptional pointer to variable to write inlier count to

◆ getTrackerOrientations()

const std::vector< Eigen::Quaternionf > & gramods::gmTrack::SampleCollector::getTrackerOrientations ( ) const

Returns the current list of tracker orientations.

◆ getTrackerPositions()

const std::vector< Eigen::Vector3f > & gramods::gmTrack::SampleCollector::getTrackerPositions ( ) const

Returns the current list of tracker positions.

◆ setController()

void gramods::gmTrack::SampleCollector::setController ( std::shared_ptr< Controller controller)

Sets the controller to use for reading tracker samples.

XML-attribute: controller

◆ setInlierThreshold()

void gramods::gmTrack::SampleCollector::setInlierThreshold ( float  r)

Set the maximum positional distance from the average allowed for a sample to be included in the average.

Default is -1 meaning that all samples are included.

◆ setOrientationInlierThreshold()

void gramods::gmTrack::SampleCollector::setOrientationInlierThreshold ( float  r)

Set the maximum orientational distance (in radians) from the average allowed for a sample to be included in the average.

Default is -1 meaning that all samples are included.

◆ setOrientationWarningThreshold()

void gramods::gmTrack::SampleCollector::setOrientationWarningThreshold ( float  d)

Sets the data offset required to trigger a warning.

Default is π/4 radians.

XML-attribute: orientationWarningThreshold

◆ setSamplesPerSecond()

void gramods::gmTrack::SampleCollector::setSamplesPerSecond ( float  n)

Sets the frequency at which samples are collected when the controller button is pressed.

Default is 1. At most one sample per frame will be used regardless of this value.

XML-attribute: samplesPerSecond

◆ setWarningThreshold()

void gramods::gmTrack::SampleCollector::setWarningThreshold ( float  d)

Sets the data offset required to trigger a warning.

Default is 0.01, i.e. one cm.

XML-attribute: warningThreshold

◆ traverse()

void gramods::gmTrack::SampleCollector::traverse ( Visitor visitor)
overridevirtual

Propagates the specified visitor.

See also
Object::Visitor

Reimplemented from gramods::gmCore::Object.

◆ update()

void gramods::gmTrack::SampleCollector::update ( clock::time_point  time,
size_t  frame 
)
virtual

Updates the internal states.

Automatically called via gmCore::Updateable::updateAll().

Implements gramods::gmCore::Updateable.


The documentation for this class was generated from the following files: