TwiceAsNice  2019-02-18
Classes | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
Basda::MoConModuleProfile Class Reference

External MoCon profile: Representation of a trajectory as list of parameterized segments. More...

#include <Profile.h>

Collaboration diagram for Basda::MoConModuleProfile:
Collaboration graph

Classes

struct  Segment
 Single segment of a MoCon profile. More...
 

Public Member Functions

 MoConModuleProfile ()
 Defining the following macro lets the software merge consecutive segments to avoid zero velocities This tries to patch the fact that otherwise the MOCON may (?) create an event that this basda-mocca client software regards as the completion of a trajectory. More...
 
 ~MoConModuleProfile ()
 
void setExternalProfileMaxSamplesPerSegment (unsigned int _maxSamplesPerSegment)
 
void setExternalProfileMinSamplesPerSegment (unsigned int _minSamplesPerSegment)
 
void setExternalProfileFaultTolerance (unsigned int _maxError)
 
unsigned int fitExternalProfile (Nice::Date _date, Nice::I64 _startCycle, std::vector< Nice::PointVar > &_trajectory, double _cycleTime)
 
unsigned int getExternalProfileSize ()
 
void getExternalProfile (int _index, int &_position, int &_velocity, int &_acceleration, int &_jerk, int &_numberOfCycles)
 
std::vector< SegmentgetExternalProfile ()
 
 MoConModuleProfile ()
 
 ~MoConModuleProfile ()
 
void setExternalProfileMaxSamplesPerSegment (unsigned int _maxSamplesPerSegment)
 
void setExternalProfileMinSamplesPerSegment (unsigned int _minSamplesPerSegment)
 
void setExternalProfileFaultTolerance (unsigned int _maxError)
 
unsigned int fitExternalProfile (Nice::Date _date, Nice::I64 _startCycle, std::vector< Nice::PointVar > &_trajectory, double _cycleTime)
 
unsigned int getExternalProfileSize ()
 
void getExternalProfile (int _index, int &_position, int &_velocity, int &_acceleration, int &_jerk, int &_numberOfCycles)
 
std::vector< SegmentgetExternalProfile ()
 

Private Member Functions

void calcMaxDeviation (unsigned int _segmentStart, Segment _segment, double &_position, double &_velocity, double &_acceleration, double &_jerk, int &_numberOfCycles)
 calculates the biggest deviation between the input and fitted trajectory. More...
 
void calcMaxDeviation (unsigned int _segmentStart, Segment _segment, double &_position, double &_velocity, double &_acceleration, double &_jerk, int &_numberOfCycles)
 

Static Private Member Functions

static void basePol3 (const double _x, boost::numeric::ublas::vector< double > &_afunc)
 Basis functions for a degree 3 polynomial. More...
 
static void basePol3 (const double _x, boost::numeric::ublas::vector< double > &_afunc)
 

Private Attributes

std::vector< Nice::PointVarm_trajectory
 Type of a full MoCon trajectory (in steps or counts and cycles) that is to be transfered to a mocon profile. More...
 
std::vector< Segmentm_profile
 The MoCon profile vector consist of segments. More...
 
unsigned int m_faultTolerance
 Fault Tolerance in steps (counts). More...
 
unsigned int m_maxSamplesPerSegment
 The number of points on the trajectory that should be represented by a single polynomial. More...
 
unsigned int m_minSamplesPerSegment
 
double m_deviation
 
double m_maxDeviation
 

Detailed Description

External MoCon profile: Representation of a trajectory as list of parameterized segments.

A MoCon profile uses degree 3 polynomials to describe each segment of a motor trajectory. The Coefficients of the polynomials represent time, position, velocity, acceleration, and jerk.

The time defines when the next trajectory point will be loaded. The position of the next trajectory point have to be the same as the current position point. The next acceleration, velocity and jerk values define the next movement.

The position of the first trajectory point have to be the start position. If it is not the start position the MoCon will do a jump which can introduce errors.

The position value of the next trajectory point must be the same as the current position value. Which means the position value of the next trajectory point defines the current

This class

Todo:

soon: provides a method to change the current trajectory

soon: deals with the UTC start time for the profile. Needed for absolute time trajectories.

A MoCon profile uses degree 3 polynomials to describe each segment of a motor trajectory. The Coefficients of the polynomials represent time, position, velocity, acceleration, and jerk.

The time defines when the next trajectory point will be loaded. The position of the next trajectory point have to be the same as the current position point. The next acceleration, velocity and jerk values define the next movement.

The position of the first trajectory point have to be the start position. If it is not the start position the MoCon will do a jump which can introduce errors.

The position value of the next trajectory point must be the same as the current position value. Which means the position value of the next trajectory point defines the current

This class

Todo:

soon: provides a method to change the current trajectory

soon: deals with the UTC start time for the profile. Needed for absolute time trajectories.

Constructor & Destructor Documentation

◆ MoConModuleProfile() [1/2]

Basda::MoConModuleProfile::MoConModuleProfile ( )

Defining the following macro lets the software merge consecutive segments to avoid zero velocities This tries to patch the fact that otherwise the MOCON may (?) create an event that this basda-mocca client software regards as the completion of a trajectory.

Since
2018-02-07 #define TAN_BASDA_MOCCA_MERGE_ZEROVEL_SEGS

◆ ~MoConModuleProfile() [1/2]

Basda::MoConModuleProfile::~MoConModuleProfile ( )

◆ MoConModuleProfile() [2/2]

Basda::MoConModuleProfile::MoConModuleProfile ( )

◆ ~MoConModuleProfile() [2/2]

