55 ,
const double &CurrentVelocity
56 ,
const double &TargetPosition
57 ,
const double &TargetVelocity
58 ,
const double &MaxVelocity
59 ,
const double &MaxAcceleration)
61 return( (2.0 * MaxAcceleration * (TargetPosition - CurrentPosition)
62 +
pow2(CurrentVelocity)
63 +
pow2(TargetVelocity)
64 + 2.0 * MaxVelocity * (MaxVelocity - CurrentVelocity
66 / (2.0 * MaxAcceleration * MaxVelocity) );
74 ,
const double &CurrentVelocity
75 ,
const double &TargetPosition
76 ,
const double &TargetVelocity
77 ,
const double &MaxAcceleration)
79 return ((1.4142135623730950488016887242096980785696718753769480731766
80 *
RMLSqrt(
pow2(MaxAcceleration) * (2.0 * MaxAcceleration
81 * (TargetPosition - CurrentPosition) +
pow2(CurrentVelocity)
82 +
pow2(TargetVelocity))) - MaxAcceleration
83 * (CurrentVelocity + TargetVelocity))
84 / (
pow2(MaxAcceleration)) );
92 ,
const double &CurrentVelocity
93 ,
const double &TargetPosition
94 ,
const double &TargetVelocity
95 ,
const double &MaxAcceleration)
97 return ((1.4142135623730950488016887242096980785696718753769480731766
99 +
pow2(TargetVelocity) + 2.0 * MaxAcceleration
100 * (TargetPosition - CurrentPosition )))
101 - MaxAcceleration * (CurrentVelocity + TargetVelocity))
102 / (
pow2(MaxAcceleration)) );
110 ,
const double &CurrentVelocity
111 ,
const double &TargetPosition
112 ,
const double &TargetVelocity
113 ,
const double &MaxVelocity
114 ,
const double &MaxAcceleration)
116 return ((TargetPosition - CurrentPosition) / MaxVelocity
117 + (0.5 * (
pow2(CurrentVelocity) +
pow2(TargetVelocity))
118 + MaxVelocity * (MaxVelocity - CurrentVelocity
119 - TargetVelocity)) / (MaxAcceleration * MaxVelocity));
127 ,
const double &CurrentVelocity
128 ,
const double &TargetPosition
129 ,
const double &TargetVelocity
130 ,
const double &MaxAcceleration)
132 return ( (CurrentVelocity + TargetVelocity
133 - 1.4142135623730950488016887242096980785696718753769480731766
134 *
RMLSqrt(2.0 * MaxAcceleration
135 * (CurrentPosition - TargetPosition)
136 +
pow2(CurrentVelocity) +
pow2(TargetVelocity)))
145 ,
const double &CurrentVelocity
146 ,
const double &TargetPosition
147 ,
const double &TargetVelocity
148 ,
const double &MaxVelocity
149 ,
const double &MaxAcceleration)
152 if ( (CurrentVelocity > MaxVelocity )
153 || (CurrentVelocity < 0.0 ) )
159 if ( (2.0 * MaxAcceleration * (TargetPosition - CurrentPosition)
160 +
pow2(CurrentVelocity) - 2.0 *
pow2(MaxVelocity)
167 if ( (TargetVelocity > MaxVelocity)
168 || (TargetVelocity < 0.0) )
181 ,
const double &CurrentVelocity
182 ,
const double &TargetPosition
183 ,
const double &TargetVelocity
184 ,
const double &MaxVelocity
185 ,
const double &MaxAcceleration)
187 double BufferVariable = 0.0
188 , SqrtOfBufferVariable = 0.0
189 , PeakVelocity = 0.0;
192 if ( (CurrentVelocity > MaxVelocity )
193 || (CurrentVelocity < 0.0 ) )
199 if ( (TargetVelocity > MaxVelocity )
200 || (TargetVelocity < 0.0 ) )
205 BufferVariable =
pow2(MaxAcceleration) * (2.0
206 * MaxAcceleration * (TargetPosition
207 - CurrentPosition) +
pow2(CurrentVelocity)
208 +
pow2(TargetVelocity));
216 SqrtOfBufferVariable =
RMLSqrt(BufferVariable);
218 PeakVelocity = SqrtOfBufferVariable
219 / (1.4142135623730950488016887242096980785696718753769480731766
222 if ( (PeakVelocity > MaxVelocity )
223 || (PeakVelocity < CurrentVelocity )
224 || (PeakVelocity < TargetVelocity ) )
230 if ( ((1.4142135623730950488016887242096980785696718753769480731766
231 * SqrtOfBufferVariable - 2.0 * MaxAcceleration
232 * CurrentVelocity) / (2.0 *
pow2(MaxAcceleration)))
239 if ( ((1.4142135623730950488016887242096980785696718753769480731766
240 * SqrtOfBufferVariable - 2.0 * MaxAcceleration
241 * TargetVelocity) / (2.0 *
pow2(MaxAcceleration)))
255 ,
const double &CurrentVelocity
256 ,
const double &TargetPosition
257 ,
const double &TargetVelocity
258 ,
const double &MaxVelocity
259 ,
const double &MaxAcceleration)
261 double BufferVariable = 0.0
262 , SqrtOfBufferVariable = 0.0
263 , PeakVelocity = 0.0;
266 if ( (CurrentVelocity > MaxVelocity )
267 || (CurrentVelocity < 0.0 ) )
273 if ( (TargetVelocity < -MaxVelocity )
274 || (TargetVelocity > 0.0 ) )
279 BufferVariable =
pow2(MaxAcceleration) * (2.0
280 * MaxAcceleration * (TargetPosition
281 - CurrentPosition) +
pow2(CurrentVelocity)
282 +
pow2(TargetVelocity));
290 SqrtOfBufferVariable =
RMLSqrt(BufferVariable);
292 PeakVelocity = SqrtOfBufferVariable
293 / (1.4142135623730950488016887242096980785696718753769480731766
296 if ( (PeakVelocity > MaxVelocity )
297 || (PeakVelocity < CurrentVelocity ) )
303 if ( ((1.4142135623730950488016887242096980785696718753769480731766
304 * SqrtOfBufferVariable - 2.0 * MaxAcceleration
305 * CurrentVelocity) / (2.0 *
pow2(MaxAcceleration)))
312 if ( ((1.4142135623730950488016887242096980785696718753769480731766
313 * SqrtOfBufferVariable - 2.0 * MaxAcceleration
314 * TargetVelocity) / (2.0 *
pow2(MaxAcceleration)))
328 ,
const double &CurrentVelocity
329 ,
const double &TargetPosition
330 ,
const double &TargetVelocity
331 ,
const double &MaxVelocity
332 ,
const double &MaxAcceleration)
335 if ( (CurrentVelocity > MaxVelocity )
336 || (CurrentVelocity < 0.0 ) )
342 if ( (2.0 * MaxAcceleration * (TargetPosition - CurrentPosition)
343 +
pow2(CurrentVelocity) - 2.0 *
pow2(MaxVelocity)
350 if ( (TargetVelocity < -MaxVelocity)
351 || (TargetVelocity > 0.0) )
double ProfileStep1PosTriNegLin(const double &CurrentPosition, const double &CurrentVelocity, const double &TargetPosition, const double &TargetVelocity, const double &MaxAcceleration)
Calculates the execution time of the PosTriNegLin velocity profile.
bool IsSolutionForProfile_PosLinNegLin_Possible(const double &CurrentPosition, const double &CurrentVelocity, const double &TargetPosition, const double &TargetVelocity, const double &MaxVelocity, const double &MaxAcceleration)
Checks whether a valid solution for the PosLinNegLin velocity profile would be possible.
Header file for functions and definitions of constant values and macros.
double ProfileStep1NegLinPosLin(const double &CurrentPosition, const double &CurrentVelocity, const double &TargetPosition, const double &TargetVelocity, const double &MaxAcceleration)
Calculates the execution time of the NegLinPosLin velocity profile.
#define RML_VALID_SOLUTION_EPSILON
Positive threshold value used during the check, whether a valid solution for a given profile is possi...
double ProfileStep1PosLinHldNegLin(const double &CurrentPosition, const double &CurrentVelocity, const double &TargetPosition, const double &TargetVelocity, const double &MaxVelocity, const double &MaxAcceleration)
Calculates the execution time of the PosLinHldNegLin velocity profile.
bool IsSolutionForProfile_PosTriNegLin_Possible(const double &CurrentPosition, const double &CurrentVelocity, const double &TargetPosition, const double &TargetVelocity, const double &MaxVelocity, const double &MaxAcceleration)
Checks whether a valid solution for the PosTriNegLin velocity profile would be possible.
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...
double ProfileStep1PosTrapNegLin(const double &CurrentPosition, const double &CurrentVelocity, const double &TargetPosition, const double &TargetVelocity, const double &MaxVelocity, const double &MaxAcceleration)
Calculates the execution time of the PosTrapNegLin velocity profile.
#define pow2(A)
A to the power of 2.
bool IsSolutionForProfile_PosLinHldNegLin_Possible(const double &CurrentPosition, const double &CurrentVelocity, const double &TargetPosition, const double &TargetVelocity, const double &MaxVelocity, const double &MaxAcceleration)
Checks whether a valid solution for the PosLinHldNegLin velocity profile would be possible...
Header file for the Step 1 motion profiles.
bool IsSolutionForProfile_PosTrapNegLin_Possible(const double &CurrentPosition, const double &CurrentVelocity, const double &TargetPosition, const double &TargetVelocity, const double &MaxVelocity, const double &MaxAcceleration)
Checks whether a valid solution for the PosTrapNegLin velocity profile would be possible.
double ProfileStep1PosLinNegLin(const double &CurrentPosition, const double &CurrentVelocity, const double &TargetPosition, const double &TargetVelocity, const double &MaxAcceleration)
Calculates the execution time of the PosLinNegLin velocity profile.