cuikrrtcosts.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  if (argc>1)
75  {
76  /*Init parameters*/
77  CreateFileName(NULL,arg[1],NULL,PARAM_EXT,&fparam);
78  fprintf(stderr,"Reading parameters from : %s\n",GetFileFullName(&fparam));
79  InitParametersFromFile(GetFileFullName(&fparam),&parameters);
80 
81  /*Read the world/cuik from file*/
82  CS_WD_INIT(&parameters,arg[1],&world);
83 
84  CreateFileName(NULL,arg[1],NULL,RRT_EXT,&frrt);
85  fprintf(stderr,"Reading rrt from : %s\n",GetFileFullName(&frrt));
86 
87  LoadRRT(&parameters,&frrt,&world,&rrt);
88 
89  SaveRRTCosts(&parameters,arg[1],&rrt);
90 
91  DeleteParameters(&parameters);
92 
93  CS_WD_DELETE(&world);
94  DeleteRRT(&rrt);
95 
96  DeleteFileName(&frrt);
97  DeleteFileName(&fparam);
98  }
99  else
100  {
101  fprintf(stderr," Wrong number of parameters.\n");
102  fprintf(stderr," Use:\n");
103  fprintf(stderr," cuikrrtcosts <problem filename>.%s\n",CS_WD_EXT);
104  fprintf(stderr," where <problem filename> is the RRT with the costs to extract.\n");
105 
106  }
107  return(EXIT_SUCCESS);
108 }
109