55 ,
const double &SynchronizationTime
56 ,
const double &CurrentPosition
57 ,
const double &CurrentVelocity
58 ,
const double &TargetPosition
59 ,
const double &TargetVelocity
60 ,
const double &MaxAcceleration
62 ,
const bool &Inverted )
64 double HoldVelocity = 0.0
65 , TimeForCurrentStep = 0.0
66 , ThisCurrentPosition = CurrentPosition
67 , ThisCurrentVelocity = CurrentVelocity
68 , TimeDifference = SynchronizationTime - CurrentTime
69 , ThisCurrentTime = CurrentTime;
71 HoldVelocity = 0.5 * (TimeDifference * MaxAcceleration
72 + ThisCurrentVelocity + TargetVelocity
74 *
pow2(TimeDifference) -
pow2(ThisCurrentVelocity
75 - TargetVelocity) + 2.0 * MaxAcceleration * (2.0
76 * (ThisCurrentPosition - TargetPosition)
77 + TimeDifference * (ThisCurrentVelocity
78 + TargetVelocity))) );
80 if (HoldVelocity < ThisCurrentVelocity)
82 HoldVelocity = ThisCurrentVelocity;
88 TimeForCurrentStep = (HoldVelocity - ThisCurrentVelocity) / MaxAcceleration;
106 ThisCurrentPosition += 0.5 * (ThisCurrentVelocity + HoldVelocity)
107 * TimeForCurrentStep;
108 ThisCurrentVelocity = HoldVelocity;
109 ThisCurrentTime += TimeForCurrentStep;
114 if (HoldVelocity > TargetVelocity)
116 TimeForCurrentStep = SynchronizationTime - ThisCurrentTime
117 - (HoldVelocity - TargetVelocity)
122 TimeForCurrentStep = SynchronizationTime - ThisCurrentTime;
141 ThisCurrentPosition += ThisCurrentVelocity * TimeForCurrentStep;
142 ThisCurrentTime += TimeForCurrentStep;
147 if (ThisCurrentVelocity > TargetVelocity)
149 TimeForCurrentStep = (ThisCurrentVelocity - TargetVelocity)
154 TimeForCurrentStep = 0.0;
173 ThisCurrentPosition += 0.5 * (TargetVelocity + ThisCurrentVelocity)
174 * TimeForCurrentStep;
175 ThisCurrentVelocity -= TimeForCurrentStep * MaxAcceleration;
176 ThisCurrentTime += TimeForCurrentStep;
206 ,
const double &SynchronizationTime
207 ,
const double &CurrentPosition
208 ,
const double &CurrentVelocity
209 ,
const double &TargetPosition
210 ,
const double &TargetVelocity
211 ,
const double &MaxAcceleration
213 ,
const bool &Inverted )
215 double HoldVelocity = 0.0
216 , TimeForCurrentStep = 0.0
217 , ThisCurrentPosition = CurrentPosition
218 , ThisCurrentVelocity = CurrentVelocity
219 , TimeDifference = SynchronizationTime - CurrentTime
220 , ThisCurrentTime = CurrentTime;
222 HoldVelocity = (0.5 * (2.0 * MaxAcceleration * (TargetPosition
223 - CurrentPosition) +
pow2(CurrentVelocity)
224 -
pow2(TargetVelocity))) / (MaxAcceleration
225 * TimeDifference + CurrentVelocity
228 if (HoldVelocity < ThisCurrentVelocity)
230 HoldVelocity = ThisCurrentVelocity;
236 TimeForCurrentStep = (HoldVelocity - ThisCurrentVelocity) / MaxAcceleration;
254 ThisCurrentPosition += 0.5 * (ThisCurrentVelocity + HoldVelocity)
255 * TimeForCurrentStep;
256 ThisCurrentVelocity = HoldVelocity;
257 ThisCurrentTime += TimeForCurrentStep;
262 if (TargetVelocity > HoldVelocity)
264 TimeForCurrentStep = SynchronizationTime - ThisCurrentTime
265 - (TargetVelocity - HoldVelocity)
270 TimeForCurrentStep = SynchronizationTime - ThisCurrentTime;
289 ThisCurrentPosition += ThisCurrentVelocity * TimeForCurrentStep;
290 ThisCurrentTime += TimeForCurrentStep;
295 if (TargetVelocity > ThisCurrentVelocity)
297 TimeForCurrentStep = (TargetVelocity - ThisCurrentVelocity)
302 TimeForCurrentStep = 0.0;
321 ThisCurrentPosition += 0.5 * (TargetVelocity + ThisCurrentVelocity)
322 * TimeForCurrentStep;
323 ThisCurrentVelocity += TimeForCurrentStep * MaxAcceleration;
324 ThisCurrentTime += TimeForCurrentStep;
354 ,
const double &SynchronizationTime
355 ,
const double &CurrentPosition
356 ,
const double &CurrentVelocity
357 ,
const double &TargetPosition
358 ,
const double &TargetVelocity
359 ,
const double &MaxAcceleration
361 ,
const bool &Inverted )
363 double HoldVelocity = 0.0
364 , TimeForCurrentStep = 0.0
365 , ThisCurrentPosition = CurrentPosition
366 , ThisCurrentVelocity = CurrentVelocity
367 , TimeDifference = SynchronizationTime - CurrentTime
368 , ThisCurrentTime = CurrentTime;
370 HoldVelocity = 0.5 * (CurrentVelocity + TargetVelocity
371 - TimeDifference * MaxAcceleration
373 *
pow2(TimeDifference) -
pow2(CurrentVelocity
374 - TargetVelocity) - 2.0 * MaxAcceleration * (2.0
375 * (CurrentPosition - TargetPosition)
376 + TimeDifference * (CurrentVelocity
377 + TargetVelocity))));
379 if (HoldVelocity > ThisCurrentVelocity)
381 HoldVelocity = ThisCurrentVelocity;
387 TimeForCurrentStep = (ThisCurrentVelocity - HoldVelocity) / MaxAcceleration;
405 ThisCurrentPosition += 0.5 * (ThisCurrentVelocity + HoldVelocity)
406 * TimeForCurrentStep;
407 ThisCurrentVelocity = HoldVelocity;
408 ThisCurrentTime += TimeForCurrentStep;
413 if (TargetVelocity > HoldVelocity)
415 TimeForCurrentStep = SynchronizationTime - ThisCurrentTime
416 - (TargetVelocity - HoldVelocity)
421 TimeForCurrentStep = SynchronizationTime - ThisCurrentTime;
440 ThisCurrentPosition += ThisCurrentVelocity * TimeForCurrentStep;
441 ThisCurrentTime += TimeForCurrentStep;
446 if (TargetVelocity > ThisCurrentVelocity)
448 TimeForCurrentStep = (TargetVelocity - ThisCurrentVelocity)
453 TimeForCurrentStep = 0.0;
472 ThisCurrentPosition += 0.5 * (TargetVelocity + ThisCurrentVelocity)
473 * TimeForCurrentStep;
474 ThisCurrentVelocity += TimeForCurrentStep * MaxAcceleration;
475 ThisCurrentTime += TimeForCurrentStep;
505 ,
const double &SynchronizationTime
506 ,
const double &CurrentPosition
507 ,
const double &CurrentVelocity
508 ,
const double &TargetPosition
509 ,
const double &TargetVelocity
510 ,
const double &MaxAcceleration
512 ,
const bool &Inverted )
514 double HoldVelocity = 0.0
515 , TimeForCurrentStep = 0.0
516 , ThisCurrentPosition = CurrentPosition
517 , ThisCurrentVelocity = CurrentVelocity
518 , TimeDifference = SynchronizationTime - CurrentTime
519 , ThisCurrentTime = CurrentTime;
521 HoldVelocity = (0.5 * (2.0 * MaxAcceleration * (TargetPosition
522 - CurrentPosition) -
pow2(CurrentVelocity)
523 +
pow2(TargetVelocity))) / (MaxAcceleration
524 * TimeDifference - CurrentVelocity
527 if (HoldVelocity > ThisCurrentVelocity)
529 HoldVelocity = ThisCurrentVelocity;
535 TimeForCurrentStep = (ThisCurrentVelocity - HoldVelocity) / MaxAcceleration;
553 ThisCurrentPosition += 0.5 * (ThisCurrentVelocity + HoldVelocity)
554 * TimeForCurrentStep;
555 ThisCurrentVelocity = HoldVelocity;
556 ThisCurrentTime += TimeForCurrentStep;
561 if (HoldVelocity > TargetVelocity)
563 TimeForCurrentStep = SynchronizationTime - ThisCurrentTime
564 - (HoldVelocity - TargetVelocity)
569 TimeForCurrentStep = SynchronizationTime - ThisCurrentTime;
588 ThisCurrentPosition += ThisCurrentVelocity * TimeForCurrentStep;
589 ThisCurrentTime += TimeForCurrentStep;
594 if (ThisCurrentVelocity > TargetVelocity)
596 TimeForCurrentStep = (ThisCurrentVelocity - TargetVelocity)
601 TimeForCurrentStep = 0.0;
620 ThisCurrentPosition += 0.5 * (TargetVelocity + ThisCurrentVelocity)
621 * TimeForCurrentStep;
622 ThisCurrentVelocity -= TimeForCurrentStep * MaxAcceleration;
623 ThisCurrentTime += TimeForCurrentStep;
653 ,
const double &SynchronizationTime
654 ,
const double &CurrentPosition
655 ,
const double &CurrentVelocity
656 ,
const double &TargetPosition
657 ,
const double &TargetVelocity
658 ,
const double &MaxAcceleration
660 ,
const bool &Inverted )
662 double HoldVelocity = 0.0
663 , TimeForCurrentStep = 0.0
664 , ThisCurrentPosition = CurrentPosition
665 , ThisCurrentVelocity = CurrentVelocity
666 , TimeDifference = SynchronizationTime - CurrentTime
667 , ThisCurrentTime = CurrentTime;
669 HoldVelocity = 0.5 * (MaxAcceleration * TimeDifference
670 + CurrentVelocity + TargetVelocity
672 *
pow2(TimeDifference) -
pow2(CurrentVelocity
673 - TargetVelocity)+ 2.0 * MaxAcceleration * (2.0
674 * (CurrentPosition - TargetPosition)
675 + TimeDifference * (CurrentVelocity
676 + TargetVelocity))));
678 if (HoldVelocity < ThisCurrentVelocity)
680 HoldVelocity = ThisCurrentVelocity;
686 TimeForCurrentStep = (HoldVelocity - ThisCurrentVelocity) / MaxAcceleration;
704 ThisCurrentPosition += 0.5 * (ThisCurrentVelocity + HoldVelocity)
705 * TimeForCurrentStep;
706 ThisCurrentVelocity = HoldVelocity;
707 ThisCurrentTime += TimeForCurrentStep;
712 TimeForCurrentStep = SynchronizationTime - ThisCurrentTime
713 - (HoldVelocity - TargetVelocity)
732 ThisCurrentPosition += ThisCurrentVelocity * TimeForCurrentStep;
733 ThisCurrentTime += TimeForCurrentStep;
738 TimeForCurrentStep = ThisCurrentVelocity / MaxAcceleration;
756 ThisCurrentPosition += 0.5 * ThisCurrentVelocity * TimeForCurrentStep;
757 ThisCurrentVelocity -= TimeForCurrentStep * MaxAcceleration;
758 ThisCurrentTime += TimeForCurrentStep;
763 TimeForCurrentStep = -TargetVelocity / MaxAcceleration;
781 ThisCurrentPosition += 0.5 * TargetVelocity * TimeForCurrentStep;
782 ThisCurrentVelocity -= TimeForCurrentStep * MaxAcceleration;
783 ThisCurrentTime += TimeForCurrentStep;
813 ,
const double &SynchronizationTime
814 ,
const double &CurrentPosition
815 ,
const double &CurrentVelocity
816 ,
const double &TargetPosition
817 ,
const double &TargetVelocity
818 ,
const double &MaxAcceleration
820 ,
const bool &Inverted )
822 double HoldVelocity = 0.0
823 , TimeForCurrentStep = 0.0
824 , ThisCurrentPosition = CurrentPosition
825 , ThisCurrentVelocity = CurrentVelocity
826 , TimeDifference = SynchronizationTime - CurrentTime
827 , ThisCurrentTime = CurrentTime;
829 HoldVelocity = (0.5 * (2.0 * MaxAcceleration * (TargetPosition
830 - CurrentPosition) -
pow2(CurrentVelocity)
831 +
pow2(TargetVelocity))) / (MaxAcceleration
832 * TimeDifference - CurrentVelocity
835 if (HoldVelocity > ThisCurrentVelocity)
837 HoldVelocity = ThisCurrentVelocity;
840 if (HoldVelocity < 0.0)
848 TimeForCurrentStep = (ThisCurrentVelocity - HoldVelocity) / MaxAcceleration;
866 ThisCurrentPosition += 0.5 * (ThisCurrentVelocity + HoldVelocity)
867 * TimeForCurrentStep;
868 ThisCurrentVelocity = HoldVelocity;
869 ThisCurrentTime += TimeForCurrentStep;
874 TimeForCurrentStep = SynchronizationTime - ThisCurrentTime
875 - (HoldVelocity - TargetVelocity)
894 ThisCurrentPosition += ThisCurrentVelocity * TimeForCurrentStep;
895 ThisCurrentTime += TimeForCurrentStep;
900 TimeForCurrentStep = ThisCurrentVelocity / MaxAcceleration;
918 ThisCurrentPosition += 0.5 * ThisCurrentVelocity * TimeForCurrentStep;
919 ThisCurrentVelocity -= TimeForCurrentStep * MaxAcceleration;
920 ThisCurrentTime += TimeForCurrentStep;
925 TimeForCurrentStep = -TargetVelocity / MaxAcceleration;
943 ThisCurrentPosition += 0.5 * TargetVelocity * TimeForCurrentStep;
944 ThisCurrentVelocity -= TimeForCurrentStep * MaxAcceleration;
945 ThisCurrentTime += TimeForCurrentStep;
void ProfileStep2PosTrapNegLin(const double &CurrentTime, const double &SynchronizationTime, const double &CurrentPosition, const double &CurrentVelocity, const double &TargetPosition, const double &TargetVelocity, const double &MaxAcceleration, MotionPolynomials *PolynomialsLocal, const bool &Inverted)
Parameterization of the Step 2 velocity profile PosTrapNegLin (leaf of the Step 2 decision tree) ...
void ProfileStep2NegLinHldNegLin(const double &CurrentTime, const double &SynchronizationTime, const double &CurrentPosition, const double &CurrentVelocity, const double &TargetPosition, const double &TargetVelocity, const double &MaxAcceleration, MotionPolynomials *PolynomialsLocal, const bool &Inverted)
Parameterization of the Step 2 velocity profile NegLinHldNegLin (leaf of the Step 2 decision tree) ...
double PolynomialTimes[MAXIMAL_NO_OF_POLYNOMIALS]
An array of ending times in seconds.
TypeIIRMLPolynomial AccelerationPolynomial[MAXIMAL_NO_OF_POLYNOMIALS]
An array of acceleration polynomials.
Header file for the Step 2 motion profiles.
Three arrays of TypeIIRMLMath::TypeIIRMLPolynomial.
void ProfileStep2NegLinHldPosLin(const double &CurrentTime, const double &SynchronizationTime, const double &CurrentPosition, const double &CurrentVelocity, const double &TargetPosition, const double &TargetVelocity, const double &MaxAcceleration, MotionPolynomials *PolynomialsLocal, const bool &Inverted)
Parameterization of the Step 2 velocity profile NegLinHldPosLin (leaf of the Step 2 decision tree) ...
void ProfileStep2PosLinHldNegLin(const double &CurrentTime, const double &SynchronizationTime, const double &CurrentPosition, const double &CurrentVelocity, const double &TargetPosition, const double &TargetVelocity, const double &MaxAcceleration, MotionPolynomials *PolynomialsLocal, const bool &Inverted)
Parameterization of the Step 2 velocity profile PosLinHldNegLin (leaf of the Step 2 decision tree) ...
Header file for functions and definitions of constant values and macros.
#define RML_INFINITY
A value for infinity .
double RMLSqrt(const double &Value)
Calculates the real square root of a given value. If the value is negative a value of almost zero wil...
Header file for the class TypeIIRMLMath::TypeIIRMLPolynomial and the struct TypeIIRMLMath::MotionPoly...
TypeIIRMLPolynomial VelocityPolynomial[MAXIMAL_NO_OF_POLYNOMIALS]
An array of velocity polynomials.
#define pow2(A)
A to the power of 2.
void ProfileStep2NegLinHldNegLinNegLin(const double &CurrentTime, const double &SynchronizationTime, const double &CurrentPosition, const double &CurrentVelocity, const double &TargetPosition, const double &TargetVelocity, const double &MaxAcceleration, MotionPolynomials *PolynomialsLocal, const bool &Inverted)
Parameterization of the Step 2 velocity profile NegLinHldNegLinNegLin (leaf of the Step 2 decision tr...
void SetCoefficients(const double &Coeff2, const double &Coeff1, const double &Coeff0, const double &Diff)
Sets the coefficients of the polynomial object.
void ProfileStep2PosLinHldPosLin(const double &CurrentTime, const double &SynchronizationTime, const double &CurrentPosition, const double &CurrentVelocity, const double &TargetPosition, const double &TargetVelocity, const double &MaxAcceleration, MotionPolynomials *PolynomialsLocal, const bool &Inverted)
Parameterization of the Step 2 velocity profile PosLinHldNegLin (leaf of the Step 2 decision tree) ...
unsigned char ValidPolynomials
The number of polynomials in use (0 ... MAXIMAL_NO_OF_POLYNOMIALS)
TypeIIRMLPolynomial PositionPolynomial[MAXIMAL_NO_OF_POLYNOMIALS]
An array of position polynomials.