readparameters.y
Go to the documentation of this file.
1 %{
4 #include "parameters.h"
5 #include "error.h"
6 #include "boolean.h"
7 #include "defines.h"
8 
9 #include <stdlib.h>
10 #include <stdio.h>
11 #include <math.h>
12 
13  Tparameters *rp_ps; /*global pointer used from inside the parser to refer to the current set of
14  parameter being read*/
15 
16  /*Lex and Yacc variables*/
17  extern FILE *ReadParametersin;
18 
19  /*Lex and Yacc functions*/
20  int ReadParameterslex(void);
21 
22  /*Our own variables*/
23  extern unsigned int RPNline; /*line number currently processed (incremented by the LEX processor)*/
24 
25 %}
26 %union
27 {
28  int intValue;
29  double realValue;
30  unsigned int boolValue;
31 }
32 
33 %start parameters
34 
35 %token _TRUE _FALSE _OR _AND _NOT _PI _COS _SIN _TAN _EXP _LOG _SQRT _INF _EPSILON _REPRESENTATION _SIGMA _SMALL_SIGMA _R _SR _E _CE _DELTA _BETA _RHO _STATE_PERIOD _N_SOLUTIONS _MAX_NEWTON_ITERATIONS _N_DOF _GAMMA _DUMMIFY _ERROR_SPLIT _SAFE_SIMPLEX _SIMPLIFICATION_LEVEL _LR2TM_Q _LR2TM_S _VDW_RATIO _LINKS _FLINKS _QLINKS _JOINTS _CUT_X _CUT_Y _CUT_Z _COEF_TEMP _NFAIL_MAX _DETECT_BIFURCATIONS _MAX_PLANNING_TIME _MAX_CHARTS _MAX_PLANNING_ITERATIONS _MAX_NODES_RRT _BI_RRT _RRT_GRAPH _DYNAMIC_DOMAIN _CD_ENGINE _SOLID _VCOLLIDE _PQP _FCL _C_FCL _BULLET _C_BULLET _RIGIDCLL _NONE _SAMPLING _TANGENT_SAMPLING _AMBIENT_SAMPLING _KDTREE_SAMPLING
36 
37 %token <intValue> _INTEGER
38 %token <realValue> _REAL
39 
40 %type <realValue> ct_real
41 %type <boolValue> ct_bool
42 %type <intValue> ct_int
43 
44 %type <realValue> real_expr
45 %type <boolValue> bool_expr
46 %type <intValue> int_expr
47 
48 %type <boolValue> boolean_value
49 %type <intValue> rep_type
50 %type <intValue> col_engine
51 %type <intValue> sampling_mode
52 
53 %left _MIN_PRECEDENCE
54 %left '+' '-' _OR
55 %left '*' '/' _AND
56 %left '^' _NOT
57 %right _MAX_PRECEDENCE
58 
59 %%
60 
61 parameters : parameter parameters
62  |
63  ;
64 
65 parameter : _EPSILON '=' real_expr
66  {
67  if ($3<0.0)
68  Error("Parameter EPSILON must be greater than (or equal to) 0.0");
69  SetParameter(CT_EPSILON,"EPSILON",$3,rp_ps);
70  }
71  | _CD_ENGINE '=' col_engine
72  {
73  SetParameter(CT_CD_ENGINE,"CD_ENGINE",$3,rp_ps);
74  }
75  | _REPRESENTATION '=' rep_type
76  {
77  SetParameter(CT_REPRESENTATION,"REPRESENTATION",$3,rp_ps);
78  }
79  | _RHO '=' real_expr
80  {
81  if (($3>0.0)&&($3<1.0))
82  SetParameter(CT_RHO,"RHO",$3,rp_ps);
83  else
84  Error("Parameter RHO must in the interval (0,1)");
85  }
86  | _SIGMA '=' real_expr
87  {
88  if ($3<0.0)
89  Error("Parameter SIGMA must be greater than (or equal to) 0.0");
90  SetParameter(CT_SIGMA,"SIGMA",$3,rp_ps);
91  }
92  | _SMALL_SIGMA '=' real_expr
93  {
94  if ($3<0.0)
95  Error("Parameter SMALL SIGMA must be greater than (or equal to) 0.0");
96  SetParameter(CT_SMALL_SIGMA,"SMALL_SIGMA",$3,rp_ps);
97  }
98  | _E '=' real_expr
99  {
100  if ($3<0.0)
101  Error("Parameter E must be greater than (or equal to) 0.0");
102  SetParameter(CT_E,"E",$3,rp_ps);
103  }
104  | _CE '=' real_expr
105  {
106  if ($3<0.0)
107  Error("Parameter CE must be greater than (or equal to) 0.0");
108  SetParameter(CT_CE,"CE",$3,rp_ps);
109  }
110  | _R '=' real_expr
111  {
112  if ($3<=0.0)
113  Error("Parameter R must be greater than 0.0");
114  SetParameter(CT_R,"R",$3,rp_ps);
115  }
116  | _SR '=' real_expr
117  {
118  if ($3<0.0)
119  Error("Parameter SR must be below 0.0");
120  SetParameter(CT_SR,"SR",$3,rp_ps);
121  }
122  | _DELTA '=' real_expr
123  {
124  if ($3<0.0)
125  Error("Parameter DELTA must be greater than (or equal to) 0.0");
126  SetParameter(CT_DELTA,"DELTA",$3,rp_ps);
127  }
128  | _BETA '=' real_expr
129  {
130  if ($3<1.0)
131  Error("Parameter BETA must be larger or equal to 1");
132  SetParameter(CT_ATLASGBF_BETA,"BETA",$3,rp_ps);
133  }
134  | _STATE_PERIOD '=' int_expr
135  {
136  if ($3<0)
137  Error("Parameter STATE_PERIOD must be greater than (or equal to) 0");
138  SetParameter(CT_STATE_PERIOD,"STATE_PERIOD",(double)$3,rp_ps);
139  }
140  | _N_SOLUTIONS '=' int_expr
141  {
142  if ($3>=0.0)
143  SetParameter(CT_N_SOLUTIONS,"N_SOLUTIONS",(double)$3,rp_ps);
144  else
145  Error("Parameter N_SOLUTIONS must be greater than (or equal to) 0");
146  }
147  | _MAX_NEWTON_ITERATIONS '=' int_expr
148  {
149  if ($3>=0)
150  SetParameter(CT_MAX_NEWTON_ITERATIONS,"MAX_NEWTON_ITERATIONS",(double)$3,rp_ps);
151  else
152  Error("Parameter MAX_NEWTON_ITERATIONS must be greater than (or equal to) 1");
153  }
154  | _N_DOF '=' int_expr
155  {
156  if ($3<0)
157  Error("Parameter N_DOF must be greater than (or equal to) 0");
158  SetParameter(CT_N_DOF,"N_DOF",(double)$3,rp_ps);
159  }
160  | _GAMMA '=' real_expr
161  {
162  if ($3<0)
163  Error("Parameter GAMNA must be greater than (or equal to) 0");
164  SetParameter(CT_GAMMA,"GAMMA",$3,rp_ps);
165  }
166  | _DUMMIFY '=' int_expr
167  {
168  SetParameter(CT_DUMMIFY,"DUMMIFY",(double)$3,rp_ps);
169  }
170  | _ERROR_SPLIT '=' bool_expr
171  {
172  SetParameter(CT_SPLIT_TYPE,"ERROR_SPLIT",$3,rp_ps);
173  }
174  | _SAFE_SIMPLEX '=' int_expr
175  {
176  SetParameter(CT_SAFE_SIMPLEX,"SAVE_SIMPLEX",(double)$3,rp_ps);
177  }
178  | _SIMPLIFICATION_LEVEL '=' int_expr
179  {
180  SetParameter(CT_SIMPLIFICATION_LEVEL,"SIMPLIFICATION_LEVEL",(double)$3,rp_ps);
181  }
182  | _LR2TM_Q '=' real_expr
183  {
184  SetParameter(CT_LR2TM_Q,"LR2TM_Q",$3,rp_ps);
185  }
186  | _LR2TM_S '=' real_expr
187  {
188  SetParameter(CT_LR2TM_S,"LR2TM_S",$3,rp_ps);
189  }
190  | _VDW_RATIO '=' real_expr
191  {
192  if ($3>0.0)
193  SetParameter(CT_VDW_RATIO,"VDW_RATIO",$3,rp_ps);
194  else
195  Error("Parameter VDW_RATIO must positive");
196  }
197  | _CUT_X '=' real_expr
198  {
199  SetParameter(CT_CUT_X,"CUT_X",$3,rp_ps);
200  }
201  | _CUT_Y '=' real_expr
202  {
203  SetParameter(CT_CUT_Y,"CUT_Y",$3,rp_ps);
204  }
205  | _CUT_Z '=' real_expr
206  {
207  SetParameter(CT_CUT_Z,"CUT_Z",$3,rp_ps);
208  }
209  | _COEF_TEMP '=' real_expr
210  {
211  SetParameter(CT_COEF_TEMP,"COEF_TEMP",$3,rp_ps);
212  }
213  | _NFAIL_MAX '=' int_expr
214  {
215  SetParameter(CT_NFAIL_MAX,"NFAIL_MAX",(double)$3,rp_ps);
216  }
217  | _DETECT_BIFURCATIONS '=' int_expr
218  {
219  SetParameter(CT_DETECT_BIFURCATIONS,"DETECT_BIFURCATIONS",(double)$3,rp_ps);
220  }
221  | _MAX_PLANNING_TIME '=' real_expr
222  {
223  if ($3<=0)
224  Error("Parameter MAX_PLANNING_TIME must positive");
225 
226  SetParameter(CT_MAX_PLANNING_TIME,"MAX_PLANNING_TIME",$3,rp_ps);
227  }
228  | _MAX_PLANNING_ITERATIONS '=' int_expr
229  {
230  if ($3<1)
231  Error("Parameter MAX_PLANNING_ITERATIONS must larger than 0");
232 
233  SetParameter(CT_MAX_PLANNING_ITERATIONS,"MAX_PLANNING_ITERATIONS",(double)$3,rp_ps);
234  }
235  | _MAX_CHARTS '=' int_expr
236  {
237  if ($3<1)
238  Error("Parameter MAX_CHARTS must larger than 0");
239  if ($3>1000000)
240  Error("Parameter MAX_CHARTS must lower than 10000000 (or enlarge the kd-tree)");
241 
242  SetParameter(CT_MAX_CHARTS,"MAX_CHARTS",(double)$3,rp_ps);
243  }
244  | _MAX_NODES_RRT '=' int_expr
245  {
246  if ($3<1)
247  Error("Parameter MAX_NODES_RRT must larger than 0");
248  if ($3>1000000)
249  Error("Parameter MAX_NODES_RRT must lower than 10000000 (or enlarge the kd-tree)");
250 
251  SetParameter(CT_MAX_NODES_RRT,"MAX_NODES_RRT",(double)$3,rp_ps);
252  }
253  | _BI_RRT '=' bool_expr
254  {
255  SetParameter(CT_BI_RRT,"BI_RRT",(double)$3,rp_ps);
256  }
257  | _RRT_GRAPH '=' bool_expr
258  {
259  SetParameter(CT_RRT_GRAPH,"RRT_GRAPH",(double)$3,rp_ps);
260  }
261  | _DYNAMIC_DOMAIN '=' real_expr
262  {
263  SetParameter(CT_DYNAMIC_DOMAIN,"DYNAMIC_DOMAIN",$3,rp_ps);
264  }
265  | _SAMPLING '=' sampling_mode
266  {
267  SetParameter(CT_SAMPLING,"SAMPLING",$3,rp_ps);
268  }
269  ;
270 
271 ct_bool : _ERROR_SPLIT
272  {
273  if (ParameterSet(CT_SPLIT_TYPE,rp_ps))
274  $$=(unsigned int)floor(GetParameter(CT_SPLIT_TYPE,rp_ps));
275  else
276  Error("Undefined parameter in expression (ERROR_SPLIT)");
277  }
278  | _BI_RRT
279  {
280  if (ParameterSet(CT_BI_RRT,rp_ps))
281  $$=(unsigned int)floor(GetParameter(CT_BI_RRT,rp_ps));
282  else
283  Error("Undefined parameter in expression (BI_RRT)");
284  }
285  | _RRT_GRAPH
286  {
287  if (ParameterSet(CT_RRT_GRAPH,rp_ps))
288  $$=(unsigned int)floor(GetParameter(CT_RRT_GRAPH,rp_ps));
289  else
290  Error("Undefined parameter in expression (RRT_GRAPH)");
291  }
292  ;
293 
294 ct_int : _STATE_PERIOD
295  {
296  if (ParameterSet(CT_STATE_PERIOD,rp_ps))
297  $$=(int)floor(GetParameter(CT_STATE_PERIOD,rp_ps));
298  else
299  Error("Undefined parameter in expression (STATE_PERIOD)");
300  }
301  | _N_SOLUTIONS
302  {
303  if (ParameterSet(CT_N_SOLUTIONS,rp_ps))
304  $$=(int)floor(GetParameter(CT_N_SOLUTIONS,rp_ps));
305  else
306  Error("Undefined parameter in expression (N_SOLUTIONS)");
307  }
308  | _MAX_NEWTON_ITERATIONS
309  {
311  $$=(int)floor(GetParameter(CT_MAX_NEWTON_ITERATIONS,rp_ps));
312  else
313  Error("Undefined parameter in expression (MAX_NEWTON_ITERATIONS)");
314  }
315  | _N_DOF
316  {
317  if (ParameterSet(CT_N_DOF,rp_ps))
318  $$=(int)floor(GetParameter(CT_N_DOF,rp_ps));
319  else
320  Error("Undefined parameter in expression (N_DOF)");
321  }
322  | _DUMMIFY
323  {
324  if (ParameterSet(CT_DUMMIFY,rp_ps))
325  $$=(int)floor(GetParameter(CT_DUMMIFY,rp_ps));
326  else
327  Error("Undefined parameter in expression (DUMMIFY)");
328  }
329  | _SAFE_SIMPLEX
330  {
331  if (ParameterSet(CT_SAFE_SIMPLEX,rp_ps))
332  $$=(int)floor(GetParameter(CT_SAFE_SIMPLEX,rp_ps));
333  else
334  Error("Undefined parameter in expression (SAFE_SIMPLEX)");
335  }
336  | _SIMPLIFICATION_LEVEL
337  {
339  $$=(int)floor(GetParameter(CT_SIMPLIFICATION_LEVEL,rp_ps));
340  else
341  Error("Undefined parameter in expression (SIMPLIFICATION_LEVEL)");
342  }
343  | _NFAIL_MAX
344  {
345  if (ParameterSet(CT_NFAIL_MAX,rp_ps))
346  $$=(int)floor(GetParameter(CT_NFAIL_MAX,rp_ps));
347  else
348  Error("Undefined parameter in expression (N_FAILS)");
349  }
350  | _DETECT_BIFURCATIONS
351  {
353  $$=(int)floor(GetParameter(CT_DETECT_BIFURCATIONS,rp_ps));
354  else
355  Error("Undefined parameter in expression (DETECT_BIFURCATIONS)");
356  }
357  | _MAX_PLANNING_ITERATIONS
358  {
360  $$=(int)floor(GetParameter(CT_MAX_PLANNING_ITERATIONS,rp_ps));
361  else
362  Error("Undefined parameter in expression (MAX_PLANNING_ITERATIONS)");
363  }
364  | _MAX_CHARTS
365  {
366  if (ParameterSet(CT_MAX_CHARTS,rp_ps))
367  $$=(int)floor(GetParameter(CT_MAX_CHARTS,rp_ps));
368  else
369  Error("Undefined parameter in expression (MAX_CHARTS)");
370  }
371  | _MAX_NODES_RRT
372  {
373  if (ParameterSet(CT_MAX_NODES_RRT,rp_ps))
374  $$=(int)floor(GetParameter(CT_MAX_NODES_RRT,rp_ps));
375  else
376  Error("Undefined parameter in expression (MAX_NODES_RRT)");
377  }
378  ;
379 
380 ct_real : ct_int
381  {
382  $$=(double)$1;
383  }
384  | _EPSILON
385  {
386  if (ParameterSet(CT_EPSILON,rp_ps))
387  $$=GetParameter(CT_EPSILON,rp_ps);
388  else
389  Error("Undefined parameter in expression (EPSILON)");
390  }
391  | _RHO
392  {
393  if (ParameterSet(CT_RHO,rp_ps))
394  $$=GetParameter(CT_RHO,rp_ps);
395  else
396  Error("Undefined parameter in expression (RHO)");
397  }
398  | _SIGMA
399  {
400  if (ParameterSet(CT_SIGMA,rp_ps))
401  $$=GetParameter(CT_SIGMA,rp_ps);
402  else
403  Error("Undefined parameter in expression (SIGMA)");
404  }
405  | _SMALL_SIGMA
406  {
407  if (ParameterSet(CT_SMALL_SIGMA,rp_ps))
408  $$=GetParameter(CT_SMALL_SIGMA,rp_ps);
409  else
410  Error("Undefined parameter in expression (SMALL_SIGMA)");
411  }
412  | _E
413  {
414  if (ParameterSet(CT_E,rp_ps))
415  $$=GetParameter(CT_E,rp_ps);
416  else
417  Error("Undefined parameter in expression (E)");
418  }
419  | _CE
420  {
421  if (ParameterSet(CT_CE,rp_ps))
422  $$=GetParameter(CT_CE,rp_ps);
423  else
424  Error("Undefined parameter in expression (CE)");
425  }
426  | _R
427  {
428  if (ParameterSet(CT_R,rp_ps))
429  $$=GetParameter(CT_R,rp_ps);
430  else
431  Error("Undefined parameter in expression (R)");
432  }
433  | _SR
434  {
435  if (ParameterSet(CT_SR,rp_ps))
436  $$=GetParameter(CT_SR,rp_ps);
437  else
438  Error("Undefined parameter in expression (SR)");
439  }
440  | _DELTA
441  {
442  if (ParameterSet(CT_DELTA,rp_ps))
443  $$=GetParameter(CT_DELTA,rp_ps);
444  else
445  Error("Undefined parameter in expression (DELTA)");
446  }
447  | _BETA
448  {
449  if (ParameterSet(CT_ATLASGBF_BETA,rp_ps))
450  $$=GetParameter(CT_ATLASGBF_BETA,rp_ps);
451  else
452  Error("Undefined parameter in expression (BETA)");
453  }
454  | _GAMMA
455  {
456  if (ParameterSet(CT_GAMMA,rp_ps))
457  $$=GetParameter(CT_GAMMA,rp_ps);
458  else
459  Error("Undefined parameter in expression (GAMMA)");
460  }
461  | _LR2TM_Q
462  {
463  if (ParameterSet(CT_LR2TM_Q,rp_ps))
464  $$=GetParameter(CT_LR2TM_Q,rp_ps);
465  else
466  Error("Undefined parameter in expression (LR2TM_Q)");
467  }
468  | _LR2TM_S
469  {
470  if (ParameterSet(CT_LR2TM_S,rp_ps))
471  $$=GetParameter(CT_LR2TM_S,rp_ps);
472  else
473  Error("Undefined parameter in expression (LR2TM_S)");
474  }
475  | _VDW_RATIO
476  {
477  if (ParameterSet(CT_VDW_RATIO,rp_ps))
478  $$=GetParameter(CT_VDW_RATIO,rp_ps);
479  else
480  Error("Undefined parameter in expression (VDW_RATIO)");
481  }
482  | _CUT_X
483  {
484  if (ParameterSet(CT_CUT_X,rp_ps))
485  $$=GetParameter(CT_CUT_X,rp_ps);
486  else
487  Error("Undefined parameter in expression (CUT_X)");
488  }
489  | _CUT_Y
490  {
491  if (ParameterSet(CT_CUT_Y,rp_ps))
492  $$=GetParameter(CT_CUT_Y,rp_ps);
493  else
494  Error("Undefined parameter in expression (CUT_Y)");
495  }
496  | _CUT_Z
497  {
498  if (ParameterSet(CT_CUT_Z,rp_ps))
499  $$=GetParameter(CT_CUT_Z,rp_ps);
500  else
501  Error("Undefined parameter in expression (CUT_Z)");
502  }
503  | _COEF_TEMP
504  {
505  if (ParameterSet(CT_COEF_TEMP,rp_ps))
506  $$=GetParameter(CT_COEF_TEMP,rp_ps);
507  else
508  Error("Undefined parameter in expression (COEF_TEMP)");
509  }
510  | _MAX_PLANNING_TIME
511  {
514  else
515  Error("Undefined parameter in expression (MAX_PLANNING_TIME)");
516  }
517  | _DYNAMIC_DOMAIN
518  {
519  if (ParameterSet(CT_DYNAMIC_DOMAIN,rp_ps))
521  else
522  Error("Undefined parameter in expression (DYNAMIC_DOMAIN)");
523  }
524  ;
525 
526 col_engine : _SOLID
527  {
528  $$=SOLID;
529  }
530  | _VCOLLIDE
531  {
532  $$=VCOLLIDE;
533  }
534  | _PQP
535  {
536  $$=PQP;
537  }
538  | _FCL
539  {
540  $$=FCL;
541  }
542  | _C_FCL
543  {
544  $$=C_FCL;
545  }
546  | _BULLET
547  {
548  $$=BULLET;
549  }
550  | _C_BULLET
551  {
552  $$=C_BULLET;
553  }
554  | _RIGIDCLL
555  {
556  $$=RIGIDCLL;
557  }
558  | _NONE
559  {
560  $$=NOCD;
561  }
562  ;
563 
564 sampling_mode : _TANGENT_SAMPLING
565  {
566  $$=TANGENT_SAMPLING;
567  }
568  | _AMBIENT_SAMPLING
569  {
570  $$=AMBIENT_SAMPLING;
571  }
572  | _KDTREE_SAMPLING
573  {
574  #if (_KDTREE!=1)
575  Error("KDTREE_SAMPLING can only be used if the cuik-kdtree library is available");
576  #endif
577  $$=KDTREE_SAMPLING;
578  }
579  ;
580 
581 rep_type : _LINKS
582  {
583  $$=REP_LINKS;
584  }
585  | _FLINKS
586  {
587  $$=REP_FLINKS;
588  }
589  | _QLINKS
590  {
591  $$=REP_QLINKS;
592  }
593  | _JOINTS
594  {
595  $$=REP_JOINTS;
596  }
597  ;
598 
599 real_expr : _INTEGER
600  {
601  $$=(double)$1;
602  }
603  | _REAL
604  {
605  $$=$1;
606  }
607  | _PI
608  {
609  $$=M_PI;
610  }
611  | _INF
612  {
613  $$=INF;
614  }
615  | ct_real
616  {
617  $$=$1;
618  }
619  | '+' real_expr %prec _MAX_PRECEDENCE
620  {
621  $$=$2;
622  }
623  | '-' real_expr %prec _MAX_PRECEDENCE
624  {
625  $$=-$2;
626  }
627  | '(' real_expr ')'
628  {
629  $$=$2;
630  }
631  | real_expr '+' real_expr
632  {
633  $$=$1+$3;
634  }
635  | real_expr '-' real_expr
636  {
637  $$=$1-$3;
638  }
639  | real_expr '*' real_expr
640  {
641  $$=$1*$3;
642  }
643  | real_expr '^' real_expr
644  {
645  $$=pow($1,$3);
646  }
647  | real_expr '/' real_expr
648  {
649  $$=$1/$3;
650  }
651  | _COS '(' real_expr ')'
652  {
653  $$=cos($3);
654  }
655  | _SIN '(' real_expr ')'
656  {
657  $$=sin($3);
658  }
659  | _TAN '(' real_expr ')'
660  {
661  $$=tan($3);
662  }
663  | _EXP '(' real_expr ')'
664  {
665  $$=exp($3);
666  }
667  | _LOG '(' real_expr ')'
668  {
669  $$=log($3);
670  }
671  | _SQRT '(' real_expr ')'
672  {
673  $$=sqrt($3);
674  }
675  ;
676 
677 int_expr : _INTEGER
678  {
679  $$=$1;
680  }
681  | ct_int
682  {
683  $$=$1;
684  }
685  | '+' int_expr %prec _MAX_PRECEDENCE
686  {
687  $$=$2;
688  }
689  | '-' int_expr %prec _MAX_PRECEDENCE
690  {
691  $$=-$2;
692  }
693  | '(' int_expr ')'
694  {
695  $$=$2;
696  }
697  | int_expr '+' int_expr
698  {
699  $$=$1+$3;
700  }
701  | int_expr '-' int_expr
702  {
703  $$=$1-$3;
704  }
705  | int_expr '*' int_expr
706  {
707  $$=$1*$3;
708  }
709  | int_expr '/' int_expr
710  {
711  $$=$1/$3;
712  }
713  ;
714 
715 
716 bool_expr : boolean_value
717  {
718  $$=$1;
719  }
720  | ct_bool
721  {
722  $$=$1;
723  }
724  | '(' bool_expr ')'
725  {
726  $$=$2;
727  }
728  | _NOT bool_expr
729  {
730  $$=!($2);
731  }
732  | bool_expr _AND bool_expr
733  {
734  $$=(($1)&&($3));
735  }
736  | bool_expr _OR bool_expr
737  {
738  $$=(($1)||($3));
739  }
740  ;
741 
742 boolean_value : _TRUE
743  {
744  $$=1;
745  }
746  | _FALSE
747  {
748  $$=0;
749  }
750  | _INTEGER
751  {
752  if (($1<0)||($1>1))
753  Error("Boolean values can only be 0/1 (or TRUE/FALSE)");
754  $$=$1;
755  }
756  ;
757 
758 %%
760 boolean ReadParameters(char *file,Tparameters *p)
761 {
762  unsigned int i;
763  boolean fileExists;
764 
765  ReadParametersin=fopen(file,"r");
766  if (!ReadParametersin)
767  fileExists=FALSE;
768  else
769  {
770  fileExists=TRUE;
771 
772  /*Set up the global pointer to make the parameter structure under initialization
773  to be accesible form everywhere in the parser*/
774  rp_ps=p;
775 
776  /*Reset the lines numbering*/
777  RPNline=1;
778 
779  /*and process the file*/
780  ReadParametersparse();
781 
782  for(i=0;i<NPARAMETERS;i++)
783  {
784  if ((*p)[i].name==NULL)
785  {
786  char ErrorText[200];
787 
788  sprintf(ErrorText,"Parameter number %u is undefined (see sources/parameters.h to see parameter numbering)",i);
789  Error(ErrorText);
790  }
791  }
792 
794  Error("SMALL_SIGMA can not be larger than SIGMA");
795 
797  Error("EPSILON can not be larger than SIGMA");
798 
800  Error("DELTA can not be larger than R");
801 
802  fclose(ReadParametersin);
803  }
804 
805  return(fileExists);
806 }
#define CT_R
Ball radius in atlas.
Definition: parameters.h:257
Definition of the boolean type.
#define PQP
One of the possible collison detection engines.
Definition: parameters.h:87
#define TANGENT_SAMPLING
One of the possible sampling modes.
Definition: parameters.h:174
#define REP_JOINTS
One of the possible values of the REPRESENTATION parameter.
Definition: parameters.h:60
#define CT_SR
Sampling ball in atlas.
Definition: parameters.h:266
#define CT_EPSILON
Numerical tolerance.
Definition: parameters.h:194
#define FALSE
FALSE.
Definition: boolean.h:30
#define REP_FLINKS
One of the possible values of the REPRESENTATION parameter.
Definition: parameters.h:37
#define REP_LINKS
One of the possible values of the REPRESENTATION parameter.
Definition: parameters.h:27
#define NOCD
One of the possible collison detection engines.
Definition: parameters.h:141
#define CT_SMALL_SIGMA
Box size threshold.
Definition: parameters.h:229
#define CT_SPLIT_TYPE
Split type.
Definition: parameters.h:346
#define CT_NFAIL_MAX
Number of successive trnasition test failues requiered before increasing the temperature.
Definition: parameters.h:460
#define CT_LR2TM_S
Threshold to switch from linear relaxations to Taylor models for saddle equations.
Definition: parameters.h:398
#define CT_MAX_PLANNING_TIME
Maximum time for path planning.
Definition: parameters.h:475
#define CT_RRT_GRAPH
Graph RRT.
Definition: parameters.h:518
#define CT_SAMPLING
Sampling mode.
Definition: parameters.h:563
#define CT_GAMMA
Contant part of the search radius for nearest neightours in RRT*.
Definition: parameters.h:325
#define TRUE
TRUE.
Definition: boolean.h:21
#define CT_SAFE_SIMPLEX
Trade off between speed and numerical stability when using the simplex.
Definition: parameters.h:358
boolean ReadParameters(char *file, Tparameters *p)
Reads a parameter set from a file.
void Error(const char *s)
General error function.
Definition: error.c:80
#define RIGIDCLL
One of the possible collison detection engines.
Definition: parameters.h:132
#define CT_SIGMA
Box size threshold.
Definition: parameters.h:236
#define CT_ATLASGBF_BETA
Cost penalty factor for atlasGBF.
Definition: parameters.h:289
#define CT_MAX_PLANNING_ITERATIONS
Maximum iterations for path planning.
Definition: parameters.h:483
#define CT_BI_RRT
Bi-directional RRT.
Definition: parameters.h:508
Error and warning functions.
#define CT_MAX_CHARTS
Maximum number of charts in an atlas.
Definition: parameters.h:490
#define CT_CUT_X
Limit of domain of the X dimension of 3d plots.
Definition: parameters.h:420
#define FCL
One of the possible collison detection engines.
Definition: parameters.h:96
#define NPARAMETERS
Total number of parameters.
Definition: parameters.h:570
#define CT_CUT_Z
Limit of domain of the Z dimension of 3d plots.
Definition: parameters.h:444
#define KDTREE_SAMPLING
One of the possible sampling modes.
Definition: parameters.h:162
#define CT_LR2TM_Q
Threshold to switch from linear relaxations to Taylor models for quadratic equations.
Definition: parameters.h:389
Definitions of constants and macros used in several parts of the cuik library.
#define C_FCL
One of the possible collison detection engines.
Definition: parameters.h:105
#define CT_CD_ENGINE
Collision detection engine.
Definition: parameters.h:542
A table of parameters.
#define VCOLLIDE
One of the possible collison detection engines.
Definition: parameters.h:78
#define CT_RHO
Reduction threshold.
Definition: parameters.h:222
#define M_PI
Pi.
Definition: defines.h:83
#define CT_REPRESENTATION
Representation.
Definition: parameters.h:215
#define CT_N_SOLUTIONS
Number of solution boxes to deliver.
Definition: parameters.h:304
#define CT_DUMMIFY
Dummification level.
Definition: parameters.h:339
#define CT_DYNAMIC_DOMAIN
Dynamic domain.
Definition: parameters.h:533
boolean ParameterSet(unsigned int n, Tparameters *p)
Checks if a parameter is already defined.
Definition: parameters.c:131
#define AMBIENT_SAMPLING
One of the possible sampling modes.
Definition: parameters.h:151
#define CT_MAX_NEWTON_ITERATIONS
Maximum number of iterations in the Newton-Raphson function.
Definition: parameters.h:311
#define CT_E
Chart error in atlas.
Definition: parameters.h:243
double GetParameter(unsigned int n, Tparameters *p)
Gets the value for a particular parameter.
Definition: parameters.c:93
#define CT_CUT_Y
Limit of domain of the Y dimension of 3d plots.
Definition: parameters.h:432
#define CT_STATE_PERIOD
Period between two consecutive savings of the state.
Definition: parameters.h:296
#define C_BULLET
One of the possible collison detection engines.
Definition: parameters.h:123
#define INF
Infinite.
Definition: defines.h:70
#define CT_DELTA
Size of the steps in the path connecting two configurations.
Definition: parameters.h:282
#define CT_COEF_TEMP
Scale factor of the temperature parameter for Transition-based RRT.
Definition: parameters.h:451
#define CT_N_DOF
Dimensionality of the solution space for the mechanism at hand.
Definition: parameters.h:318
unsigned int RPNline
Number of the line currently parsed when reading a .param file.
Definition: error.c:78
#define BULLET
One of the possible collison detection engines.
Definition: parameters.h:114
#define CT_DETECT_BIFURCATIONS
TRUE (or 1) if bifurcation must be detected.
Definition: parameters.h:468
#define CT_VDW_RATIO
Ratio over over the Van der Waals radius.
Definition: parameters.h:408
void SetParameter(unsigned int n, char *name, double v, Tparameters *p)
Sets the name and value for a particular parameter.
Definition: parameters.c:139
Definition of the Tparameters type and the associated functions.
#define CT_CE
Chart error in atlas.
Definition: parameters.h:250
#define CT_SIMPLIFICATION_LEVEL
Simplification level.
Definition: parameters.h:378
#define CT_MAX_NODES_RRT
Maximum number of nodes in an RRT.
Definition: parameters.h:497
#define SOLID
One of the possible collison detection engines.
Definition: parameters.h:69
#define REP_QLINKS
One of the possible values of the REPRESENTATION parameter.
Definition: parameters.h:48