TypeIIRMLDecisions.cpp
Go to the documentation of this file.
1 // ---------------------- Doxygen info ----------------------
38 // ----------------------------------------------------------
39 // For a convenient reading of this file's source code,
40 // please use a tab width of four characters.
41 // ----------------------------------------------------------
42 
43 
44 
45 #include <TypeIIRMLDecisions.h>
46 #include <TypeIIRMLMath.h>
47 
48 
49 //************************************************************************************
50 // Decision_1A__001()
51 
52 bool TypeIIRMLMath::Decision_1A__001( const double &CurrentVelocity)
53 {
54  return(CurrentVelocity >= 0.0);
55 }
56 
57 
58 //************************************************************************************
59 // Decision_1A__002()
60 
61 bool TypeIIRMLMath::Decision_1A__002( const double &CurrentVelocity
62  , const double &MaxVelocity)
63 {
64  return(CurrentVelocity <= MaxVelocity);
65 }
66 
67 
68 //************************************************************************************
69 // Decision_1A__003()
70 
71 bool TypeIIRMLMath::Decision_1A__003( const double &CurrentVelocity
72  , const double &TargetVelocity)
73 {
74  return(CurrentVelocity <= TargetVelocity);
75 }
76 
77 
78 //************************************************************************************
79 // Decision_1A__004()
80 
81 bool TypeIIRMLMath::Decision_1A__004( const double &CurrentPosition
82  , const double &CurrentVelocity
83  , const double &TargetPosition
84  , const double &TargetVelocity
85  , const double &MaxAcceleration)
86 {
87  return( (CurrentPosition + 0.5 * (pow2(TargetVelocity)
88  - pow2(CurrentVelocity)) / MaxAcceleration)
89  <= TargetPosition);
90 }
91 
92 
93 //************************************************************************************
94 // Decision_1A__005()
95 
96 bool TypeIIRMLMath::Decision_1A__005( const double &CurrentPosition
97  , const double &CurrentVelocity
98  , const double &TargetPosition
99  , const double &TargetVelocity
100  , const double &MaxVelocity
101  , const double &MaxAcceleration)
102 {
103  return( (CurrentPosition + (3.0 * pow2(MaxVelocity)
104  - pow2(CurrentVelocity) - CurrentVelocity * (MaxVelocity
105  - TargetVelocity) - MaxVelocity * TargetVelocity
106  - pow2(TargetVelocity)) / (2.0 * MaxAcceleration))
107  <= TargetPosition);
108 }
109 
110 
111 //************************************************************************************
112 // Decision_1A__006()
113 
114 bool TypeIIRMLMath::Decision_1A__006( const double &TargetVelocity)
115 {
116  return(TargetVelocity >= 0.0);
117 }
118 
119 
120 //************************************************************************************
121 // Decision_1A__007()
122 
123 bool TypeIIRMLMath::Decision_1A__007( const double &CurrentPosition
124  , const double &CurrentVelocity
125  , const double &TargetPosition
126  , const double &TargetVelocity
127  , const double &MaxAcceleration)
128 {
129  return( (CurrentPosition + 0.5 * (pow2(CurrentVelocity)
130  - pow2(TargetVelocity)) / MaxAcceleration)
131  >= TargetPosition);
132 }
133 
134 
135 //************************************************************************************
136 // Decision_1A__008()
137 
138 bool TypeIIRMLMath::Decision_1A__008( const double &CurrentPosition
139  , const double &CurrentVelocity
140  , const double &TargetPosition
141  , const double &TargetVelocity
142  , const double &MaxAcceleration)
143 {
144  return( (CurrentPosition + (pow2(CurrentVelocity)
145  - pow2(TargetVelocity)) / (2.0 * MaxAcceleration))
146  >= TargetPosition);
147 
148 }
149 
150 
151 //************************************************************************************
152 // Decision_1A__009()
153 
154 bool TypeIIRMLMath::Decision_1A__009( const double &CurrentPosition
155  , const double &CurrentVelocity
156  , const double &TargetPosition
157  , const double &TargetVelocity
158  , const double &MaxVelocity
159  , const double &MaxAcceleration)
160 {
161  return( (CurrentPosition + (2.0 * pow2(MaxVelocity)
162  - pow2(TargetVelocity) - pow2(CurrentVelocity))
163  / (2.0 * MaxAcceleration))
164  >= TargetPosition);
165 }
166 
167 
168 //************************************************************************************
169 // Decision_1B__001()
170 
171 bool TypeIIRMLMath::Decision_1B__001( const double &CurrentVelocity)
172 {
173  return(Decision_1A__001(CurrentVelocity));
174 }
175 
176 
177 //************************************************************************************
178 // Decision_1B__002()
179 
180 bool TypeIIRMLMath::Decision_1B__002( const double &CurrentVelocity
181  , const double &MaxVelocity)
182 {
183  return(Decision_1A__002( CurrentVelocity
184  , MaxVelocity ));
185 }
186 
187 
188 //************************************************************************************
189 // Decision_1B__003()
190 
191 bool TypeIIRMLMath::Decision_1B__003( const double &TargetVelocity)
192 {
193  return(Decision_1A__006(TargetVelocity));
194 }
195 
196 
197 //************************************************************************************
198 // Decision_1B__004()
199 
200 bool TypeIIRMLMath::Decision_1B__004( const double &CurrentVelocity
201  , const double &TargetVelocity)
202 {
203  return(Decision_1A__003( CurrentVelocity
204  , TargetVelocity ));
205 }
206 
207 
208 //************************************************************************************
209 // Decision_1B__005()
210 
211 bool TypeIIRMLMath::Decision_1B__005( const double &CurrentPosition
212  , const double &CurrentVelocity
213  , const double &TargetPosition
214  , const double &TargetVelocity
215  , const double &MaxAcceleration)
216 {
217  return(Decision_1A__004( CurrentPosition
218  , CurrentVelocity
219  , TargetPosition
220  , TargetVelocity
221  , MaxAcceleration ));
222 }
223 
224 
225 //************************************************************************************
226 // Decision_1B__006()
227 
228 bool TypeIIRMLMath::Decision_1B__006( const double &CurrentPosition
229  , const double &CurrentVelocity
230  , const double &TargetPosition
231  , const double &TargetVelocity
232  , const double &MaxAcceleration)
233 {
234  return( (CurrentPosition + (pow2(CurrentVelocity)
235  + pow2(TargetVelocity)) / (2.0 * MaxAcceleration))
236  <= TargetPosition);
237 }
238 
239 
240 //************************************************************************************
241 // Decision_1B__007()
242 
243 bool TypeIIRMLMath::Decision_1B__007( const double &CurrentPosition
244  , const double &CurrentVelocity
245  , const double &TargetPosition
246  , const double &TargetVelocity
247  , const double &MaxAcceleration)
248 {
249  return(Decision_1A__007( CurrentPosition
250  , CurrentVelocity
251  , TargetPosition
252  , TargetVelocity
253  , MaxAcceleration ));
254 }
255 
256 
257 //************************************************************************************
258 // Decision_1C__001()
259 
260 bool TypeIIRMLMath::Decision_1C__001( const double &CurrentVelocity)
261 {
262  return(Decision_1A__001(CurrentVelocity));
263 }
264 
265 
266 //************************************************************************************
267 // Decision_1C__002()
268 
269 bool TypeIIRMLMath::Decision_1C__002( const double &CurrentVelocity
270  , const double &MaxVelocity)
271 {
272  return(Decision_1A__002( CurrentVelocity
273  , MaxVelocity ));
274 }
275 
276 
277 //************************************************************************************
278 // Decision_1C__003()
279 
280 bool TypeIIRMLMath::Decision_1C__003( const double &CurrentPosition
281  , const double &CurrentVelocity
282  , const double &TargetPosition
283  , const double &TargetVelocity
284  , const double &MaxVelocity
285  , const double &MaxAcceleration)
286 {
287  return(Decision_1A__009( CurrentPosition
288  , CurrentVelocity
289  , TargetPosition
290  , TargetVelocity
291  , MaxVelocity
292  , MaxAcceleration ));
293 }
294 
295 
296 //************************************************************************************
297 // Decision_2___001()
298 
299 bool TypeIIRMLMath::Decision_2___001( const double &CurrentVelocity)
300 {
301  return(Decision_1A__001(CurrentVelocity));
302 }
303 
304 
305 //************************************************************************************
306 // Decision_2___002()
307 
308 bool TypeIIRMLMath::Decision_2___002( const double &CurrentVelocity
309  , const double &MaxVelocity)
310 {
311  return(Decision_1A__002( CurrentVelocity
312  , MaxVelocity ));
313 }
314 
315 
316 //************************************************************************************
317 // Decision_2___003()
318 
319 bool TypeIIRMLMath::Decision_2___003( const double &CurrentVelocity
320  , const double &TargetVelocity)
321 {
322  return(Decision_1A__002( CurrentVelocity
323  , TargetVelocity ));
324 }
325 
326 
327 //************************************************************************************
328 // Decision_2___004()
329 
330 bool TypeIIRMLMath::Decision_2___004( const double &CurrentPosition
331  , const double &CurrentVelocity
332  , const double &TargetPosition
333  , const double &TargetVelocity
334  , const double &MaxAcceleration
335  , const double &CurrentTime
336  , const double &SynchronizationTime)
337 {
338  return( (CurrentPosition + (SynchronizationTime - CurrentTime)
339  * TargetVelocity - pow2(CurrentVelocity - TargetVelocity)
340  / (2.0 * MaxAcceleration))
341  <= TargetPosition);
342 }
343 
344 
345 //************************************************************************************
346 // Decision_2___005()
347 
348 bool TypeIIRMLMath::Decision_2___005( const double &CurrentPosition
349  , const double &CurrentVelocity
350  , const double &TargetPosition
351  , const double &TargetVelocity
352  , const double &MaxAcceleration
353  , const double &CurrentTime
354  , const double &SynchronizationTime)
355 {
356  return( (CurrentPosition + (SynchronizationTime - CurrentTime)
357  * CurrentVelocity + pow2(CurrentVelocity - TargetVelocity)
358  / (2.0 * MaxAcceleration))
359  <= TargetPosition);
360 }
361 
362 
363 //************************************************************************************
364 // Decision_2___006()
365 
366 bool TypeIIRMLMath::Decision_2___006( const double &CurrentTime
367  , const double &SynchronizationTime
368  , const double &CurrentPosition
369  , const double &CurrentVelocity
370  , const double &TargetPosition
371  , const double &TargetVelocity
372  , const double &MaxAcceleration)
373 {
374  return( ((CurrentPosition + (pow2(CurrentVelocity)
375  + pow2(TargetVelocity)) / (2.0 * MaxAcceleration))
376  <= TargetPosition)
377  || ((((CurrentVelocity + TargetVelocity) / MaxAcceleration)
378  > (SynchronizationTime - CurrentTime))));
379 }
380 
381 
382 //************************************************************************************
383 // Decision_2___007()
384 
385 bool TypeIIRMLMath::Decision_2___007( const double &TargetVelocity)
386 {
387  return(Decision_1A__006(TargetVelocity));
388 }
389 
390 
391 //************************************************************************************
392 // Decision_2___008()
393 
394 bool TypeIIRMLMath::Decision_2___008( const double &CurrentPosition
395  , const double &CurrentVelocity
396  , const double &TargetPosition
397  , const double &TargetVelocity
398  , const double &MaxAcceleration
399  , const double &CurrentTime
400  , const double &SynchronizationTime)
401 {
402  return( (CurrentPosition + (SynchronizationTime - CurrentTime)
403  * CurrentVelocity - pow2(CurrentVelocity - TargetVelocity)
404  / (2.0 * MaxAcceleration))
405  <= TargetPosition);
406 }
407 
408 
409 //************************************************************************************
410 // Decision_2___009()
411 
412 bool TypeIIRMLMath::Decision_2___009( const double &CurrentPosition
413  , const double &CurrentVelocity
414  , const double &TargetPosition
415  , const double &TargetVelocity
416  , const double &MaxAcceleration
417  , const double &CurrentTime
418  , const double &SynchronizationTime)
419 {
420  return( (CurrentPosition + (SynchronizationTime - CurrentTime)
421  * TargetVelocity + pow2(CurrentVelocity - TargetVelocity)
422  / (2.0 * MaxAcceleration))
423  <= TargetPosition);
424 }
425 
426 
427 //************************************************************************************
428 // Decision_2___010()
429 
430 bool TypeIIRMLMath::Decision_2___010( const double &CurrentPosition
431  , const double &CurrentVelocity
432  , const double &TargetPosition
433  , const double &TargetVelocity
434  , const double &MaxAcceleration)
435 {
436  return(Decision_1A__008( CurrentPosition
437  , CurrentVelocity
438  , TargetPosition
439  , TargetVelocity
440  , MaxAcceleration ));
441 }
442 
443 
444 //************************************************************************************
445 // Decision_2___011()
446 
447 bool TypeIIRMLMath::Decision_2___011( const double &CurrentPosition
448  , const double &CurrentVelocity
449  , const double &TargetPosition
450  , const double &TargetVelocity
451  , const double &MaxAcceleration
452  , const double &CurrentTime
453  , const double &SynchronizationTime)
454 {
455  return(Decision_2___004( CurrentPosition
456  , CurrentVelocity
457  , TargetPosition
458  , TargetVelocity
459  , MaxAcceleration
460  , CurrentTime
461  , SynchronizationTime ));
462 }
463 
464 
465 //************************************************************************************
466 // Decision_2___012()
467 
468 bool TypeIIRMLMath::Decision_2___012( const double &CurrentPosition
469  , const double &CurrentVelocity
470  , const double &TargetPosition
471  , const double &TargetVelocity
472  , const double &MaxAcceleration
473  , const double &CurrentTime
474  , const double &SynchronizationTime)
475 {
476  return( (CurrentPosition + (SynchronizationTime - CurrentTime)
477  * CurrentVelocity - pow2(CurrentVelocity - TargetVelocity)
478  / (2.0 * MaxAcceleration))
479  <= TargetPosition);
480 }
481 
482 //************************************************************************************
483 // Decision_V___001()
484 
485 bool TypeIIRMLMath::Decision_V___001( const double &CurrentVelocity
486  , const double &TargetVelocity)
487 {
488  return(Decision_1A__003( CurrentVelocity
489  , TargetVelocity ));
490 }
bool Decision_1A__008(const double &CurrentPosition, const double &CurrentVelocity, const double &TargetPosition, const double &TargetVelocity, const double &MaxAcceleration)
If v->0->vtrgt, is p>=ptrgt?
bool Decision_1C__001(const double &CurrentVelocity)
Is (vi >= 0)?
bool Decision_1C__002(const double &CurrentVelocity, const double &MaxVelocity)
Is (vi <= +vmax)?
bool Decision_2___009(const double &CurrentPosition, const double &CurrentVelocity, const double &TargetPosition, const double &TargetVelocity, const double &MaxAcceleration, const double &CurrentTime, const double &SynchronizationTime)
If v->vtrgt->hold, so that t=tsync, is p<=ptrgt?
bool Decision_2___002(const double &CurrentVelocity, const double &MaxVelocity)
Is (vi <= +vmax)?
bool Decision_1A__004(const double &CurrentPosition, const double &CurrentVelocity, const double &TargetPosition, const double &TargetVelocity, const double &MaxAcceleration)
If v->vtrgt, is p<=ptrgt?
Header file for decisions of the two decision trees of the Type II On-Line Trajectory Generation algo...
bool Decision_1B__004(const double &CurrentVelocity, const double &TargetVelocity)
Is (vi <= vtrgt)?
bool Decision_V___001(const double &CurrentVelocity, const double &TargetVelocity)
Is (vi <= vtrgt)?
bool Decision_1B__001(const double &CurrentVelocity)
Is (vi >= 0)?
bool Decision_2___010(const double &CurrentPosition, const double &CurrentVelocity, const double &TargetPosition, const double &TargetVelocity, const double &MaxAcceleration)
If v->0->vtrgt, is p>=ptrgt?
Header file for functions and definitions of constant values and macros.
bool Decision_1A__003(const double &CurrentVelocity, const double &TargetVelocity)
Is (vi <= vtrgt)?
bool Decision_2___006(const double &CurrentTime, const double &SynchronizationTime, const double &CurrentPosition, const double &CurrentVelocity, const double &TargetPosition, const double &TargetVelocity, const double &MaxAcceleration)
If (v->0->vtrgt, is p<=ptrgt || t > tsync)?
bool Decision_1B__006(const double &CurrentPosition, const double &CurrentVelocity, const double &TargetPosition, const double &TargetVelocity, const double &MaxAcceleration)
If v->0->vtrgt, is p<=ptrgt?
bool Decision_2___001(const double &CurrentVelocity)
Is (vi >= 0)?
bool Decision_2___007(const double &TargetVelocity)
Is (vtrgt >= 0)?
#define pow2(A)
A to the power of 2.
bool Decision_2___012(const double &CurrentPosition, const double &CurrentVelocity, const double &TargetPosition, const double &TargetVelocity, const double &MaxAcceleration, const double &CurrentTime, const double &SynchronizationTime)
If v->hold->0->vtrgt, so that t=tsync, is p<=ptrgt?
bool Decision_1B__002(const double &CurrentVelocity, const double &MaxVelocity)
Is (vi <= +vmax)?
bool Decision_2___008(const double &CurrentPosition, const double &CurrentVelocity, const double &TargetPosition, const double &TargetVelocity, const double &MaxAcceleration, const double &CurrentTime, const double &SynchronizationTime)
If v->hold->vtrgt, so that t=tsync, is p<=ptrgt?
bool Decision_1A__002(const double &CurrentVelocity, const double &MaxVelocity)
Is (vi <= +vmax)?
bool Decision_1A__006(const double &TargetVelocity)
Is (vtrgt >= 0)?
bool Decision_2___003(const double &CurrentVelocity, const double &TargetVelocity)
Is (vi <= vtrgt)?
bool Decision_1A__009(const double &CurrentPosition, const double &CurrentVelocity, const double &TargetPosition, const double &TargetVelocity, const double &MaxVelocity, const double &MaxAcceleration)
If v->vmax->0->vtrgt, is p>=ptrgt?
bool Decision_1B__003(const double &TargetVelocity)
Is (vtrgt >= 0)?
bool Decision_1B__005(const double &CurrentPosition, const double &CurrentVelocity, const double &TargetPosition, const double &TargetVelocity, const double &MaxAcceleration)
If v->vtrgt, is p<=ptrgt?
bool Decision_2___011(const double &CurrentPosition, const double &CurrentVelocity, const double &TargetPosition, const double &TargetVelocity, const double &MaxAcceleration, const double &CurrentTime, const double &SynchronizationTime)
If v->vtrgt->hold, so that t=tsync, is p<=ptrgt?
bool Decision_2___005(const double &CurrentPosition, const double &CurrentVelocity, const double &TargetPosition, const double &TargetVelocity, const double &MaxAcceleration, const double &CurrentTime, const double &SynchronizationTime)
If v->hold->vtrgt, so that t=tsync, is p<=ptrgt?
bool Decision_2___004(const double &CurrentPosition, const double &CurrentVelocity, const double &TargetPosition, const double &TargetVelocity, const double &MaxAcceleration, const double &CurrentTime, const double &SynchronizationTime)
If v->vtrgt->hold, so that t=tsync, is p<=ptrgt?
bool Decision_1A__007(const double &CurrentPosition, const double &CurrentVelocity, const double &TargetPosition, const double &TargetVelocity, const double &MaxAcceleration)
If v->vtrgt, is p>=ptrgt?
bool Decision_1A__005(const double &CurrentPosition, const double &CurrentVelocity, const double &TargetPosition, const double &TargetVelocity, const double &MaxVelocity, const double &MaxAcceleration)
If v->vmax->vtrgt, is p<=ptrgt?
bool Decision_1A__001(const double &CurrentVelocity)
Is (vi >= 0)?
bool Decision_1B__007(const double &CurrentPosition, const double &CurrentVelocity, const double &TargetPosition, const double &TargetVelocity, const double &MaxAcceleration)
If v->vtrgt, is p>=ptrgt?
bool Decision_1C__003(const double &CurrentPosition, const double &CurrentVelocity, const double &TargetPosition, const double &TargetVelocity, const double &MaxVelocity, const double &MaxAcceleration)
If v->vmax->0->vtrgt, is p>=ptrgt?


libreflexxestype2
Author(s):
autogenerated on Sat Nov 21 2020 03:17:34