cuikrrtnodes.c
Go to the documentation of this file.
1 
2 #include "world.h"
3 #include "parameters.h"
4 
5 #include "defines.h"
6 #include "error.h"
7 #include "filename.h"
8 #include "rrt.h"
9 
10 #include <stdlib.h>
11 
65 int main(int argc, char **arg)
66 {
67  TAtlasBase world; /* The set of mechanism and obstacles. */
68  Tparameters parameters; /* Parameters used in the Cuik process. */
69  Trrt rrt; /* The rrt to process. */
70 
71  Tfilename fparam;
72  Tfilename frrt;
73 
74  boolean withDummies;
75 
76  if (argc>1)
77  {
78  /*Init parameters*/
79  CreateFileName(NULL,arg[1],NULL,PARAM_EXT,&fparam);
80  fprintf(stderr,"Reading parameters from : %s\n",GetFileFullName(&fparam));
81  InitParametersFromFile(GetFileFullName(&fparam),&parameters);
82 
83  /*Read the world/cuik from file*/
84  CS_WD_INIT(&parameters,arg[1],&world);
85 
86  CreateFileName(NULL,arg[1],NULL,RRT_EXT,&frrt);
87  fprintf(stderr,"Reading rrt from : %s\n",GetFileFullName(&frrt));
88 
89  LoadRRT(&parameters,&frrt,&world,&rrt);
90 
91  if (argc>2)
92  withDummies=atoi(arg[2]);
93  else
94  withDummies=FALSE;
95 
96  SaveRRTNodes(&parameters,arg[1],withDummies,&rrt);
97 
98  DeleteParameters(&parameters);
99 
100  CS_WD_DELETE(&world);
101  DeleteRRT(&rrt);
102 
103  DeleteFileName(&frrt);
104  DeleteFileName(&fparam);
105  }
106  else
107  {
108  fprintf(stderr," Wrong number of parameters.\n");
109  fprintf(stderr," Use:\n");
110  fprintf(stderr," cuikrrtnodes <problem filename>.%s [dummies]\n",CS_WD_EXT);
111  fprintf(stderr," where <problem filename> is the RRT with the nodes to extract.\n");
112  fprintf(stderr," [dummies] is 1 if you want the dummy variables in the output.\n");
113  fprintf(stderr," This is only necessary if you plan to unsimplify the\n");
114  fprintf(stderr," output points (default 0).\n");
115 
116  }
117  return(EXIT_SUCCESS);
118 }
119