68 , ScalingValueFromReferenceVector = 0.0
69 , V_ErrorAtBeginning = 0.0
71 , V_ErrorAtEnd = 0.0 ;
75 TypeIIRMLDecisionTree2( (this->CurrentInputParameters->CurrentPositionVector->VecData )[this->GreatestDOFForPhaseSynchronization]
76 , (this->CurrentInputParameters->CurrentVelocityVector->VecData )[this->GreatestDOFForPhaseSynchronization]
77 , (this->CurrentInputParameters->TargetPositionVector->VecData )[this->GreatestDOFForPhaseSynchronization]
78 , (this->CurrentInputParameters->TargetVelocityVector->VecData )[this->GreatestDOFForPhaseSynchronization]
79 , (this->CurrentInputParameters->MaxVelocityVector->VecData )[this->GreatestDOFForPhaseSynchronization]
80 , (this->CurrentInputParameters->MaxAccelerationVector->VecData )[this->GreatestDOFForPhaseSynchronization]
81 , this->SynchronizationTime
82 , &((this->Polynomials)[this->GreatestDOFForPhaseSynchronization]) );
90 this->SynchronizationTime = (((this->Polynomials)[this->GreatestDOFForPhaseSynchronization]).PolynomialTimes)[((this->Polynomials)[this->GreatestDOFForPhaseSynchronization]).ValidPolynomials - 2];
94 for (i = 0; i < this->NumberOfDOFs; i++)
96 if ( (this->ModifiedSelectionVector->VecData)[i] && (i != this->GreatestDOFForPhaseSynchronization) )
98 ScalingValueFromReferenceVector = (this->PhaseSynchronizationReferenceVector->VecData)[i]
99 / (this->PhaseSynchronizationReferenceVector->VecData)[this->GreatestDOFForPhaseSynchronization];
101 for (j = 0; j < ((this->Polynomials)[this->GreatestDOFForPhaseSynchronization]).ValidPolynomials; j++)
103 ((this->Polynomials)[this->GreatestDOFForPhaseSynchronization]).PositionPolynomial[j].GetCoefficients (&P_a2, &P_a1, &P_a0, &DeltaT);
104 ((this->Polynomials)[this->GreatestDOFForPhaseSynchronization]).VelocityPolynomial[j].GetCoefficients (&V_a2, &V_a1, &V_a0, &DeltaT);
105 ((this->Polynomials)[this->GreatestDOFForPhaseSynchronization]).AccelerationPolynomial[j].GetCoefficients (&A_a2, &A_a1, &A_a0, &DeltaT);
107 P_a2 *= ScalingValueFromReferenceVector;
108 P_a1 *= ScalingValueFromReferenceVector;
109 P_a0 = ((this->CurrentInputParameters->CurrentPositionVector->VecData)[i]
111 - (this->CurrentInputParameters->CurrentPositionVector->VecData)[this->GreatestDOFForPhaseSynchronization])
112 * ScalingValueFromReferenceVector);
114 V_a2 *= ScalingValueFromReferenceVector;
115 V_a1 *= ScalingValueFromReferenceVector;
116 V_a0 *= ScalingValueFromReferenceVector;
118 A_a2 *= ScalingValueFromReferenceVector;
119 A_a1 *= ScalingValueFromReferenceVector;
120 A_a0 *= ScalingValueFromReferenceVector;
122 ((this->Polynomials)[i]).PositionPolynomial[j].SetCoefficients (P_a2, P_a1, P_a0, DeltaT);
123 ((this->Polynomials)[i]).VelocityPolynomial[j].SetCoefficients (V_a2, V_a1, V_a0, DeltaT);
124 ((this->Polynomials)[i]).AccelerationPolynomial[j].SetCoefficients (A_a2, A_a1, A_a0, DeltaT);
126 ((this->Polynomials)[i]).PolynomialTimes[j] = ((this->Polynomials)[this->GreatestDOFForPhaseSynchronization]).PolynomialTimes[j];
129 ((this->Polynomials)[i]).ValidPolynomials = ((this->Polynomials)[this->GreatestDOFForPhaseSynchronization]).ValidPolynomials;
135 if (this->SynchronizationTime > this->CycleTime)
137 V_ErrorAtBeginning = (this->CurrentInputParameters->CurrentVelocityVector->VecData)[i]
138 - ((this->Polynomials)[i]).VelocityPolynomial[0].CalculateValue(0.0);
140 V_ErrorAtEnd = (this->CurrentInputParameters->TargetVelocityVector->VecData)[i]
141 - ((this->Polynomials)[i]).VelocityPolynomial[((this->Polynomials)[i]).ValidPolynomials - 1].CalculateValue(this->SynchronizationTime);
143 for (j = 0; j < ((this->Polynomials)[i]).ValidPolynomials; j++)
145 ((this->Polynomials)[i]).PositionPolynomial[j].GetCoefficients (&P_a2, &P_a1, &P_a0, &DeltaT);
146 ((this->Polynomials)[i]).VelocityPolynomial[j].GetCoefficients (&V_a2, &V_a1, &V_a0, &DeltaT);
148 V_a1 += (V_ErrorAtEnd - V_ErrorAtBeginning) / this->SynchronizationTime;
149 V_a0 += V_ErrorAtBeginning - DeltaT * (V_ErrorAtEnd - V_ErrorAtBeginning) / this->SynchronizationTime;
153 ((this->Polynomials)[i]).PositionPolynomial[j].SetCoefficients (P_a2, P_a1, P_a0, DeltaT);
154 ((this->Polynomials)[i]).VelocityPolynomial[j].SetCoefficients (V_a2, V_a1, V_a0, DeltaT);
157 P_ErrorAtEnd = (this->CurrentInputParameters->TargetPositionVector->VecData)[i]
158 - ((this->Polynomials)[i]).PositionPolynomial[((this->Polynomials)[i]).ValidPolynomials - 1].CalculateValue(this->SynchronizationTime);
160 for (j = 0; j < ((this->Polynomials)[i]).ValidPolynomials; j++)
162 ((this->Polynomials)[i]).PositionPolynomial[j].GetCoefficients (&P_a2, &P_a1, &P_a0, &DeltaT);
164 P_a1 += P_ErrorAtEnd / this->SynchronizationTime;
165 P_a0 -= DeltaT * P_ErrorAtEnd / this->SynchronizationTime;
167 ((this->Polynomials)[i]).PositionPolynomial[j].SetCoefficients (P_a2, P_a1, P_a0, DeltaT);
void Step2PhaseSynchronization(void)
Executes Step 2 for phase-synchronized motion trajectories.
void TypeIIRMLDecisionTree2(const double &CurrentPosition, const double &CurrentVelocity, const double &TargetPosition, const double &TargetVelocity, const double &MaxVelocity, const double &MaxAcceleration, const double &SynchronizationTime, MotionPolynomials *PolynomialsInternal)
This function contains the decision tree of the Step 2 of the Type II On-Line Trajectory Generation a...
Header file for functions and definitions of constant values and macros.
Header file for the class TypeIIRMLPosition, which constitutes the actual interface of the Type II Re...
Header file for the Step 2 decision tree of the Type II On-Line Trajectory Generation algorithm (time...