Reflexxes Motion Libraries
Manual and Documentation (Type II, Version 1.2.6)
|
This class constitutes the user interface of velocity-based the Type II On-Line Trajectory Generation algorithm More...
#include <TypeIIRMLVelocity.h>
Public Member Functions | |
TypeIIRMLVelocity (const unsigned int &DegreesOfFreedom, const double &CycleTimeInSeconds) | |
Constructor of the class TypeIIRMLVelocity. | |
TypeIIRMLVelocity (const TypeIIRMLVelocity &TypeIIRMLObject) | |
Copy constructor of class TypeIIRMLVelocity. | |
~TypeIIRMLVelocity (void) | |
Destructor of the class TypeIIRMLVelocity. | |
TypeIIRMLVelocity & | operator= (const TypeIIRMLVelocity &TypeIIRMLObject) |
Copy operator. | |
int | GetNextStateOfMotion (const RMLVelocityInputParameters &InputValues, RMLVelocityOutputParameters *OutputValues, const RMLVelocityFlags &Flags) |
The main method of the class TypeIIRMLVelocity. It executes the velocity-based Type II On-Line Trajectory Generation algorithm | |
int | GetNextStateOfMotionAtTime (const double &TimeValueInSeconds, RMLVelocityOutputParameters *OutputValues) const |
Once the method of TypeIIRMLVelocity::GetNextStateOfMotion() was successfully called to compute a trajectory, this method can be used to compute a state of motion on this trajectory at a given time instant. | |
Protected Types | |
enum | FunctionResults { FUNC_SUCCESS = false, FUNC_ERROR_OCCURRED = true } |
For class-internal use only: return values of boolean methods. More... | |
Protected Member Functions | |
void | FallBackStrategy (const RMLVelocityInputParameters &InputValues, RMLVelocityOutputParameters *OutputValues) |
In case of an error, this method triggers the next layer of the safety concept. | |
void | CalculateExecutionTimes (void) |
Calculates the minimum execution times and corresponding motion profiles of each selected degree of freedom. | |
void | ComputeTrajectoryParameters (void) |
Computes all trajectory parameters for non- and phase- synchronized trajectories. | |
void | ComputePhaseSynchronizationParameters (void) |
Checks, whether phase-synchronization is possible. If possible the corresponding vectors are computed. | |
void | ComputeTimeSynchronizedTrajectoryParameters (void) |
Computes all trajectory parameters for time-synchronized trajectories. | |
int | ComputeAndSetOutputParameters (const double &TimeValueInSeconds, RMLVelocityOutputParameters *OP) const |
Computes the output values of the velocity-based On-line Trajectory Generation algorithm, that is, the state of motion for the next control cycle. | |
bool | IsPhaseSynchronizationPossible (void) |
Checks, whether the motion trajectory can be phase-synchronized. | |
void | CalculatePositionalExtrems (const double &TimeValueInSeconds, RMLVelocityOutputParameters *OP) const |
Set all positional extremum parameters of the output values of the algorithm (TypeIIRMLVelocity::OutputParameters) | |
void | SetPositionalExtremsToZero (RMLVelocityOutputParameters *OP) const |
Set all positional extremum parameters of the output values of the algorithm (TypeIIRMLVelocity::OutputParameters) to zero. | |
void | SetupPhaseSyncSelectionVector (void) |
Modify the current selection vector and exclude unnecessary degrees of freedom. | |
Protected Attributes | |
bool | CurrentTrajectoryIsPhaseSynchronized |
Indicates, whether the current trajectory is phase-synchronized. | |
bool | CurrentTrajectoryIsNotSynchronized |
Indicates, that the current trajectory is not synchronized. | |
bool | CalculatePositionalExtremsFlag |
Indicates, whether the positional extremes are to be calculated. | |
int | ReturnValue |
Contains the return value of the method TypeIIRMLVelocity::GetNextStateOfMotion() | |
unsigned int | NumberOfDOFs |
The number of degrees of freedom . | |
unsigned int | DOFWithGreatestExecutionTime |
Index of the degree of freedom that requires the greatest execution time. | |
double | CycleTime |
Contains the cycle time in seconds. | |
double | SynchronizationTime |
If the trajectory is time- or phase-synchronized, this attribute will contain the synchronization time . Otherwise,is used for the execution time of the degree of freedom that requires the greatest time. | |
double | InternalClockInSeconds |
In order to prevent from recalculating the trajectory within every control cycle and to safe CPU time, this time value in seconds represents the elapsed time since the last calculation. | |
RMLVelocityFlags | OldFlags |
In order to check, whether a new calculation has to be started, the input values have to be compared to the input and output values of the previous cycle. This variable is used to store the flags of last cycle. | |
RMLBoolVector * | PhaseSyncSelectionVector |
Boolean vector, which contains the modified selection vector that is based on the original selection vector in order to enable numerically robust phase-synchronization. | |
RMLDoubleVector * | ExecutionTimes |
Vector of double values, each of which represents an execution time that is used internally. | |
RMLDoubleVector * | PhaseSynchronizationReferenceVector |
Reference vector for phase-synchronized trajectories, with . | |
RMLDoubleVector * | PhaseSynchronizationCurrentVelocityVector |
Current velocity vector used for the calculation of phase-synchronized motion trajectories. | |
RMLDoubleVector * | PhaseSynchronizationTargetVelocityVector |
Target velocity vector used for the calculation of phase-synchronized motion trajectories. | |
RMLDoubleVector * | PhaseSynchronizationMaxAccelerationVector |
Contains the adapted maximum acceleration vector for phase-synchronized trajectories. | |
RMLVelocityInputParameters * | OldInputParameters |
Pointer to an RMLVelocityInputParameters object. In order to check, whether a new calculation has to be started, the input values have to be compared to the input and output values of the previous cycle. This variable is used to store the old input values. | |
RMLVelocityInputParameters * | CurrentInputParameters |
Pointer to an RMLVelocityInputParameters object. This object contains a complete set of input values . | |
RMLVelocityOutputParameters * | OutputParameters |
Pointer to an RMLVelocityOutputParameters object. This object contains the output parameters of the method TypeIIRMLVelocity::GetNextStateOfMotion(). Besides the new desired state of motion , further complementary values for positional extremes are provided. | |
MotionPolynomials * | Polynomials |
Pointer to an array of MotionPolynomials objects, which contains the actual trajectory . It is a two-dimensional array of polynomial functions. |
This class constitutes the user interface of velocity-based the Type II On-Line Trajectory Generation algorithm
The class has to purposes:
The algorithm is capable to generate phase-synchronized and non-synchronized motions. The only interface for the user application is the method
enum TypeIIRMLVelocity::FunctionResults [protected] |
TypeIIRMLVelocity::TypeIIRMLVelocity | ( | const unsigned int & | DegreesOfFreedom, |
const double & | CycleTimeInSeconds | ||
) |
Constructor of the class TypeIIRMLVelocity.
DegreesOfFreedom | Specifies the number of degrees of freedom |
CycleTimeInSeconds | Specifies the cycle time in seconds |
TypeIIRMLVelocity::TypeIIRMLVelocity | ( | const TypeIIRMLVelocity & | TypeIIRMLObject | ) |
Copy constructor of class TypeIIRMLVelocity.
TypeIIRMLObject | Object to be copied |
Destructor of the class TypeIIRMLVelocity.
void TypeIIRMLVelocity::CalculateExecutionTimes | ( | void | ) | [protected] |
Calculates the minimum execution times and corresponding motion profiles of each selected degree of freedom.
This method selects an velocity profile of the set RMLMath::FinalAccelerationProfilesForVelocityCtrl and computes the minimum execution for each single degree of freedom in seconds and writes the values into the attributes
This computation step is comparable to Step 1 of the position-based On-line Trajectory Generation algorithm.
void TypeIIRMLVelocity::CalculatePositionalExtrems | ( | const double & | TimeValueInSeconds, |
RMLVelocityOutputParameters * | OP | ||
) | const [protected] |
Set all positional extremum parameters of the output values of the algorithm (TypeIIRMLVelocity::OutputParameters)
After all trajectory parameters have been computed in TypeIIRMLVelocity::GetNextStateOfMotion(), they are stored in the attribute TypeIIRMLVelocity::Polynomials. Using this attribute, this method computes all positional extremum values and corresponding states of motion and writes the results to TypeIIRMLVelocity::OutputParameters. In particular, the following values are calculated:
All these values may be used by the user to perform further calculations based on the currently calculated motion trajectory (e.g., a check for workspace boundaries).
TimeValueInSeconds | Time value in seconds, at which the next state of motion is calculated. The positional extremes are calculated with respect to this value. |
OP | Pointer to an object of the class RMLVelocityOutputParameters. The positional extreme values will be calculated for these data. |
false
when the method TypeIIRMLVelocity::GetNextStateOfMotion() is called.int TypeIIRMLVelocity::ComputeAndSetOutputParameters | ( | const double & | TimeValueInSeconds, |
RMLVelocityOutputParameters * | OP | ||
) | const [protected] |
Computes the output values of the velocity-based On-line Trajectory Generation algorithm, that is, the state of motion for the next control cycle.
After either
calculated all coefficients of the polynomials that piecewise describe the desired trajectory, this method computes the actual output values of algorithm, that is, the state of motion at the instant TimeValueInSeconds
(commonly for the next control cycle). This part is the pendent of TypeIIRMLPosition::Step3() in the position-based On-line Trajectory Generation algorithm. The resulting values are written into the object pointed to by OP
(output parameters).
The methods TypeIIRMLVelocity::GetNextStateOfMotion() and TypeIIRMLVelocity::GetNextStateOfMotionAtTime() make use of this functionality.
TimeValueInSeconds | Time value in seconds, at which the desired state of motion is calculated. |
OP | Pointer to an object of the class RMLVelocityOutputParameters, to which the resulting output values will be written to. |
void TypeIIRMLVelocity::ComputePhaseSynchronizationParameters | ( | void | ) | [protected] |
Checks, whether phase-synchronization is possible. If possible the corresponding vectors are computed.
This method checks, whether a phase-synchronized trajectory can be generated. If all input vectors are collinear, it is checks, a homothetic trajectory can be computed that meets all kinematic motion constraints. If this is the case, the constraints will be adapted such that is also collinear to all other input values. This vectors is stored in the attribute
void TypeIIRMLVelocity::ComputeTimeSynchronizedTrajectoryParameters | ( | void | ) | [protected] |
Computes all trajectory parameters for time-synchronized trajectories.
This method computes the coefficients of all pieces of polynomials that are used to represent the trajectory. This part is comparable to Step 2 of the position-based On-Line Trajectory Generation algorithm.
void TypeIIRMLVelocity::ComputeTrajectoryParameters | ( | void | ) | [protected] |
Computes all trajectory parameters for non- and phase- synchronized trajectories.
This method computes the coefficients of all pieces of polynomials that are used to represent the trajectory. This part is comparable to Step 2 of the position-based On-Line Trajectory Generation algorithm. Based on the profile that was determined by the method TypeIIRMLVelocity::CalculateExecutionTimes() (and the change of kinematic motion constraints in case of phase-synchronized trajectories; cf. TypeIIRMLVelocity::ComputePhaseSynchronizationParameters()), the actual parameters are set-up, such that a new state of motion can be computed by calling TypeIIRMLVelocity::ComputeAndSetOutputParameters().
void TypeIIRMLVelocity::FallBackStrategy | ( | const RMLVelocityInputParameters & | InputValues, |
RMLVelocityOutputParameters * | OutputValues | ||
) | [protected] |
In case of an error, this method triggers the next layer of the safety concept.
Depending on how the class TypeIIRMLVelocity is used, two different purposes are achieved by this method.
This method uses the current state of motion and continues the current motion with . Concretely, is calculated this way:
A detailed description of the three-layered safety mechanism of the Reflexxes Motion Libraries can be found at Safety: Three Layers of Error Handling.
InputValues | Current set of input parameters |
OutputValues | Current set of output parameters the will be generated by this method |
int TypeIIRMLVelocity::GetNextStateOfMotion | ( | const RMLVelocityInputParameters & | InputValues, |
RMLVelocityOutputParameters * | OutputValues, | ||
const RMLVelocityFlags & | Flags | ||
) |
The main method of the class TypeIIRMLVelocity. It executes the velocity-based Type II On-Line Trajectory Generation algorithm
Given a set of InputValues
consisting of
and a set of boolean Flags
to control the behavior of the algorithm, this method executes the velocity-based Type II On-Line Trajectory Generation algorithm and provides a set of OutputValues
, which contain
For a detailed description, please refer to TypeIIRMLVelocity and to the start page Start Page.
InputValues | Input values of the velocity-based Type II On-Line Trajectory Generation algorithm. For detailed information, please refer to the class RMLVelocityInputParameters and to the page Description of Input Values. |
OutputValues | Output values of the velocity-based Type II On-Line Trajectory Generation algorithm. For detailed information, please refer to the class RMLVelocityOutputParameters and to the page Description of Output Values. |
Flags | A set of boolean values to configure the behavior of the algorithm (e.g., specify whether a time- or a phase-synchronized trajectory is desired, specify, whether the complementary output values are supposed to be computed). For a detailed description of this data structure and its usage, please refer to RMLVelocityFlags. |
The On-Line Trajectory Generation algorithm is working; the final state of motion has not been reached yet.
The desired final state of motion has been reached.
The applied input values are invalid (cf. RMLPositionInputParameters::CheckForValidity() RMLVelocityInputParameters::CheckForValidity()).
The number of degree of freedom of th input parameters, the output parameters, and the On-Line Trajectory Generation algorithm do not match.
If the input flag RMLFlags::ONLY_PHASE_SYNCHRONIZATION is set and it is not possible to calculate a physically (and mathematically) correct phase-synchronized (i.e., homothetic) trajectory, this error value will be returned. Please note: Even if this error message is returned, feasible, steady, and continuous output values will be computed in any case.
If one of the pointers to objects of the classes
is NULL, this error value will be returned.
int TypeIIRMLVelocity::GetNextStateOfMotionAtTime | ( | const double & | TimeValueInSeconds, |
RMLVelocityOutputParameters * | OutputValues | ||
) | const |
Once the method of TypeIIRMLVelocity::GetNextStateOfMotion() was successfully called to compute a trajectory, this method can be used to compute a state of motion on this trajectory at a given time instant.
After the method GetNextStateOfMotion() was called and no error value was returned (i.e., ReflexxesAPI::RML_WORKING or ReflexxesAPI::RML_FINAL_STATE_REACHED was returned), a trajectory was successfully generated. In order to compute a state of motion of this trajectory at a given time instant, this method can be used. No new calculations are started by calling this method; only the existing result of the method GetNextStateOfMotion() is used. TimeValueInSeconds
specifies the time of the desired state of motion, which is copied to OutputValues (cf. RMLVelocityOutputParameters).
If the method TypeIIRMLVelocity::GetNextStateOfMotion() returned an error, the same error will be returned by this method. The value of TimeValueInSeconds
has to be positive and below the values of RML_MAX_EXECUTION_TIME ( seconds).
For further information, please refer to the documentation of TypeIIRMLVelocity::GetNextStateOfMotion().
TimeValueInSeconds | Time value in seconds, at which the desired state of motion is calculated. |
OutputValues | Output values of the velocity-based Type II On-Line Trajectory Generation algorithm. For detailed information, please refer to the class RMLVelocityOutputParameters and to the page Description of Output Values. |
The On-Line Trajectory Generation algorithm is working; the final state of motion has not been reached yet.
The desired final state of motion has been reached.
The applied input values are invalid (cf. RMLPositionInputParameters::CheckForValidity() RMLVelocityInputParameters::CheckForValidity()).
The number of degree of freedom of th input parameters, the output parameters, and the On-Line Trajectory Generation algorithm do not match.
If the input flag RMLFlags::ONLY_PHASE_SYNCHRONIZATION is set and it is not possible to calculate a physically (and mathematically) correct phase-synchronized (i.e., homothetic) trajectory, this error value will be returned. Please note: Even if this error message is returned, feasible, steady, and continuous output values will be computed in any case.
If one of the pointers to objects of the classes
is NULL, this error value will be returned.
If either
was used, the value of the parameter is negative or larger than the value of RML_MAX_EXECUTION_TIME
( ).
bool TypeIIRMLVelocity::IsPhaseSynchronizationPossible | ( | void | ) | [protected] |
Checks, whether the motion trajectory can be phase-synchronized.
It is checked whether the trajectory can be phase-synchronized. Therefore, this method checks whether the input vectors
are collinear to each other. If this is the case,
true
will be returned, andReferenceVector
( ) will be calculated, and copied to TypeIIRMLVelocity::PhaseSynchronizationReferenceVector.If this is not the case,
false
will be returned, andFor all these computations, the attributes
are used.
true
if phase-synchronization is possiblefalse
otherwiseTypeIIRMLVelocity & TypeIIRMLVelocity::operator= | ( | const TypeIIRMLVelocity & | TypeIIRMLObject | ) |
Copy operator.
TypeIIRMLObject | TypeIIRMLVelocity object to be copied |
void TypeIIRMLVelocity::SetPositionalExtremsToZero | ( | RMLVelocityOutputParameters * | OP | ) | const [protected] |
Set all positional extremum parameters of the output values of the algorithm (TypeIIRMLVelocity::OutputParameters) to zero.
If the input flag RMLVelocityFlags::EnableTheCalculationOfTheExtremumMotionStates is set to false
, this method is used to set all output values that are related to the calculation of the positional extremum values to zero in order to obtain defined output values:
If the input flag RMLVelocityFlags::EnableTheCalculationOfTheExtremumMotionStates is set to true
, the method TypeIIRMLVelocity::CalculatePositionalExtrems() is used to compute this part of the output values.
OP | Pointer to an object of the class RMLVelocityOutputParameters. The values of this data structure will be set to zero. |
void TypeIIRMLVelocity::SetupPhaseSyncSelectionVector | ( | void | ) | [protected] |
Modify the current selection vector and exclude unnecessary degrees of freedom.
This method modifies the selection vector RMLVelocityInputParameters::SelectionVector of TypeIIRMLVelocity::CurrentInputParameters to TypeIIRMLVelocity::PhaseSyncSelectionVector. Degrees of freedom , whose
are zero, can be excluded from the selection vector in order correctly determine, whether phase-synchronization is possible and to ensure numerical stability.
bool TypeIIRMLVelocity::CalculatePositionalExtremsFlag [protected] |
Indicates, whether the positional extremes are to be calculated.
Pointer to an RMLVelocityInputParameters object. This object contains a complete set of input values .
bool TypeIIRMLVelocity::CurrentTrajectoryIsNotSynchronized [protected] |
Indicates, that the current trajectory is not synchronized.
bool TypeIIRMLVelocity::CurrentTrajectoryIsPhaseSynchronized [protected] |
Indicates, whether the current trajectory is phase-synchronized.
double TypeIIRMLVelocity::CycleTime [protected] |
Contains the cycle time in seconds.
unsigned int TypeIIRMLVelocity::DOFWithGreatestExecutionTime [protected] |
Index of the degree of freedom that requires the greatest execution time.
RMLIntVector * TypeIIRMLVelocity::ExecutionTimes [protected] |
Vector of double
values, each of which represents an execution time that is used internally.
double TypeIIRMLVelocity::InternalClockInSeconds [protected] |
In order to prevent from recalculating the trajectory within every control cycle and to safe CPU time, this time value in seconds represents the elapsed time since the last calculation.
unsigned int TypeIIRMLVelocity::NumberOfDOFs [protected] |
The number of degrees of freedom .
RMLVelocityFlags TypeIIRMLVelocity::OldFlags [protected] |
In order to check, whether a new calculation has to be started, the input values have to be compared to the input and output values of the previous cycle. This variable is used to store the flags of last cycle.
Pointer to an RMLVelocityInputParameters object. In order to check, whether a new calculation has to be started, the input values have to be compared to the input and output values of the previous cycle. This variable is used to store the old input values.
Pointer to an RMLVelocityOutputParameters object. This object contains the output parameters of the method TypeIIRMLVelocity::GetNextStateOfMotion(). Besides the new desired state of motion , further complementary values for positional extremes are provided.
Current velocity vector used for the calculation of phase-synchronized motion trajectories.
Contains the adapted maximum acceleration vector for phase-synchronized trajectories.
Reference vector for phase-synchronized trajectories, with .
Target velocity vector used for the calculation of phase-synchronized motion trajectories.
RMLBoolVector * TypeIIRMLVelocity::PhaseSyncSelectionVector [protected] |
Boolean vector, which contains the modified selection vector that is based on the original selection vector in order to enable numerically robust phase-synchronization.
MotionPolynomials * TypeIIRMLVelocity::Polynomials [protected] |
Pointer to an array of MotionPolynomials objects, which contains the actual trajectory . It is a two-dimensional array of polynomial functions.
int TypeIIRMLVelocity::ReturnValue [protected] |
Contains the return value of the method TypeIIRMLVelocity::GetNextStateOfMotion()
double TypeIIRMLVelocity::SynchronizationTime [protected] |
If the trajectory is time- or phase-synchronized, this attribute will contain the synchronization time . Otherwise,is used for the execution time of the degree of freedom that requires the greatest time.