Basda::MoConModuleProfile::~MoConModuleProfile ( )

Member Function Documentation

◆ basePol3() [1/2]

void Basda::MoConModuleProfile::basePol3 ( const double  _x,
boost::numeric::ublas::vector< double > &  _afunc 
)
staticprivate

Basis functions for a degree 3 polynomial.

Function provided to the LNMath function lfit within ProfiFit()

Parameters
[in]_xValue onthe abscissa
[out]_afuncreturns a constant 1 for index 0, _x scaled by a factor 2^16 for index 1 and so on.
See also
Nice::Alg::linearFit

◆ basePol3() [2/2]

static void Basda::MoConModuleProfile::basePol3 ( const double  _x,
boost::numeric::ublas::vector< double > &  _afunc 
)
staticprivate

◆ calcMaxDeviation() [1/2]

void Basda::MoConModuleProfile::calcMaxDeviation ( unsigned int  _currentSample,
Segment  _segment,
double &  _position,
double &  _velocity,
double &  _acceleration,
double &  _jerk,
int &  _numberOfCycles 
)
private

calculates the biggest deviation between the input and fitted trajectory.

Calculates also m_deviation, the deviation between fit and requested position at the end of the segment.

◆ calcMaxDeviation() [2/2]

void Basda::MoConModuleProfile::calcMaxDeviation ( unsigned int  _segmentStart,
Segment  _segment,
double &  _position,
double &  _velocity,
double &  _acceleration,
double &  _jerk,
int &  _numberOfCycles 
)
private

◆ fitExternalProfile() [1/2]

unsigned int Basda::MoConModuleProfile::fitExternalProfile ( Nice::Date  _date,
Nice::I64  _startCycle,
std::vector< Nice::PointVar > &  _trajectory,
double  _cycleTime 
)

◆ fitExternalProfile() [2/2]

unsigned int Basda::MoConModuleProfile::fitExternalProfile ( Nice::Date  _date,
Nice::I64  _startCycle,
std::vector< Nice::PointVar > &  _trajectory,
double  _cycleTime 
)

◆ getExternalProfile() [1/4]

void Basda::MoConModuleProfile::getExternalProfile ( int  _index,
int &  _position,
int &  _velocity,
int &  _acceleration,
int &  _jerk,
int &  _numberOfCycles 
)

◆ getExternalProfile() [2/4]

void Basda::MoConModuleProfile::getExternalProfile ( int  _index,
int &  _position,
int &  _velocity,
int &  _acceleration,
int &  _jerk,
int &  _numberOfCycles 
)

◆ getExternalProfile() [3/4]

std::vector< Basda::MoConModuleProfile::Segment > Basda::MoConModuleProfile::getExternalProfile ( )

◆ getExternalProfile() [4/4]

std::vector<Segment> Basda::MoConModuleProfile::getExternalProfile ( )

◆ getExternalProfileSize() [1/2]

unsigned int Basda::MoConModuleProfile::getExternalProfileSize ( )

◆ getExternalProfileSize() [2/2]

unsigned int Basda::MoConModuleProfile::getExternalProfileSize ( )

◆ setExternalProfileFaultTolerance() [1/2]

void Basda::MoConModuleProfile::setExternalProfileFaultTolerance ( unsigned int  _maxError)

◆ setExternalProfileFaultTolerance() [2/2]

void Basda::MoConModuleProfile::setExternalProfileFaultTolerance ( unsigned int  _maxError)

◆ setExternalProfileMaxSamplesPerSegment() [1/2]

void Basda::MoConModuleProfile::setExternalProfileMaxSamplesPerSegment ( unsigned int  _maxSamplesPerSegment)

◆ setExternalProfileMaxSamplesPerSegment() [2/2]

void Basda::MoConModuleProfile::setExternalProfileMaxSamplesPerSegment ( unsigned int  _maxSamplesPerSegment)

◆ setExternalProfileMinSamplesPerSegment() [1/2]

void Basda::MoConModuleProfile::setExternalProfileMinSamplesPerSegment ( unsigned int  _minSamplesPerSegment)

◆ setExternalProfileMinSamplesPerSegment() [2/2]

void Basda::MoConModuleProfile::setExternalProfileMinSamplesPerSegment ( unsigned int  _minSamplesPerSegment)

Member Data Documentation

◆ m_deviation

double Basda::MoConModuleProfile::m_deviation
private

◆ m_faultTolerance

unsigned int Basda::MoConModuleProfile::m_faultTolerance
private

Fault Tolerance in steps (counts).

This is the maximum acceptable deviation of the fitted trajectory from the input trajectory. The deviation is determined for each specified point in the input trajectory.

◆ m_maxDeviation

double Basda::MoConModuleProfile::m_maxDeviation
private

◆ m_maxSamplesPerSegment

unsigned int Basda::MoConModuleProfile::m_maxSamplesPerSegment
private

The number of points on the trajectory that should be represented by a single polynomial.

Each n*samplesPerSegment point will be a knot on the piecewise polynomial The sampling will be reduced, if the fitted polynomial of the corresponding segment cannot be fitted accurately enough.

◆ m_minSamplesPerSegment

unsigned int Basda::MoConModuleProfile::m_minSamplesPerSegment
private

◆ m_profile

std::vector< Segment > Basda::MoConModuleProfile::m_profile
private

The MoCon profile vector consist of segments.

◆ m_trajectory

std::vector< Nice::PointVar > Basda::MoConModuleProfile::m_trajectory
private

Type of a full MoCon trajectory (in steps or counts and cycles) that is to be transfered to a mocon profile.

x is the time in cycles y is the position in counts or steps


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