65 for (i = 0; i < this->NumberOfDOFs; i++)
67 Polynomials[i].ValidPolynomials = 0;
69 if ((this->CurrentInputParameters->SelectionVector->VecData)[i])
71 (this->ExecutionTimes->VecData)[i] = fabs( (this->CurrentInputParameters->CurrentVelocityVector->VecData )[i]
72 - (this->CurrentInputParameters->TargetVelocityVector->VecData )[i])
73 / this->CurrentInputParameters->MaxAccelerationVector->VecData[i];
87 double TimeForFirstSegment = 0.0;
89 for (i = 0; i < this->NumberOfDOFs; i++)
91 if ((this->CurrentInputParameters->SelectionVector->VecData)[i])
93 (this->Polynomials)[i].ValidPolynomials = 0 ;
95 TimeForFirstSegment = fabs( (this->CurrentInputParameters->CurrentVelocityVector->VecData )[i]
96 - (this->CurrentInputParameters->TargetVelocityVector->VecData )[i])
97 / this->CurrentInputParameters->MaxAccelerationVector->VecData[i];
100 if (
Decision_V___001( (this->CurrentInputParameters->CurrentVelocityVector->VecData )[i]
101 , (this->CurrentInputParameters->TargetVelocityVector->VecData )[i]))
103 (this->Polynomials)[i].PositionPolynomial[(this->Polynomials)[i].ValidPolynomials].SetCoefficients((0.5 * (this->CurrentInputParameters->MaxAccelerationVector->VecData)[i]), (this->CurrentInputParameters->CurrentVelocityVector->VecData)[i], (this->CurrentInputParameters->CurrentPositionVector->VecData)[i], 0.0);
104 (this->Polynomials)[i].VelocityPolynomial[(this->Polynomials)[i].ValidPolynomials].SetCoefficients(0.0, (this->CurrentInputParameters->MaxAccelerationVector->VecData)[i], (this->CurrentInputParameters->CurrentVelocityVector->VecData)[i], 0.0);
105 (this->Polynomials)[i].AccelerationPolynomial[(this->Polynomials)[i].ValidPolynomials].SetCoefficients(0.0, 0.0, (this->CurrentInputParameters->MaxAccelerationVector->VecData)[i], 0.0);
107 (this->CurrentInputParameters->CurrentPositionVector->VecData)[i] += (this->CurrentInputParameters->CurrentVelocityVector->VecData )[i]
108 * TimeForFirstSegment
110 * (this->CurrentInputParameters->MaxAccelerationVector->VecData)[i]
111 *
pow2(TimeForFirstSegment);
113 (this->CurrentInputParameters->CurrentVelocityVector->VecData)[i] += (this->CurrentInputParameters->MaxAccelerationVector->VecData)[i]
114 * TimeForFirstSegment;
118 (this->Polynomials)[i].PositionPolynomial[(this->Polynomials)[i].ValidPolynomials].SetCoefficients((-0.5 * (this->CurrentInputParameters->MaxAccelerationVector->VecData)[i]), (this->CurrentInputParameters->CurrentVelocityVector->VecData)[i], (this->CurrentInputParameters->CurrentPositionVector->VecData)[i], 0.0);
119 (this->Polynomials)[i].VelocityPolynomial[(this->Polynomials)[i].ValidPolynomials].SetCoefficients(0.0, -(this->CurrentInputParameters->MaxAccelerationVector->VecData)[i], (this->CurrentInputParameters->CurrentVelocityVector->VecData)[i], 0.0);
120 (this->Polynomials)[i].AccelerationPolynomial[(this->Polynomials)[i].ValidPolynomials].SetCoefficients(0.0, 0.0, -(this->CurrentInputParameters->MaxAccelerationVector->VecData)[i], 0.0);
122 (this->CurrentInputParameters->CurrentPositionVector->VecData)[i] += (this->CurrentInputParameters->CurrentVelocityVector->VecData )[i]
123 * TimeForFirstSegment
125 * (this->CurrentInputParameters->MaxAccelerationVector->VecData)[i]
126 *
pow2(TimeForFirstSegment);
128 (this->CurrentInputParameters->CurrentVelocityVector->VecData)[i] += -(this->CurrentInputParameters->MaxAccelerationVector->VecData)[i]
129 * TimeForFirstSegment;
132 (this->Polynomials)[i].PolynomialTimes[(this->Polynomials)[i].ValidPolynomials] = TimeForFirstSegment;
133 (this->Polynomials)[i].ValidPolynomials++;
135 (this->OutputParameters->ExecutionTimes->VecData)[i] = TimeForFirstSegment;
137 (this->OutputParameters->PositionValuesAtTargetVelocity->VecData)[i] = (this->CurrentInputParameters->CurrentPositionVector->VecData)[i];
139 if (TimeForFirstSegment > this->SynchronizationTime)
141 this->OutputParameters->DOFWithTheGreatestExecutionTime = i;
142 this->SynchronizationTime = TimeForFirstSegment;
147 (this->Polynomials)[i].PositionPolynomial[(this->Polynomials)[i].ValidPolynomials].SetCoefficients(0.0, (this->CurrentInputParameters->CurrentVelocityVector->VecData)[i], (this->CurrentInputParameters->CurrentPositionVector->VecData)[i], TimeForFirstSegment);
148 (this->Polynomials)[i].VelocityPolynomial[(this->Polynomials)[i].ValidPolynomials].SetCoefficients(0.0, 0.0, (this->CurrentInputParameters->CurrentVelocityVector->VecData)[i], TimeForFirstSegment);
149 (this->Polynomials)[i].AccelerationPolynomial[(this->Polynomials)[i].ValidPolynomials].SetCoefficients(0.0, 0.0, 0.0, TimeForFirstSegment);
151 (this->Polynomials)[i].PolynomialTimes[(this->Polynomials)[i].ValidPolynomials] = TimeForFirstSegment +
RML_INFINITY;
152 (this->Polynomials)[i].ValidPolynomials++;
159 (this->Polynomials)[i].ValidPolynomials = 0;
174 double VectorStretchFactorMaxAcceleration = 0.0
175 , PhaseSyncTimeAverage = 0.0
176 , PhaseSyncDOFCounter = 0.0;
178 this->SetupPhaseSyncSelectionVector();
180 if (this->CurrentTrajectoryIsPhaseSynchronized)
182 this->CurrentTrajectoryIsPhaseSynchronized = this->IsPhaseSynchronizationPossible();
184 if ( (this->CurrentTrajectoryIsPhaseSynchronized)
185 && (fabs((this->PhaseSynchronizationReferenceVector->VecData)[
186 this->OutputParameters->DOFWithTheGreatestExecutionTime])
189 VectorStretchFactorMaxAcceleration = (this->CurrentInputParameters->MaxAccelerationVector->VecData)[this->OutputParameters->DOFWithTheGreatestExecutionTime]
190 / fabs((this->PhaseSynchronizationReferenceVector->VecData)[this->OutputParameters->DOFWithTheGreatestExecutionTime]);
192 for(i = 0; i < this->NumberOfDOFs; i++)
194 if((this->PhaseSyncSelectionVector->VecData)[i])
196 (this->ExecutionTimes->VecData)[i] = 0.0;
198 (this->PhaseSynchronizationMaxAccelerationVector->VecData)[i] = fabs(VectorStretchFactorMaxAcceleration
199 * (this->PhaseSynchronizationReferenceVector->VecData)[i]);
200 if ( (this->PhaseSynchronizationMaxAccelerationVector->VecData)[i] <= 0.0 )
202 (this->PhaseSynchronizationMaxAccelerationVector->VecData)[i] =
POSITIVE_ZERO;
205 if ( (this->PhaseSynchronizationMaxAccelerationVector->VecData)[i]
208 this->CurrentTrajectoryIsPhaseSynchronized =
false;
216 this->CurrentTrajectoryIsPhaseSynchronized =
false;
219 if (this->CurrentTrajectoryIsPhaseSynchronized)
221 for(i = 0; i < this->NumberOfDOFs; i++)
223 if((this->PhaseSyncSelectionVector->VecData)[i])
225 (this->ExecutionTimes->VecData)[i] = fabs( (this->CurrentInputParameters->CurrentVelocityVector->VecData)[i]
226 - (this->CurrentInputParameters->TargetVelocityVector->VecData)[i])
227 / (this->PhaseSynchronizationMaxAccelerationVector->VecData)[i];
231 PhaseSyncTimeAverage = 0.0;
232 PhaseSyncDOFCounter = 0.0;
234 for(i = 0; i < this->NumberOfDOFs; i++)
236 if((this->PhaseSyncSelectionVector->VecData)[i])
238 PhaseSyncTimeAverage += (this->ExecutionTimes->VecData)[i];
239 PhaseSyncDOFCounter += 1.0;
243 if (PhaseSyncDOFCounter > 0.0)
245 PhaseSyncTimeAverage /= PhaseSyncDOFCounter;
247 for(i = 0; i < this->NumberOfDOFs; i++)
249 if ((this->PhaseSyncSelectionVector->VecData)[i])
251 if ( fabs((this->ExecutionTimes->VecData)[i] - PhaseSyncTimeAverage)
254 this->CurrentTrajectoryIsPhaseSynchronized =
false;
263 if (this->CurrentTrajectoryIsPhaseSynchronized)
265 for (i = 0; i < this->NumberOfDOFs; i++)
267 if ((this->PhaseSyncSelectionVector->VecData)[i])
269 (this->CurrentInputParameters->MaxAccelerationVector->VecData)[i]
270 = (this->PhaseSynchronizationMaxAccelerationVector->VecData)[i];
292 for (i = 0; i < this->NumberOfDOFs; i++)
294 if ((this->CurrentInputParameters->SelectionVector->VecData)[i])
304 = (this->Polynomials)[i].PositionPolynomial[j].CalculateValue(TimeValueInSeconds);
306 = (this->Polynomials)[i].VelocityPolynomial[j].CalculateValue(TimeValueInSeconds);
308 = (this->Polynomials)[i].AccelerationPolynomial[j].CalculateValue(TimeValueInSeconds);
310 if ( j < ((this->Polynomials)[i].ValidPolynomials) - 1)
316 = (this->Polynomials)[i].PositionPolynomial[(this->Polynomials)[i].ValidPolynomials - 1].a0;
321 = (this->CurrentInputParameters->CurrentPositionVector->VecData)[i];
323 = (this->CurrentInputParameters->CurrentVelocityVector->VecData)[i];
325 = (this->CurrentInputParameters->CurrentAccelerationVector->VecData)[i];
327 = (this->CurrentInputParameters->CurrentPositionVector->VecData)[i];
331 return(ReturnValueForThisMethod);
Header file for the dynamic vector class used for the Reflexxes Motion Libraries. ...
#define ABSOLUTE_PHASE_SYNC_EPSILON
Absolute epsilon to check whether all required vectors are collinear.
Header file for the class ReflexxesAPI (API of the Reflexxes Motion Libraries)
RMLDoubleVector * NewAccelerationVector
A pointer to the new acceleration vector .
#define MAXIMAL_NO_OF_POLYNOMIALS
The maximum number of polynomials.
Header file for the class TypeIIRMLVelocity.
T * VecData
Pointer to the actual vector data, that is, an array of type T objects.
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.
Header file for decisions of the two decision trees of the Type II On-Line Trajectory Generation algo...
RMLDoubleVector * NewPositionVector
A pointer to the new position vector .
bool Decision_V___001(const double &CurrentVelocity, const double &TargetVelocity)
Is (vi <= vtrgt)?
void ComputeTrajectoryParameters(void)
Computes all trajectory parameters for non- and phase- synchronized trajectories. ...
Header file for functions and definitions of constant values and macros.
#define RML_INFINITY
A value for infinity .
Header file for the class RMLVelocityFlags.
Header file for the class RMLVelocityOutputParameters.
Class for the output parameters of the velocity-based On-Line Trajectory Generation algorithm...
void ComputePhaseSynchronizationParameters(void)
Checks, whether phase-synchronization is possible. If possible the corresponding vectors are computed...
#define pow2(A)
A to the power of 2.
void CalculateExecutionTimes(void)
Calculates the minimum execution times and corresponding motion profiles of each selected degree of f...
RMLDoubleVector * NewVelocityVector
A pointer to the new velocity vector .
#define RELATIVE_PHASE_SYNC_EPSILON
Relative epsilon to check whether all required vectors are collinear.
RMLDoubleVector * PositionValuesAtTargetVelocity
A pointer to an RMLDoubleVector object that contains the position values at the instants the desired ...
#define POSITIVE_ZERO
To prevent from numerical errors, a value for a "positive" value of zero is required for deterministi...