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 
void DeleteRRT(Trrt *rrt)
Destructor.
Definition: rrt.c:4196
Data structure to hold the information about the name of a file.
Definition: filename.h:248
#define RRT_EXT
File extension for files storing rrt's.
Definition: filename.h:205
Definition of the Tfilename type and the associated functions.
#define PARAM_EXT
File extension for parameter files.
Definition: filename.h:131
void SaveRRTCosts(Tparameters *pr, char *fname, Trrt *rrt)
Stores the cost associated with the nodes of the RRT.
Definition: rrt.c:3929
A RRT on a manifold.
Definition: rrt.h:329
#define CS_WD_DELETE(wcs)
Destructor of the equation structure.
Definition: wcs.h:500
Definition of the Tworld type and the associated functions.
void LoadRRT(Tparameters *pr, Tfilename *fname, TAtlasBase *w, Trrt *rrt)
Defines a RRT from the information on a file.
Definition: rrt.c:4036
Definition of a rrt on a manifold.
Error and warning functions.
void DeleteFileName(Tfilename *fn)
Destructor.
Definition: filename.c:205
Definitions of constants and macros used in several parts of the cuik library.
A table of parameters.
void CreateFileName(char *path, char *name, char *suffix, char *ext, Tfilename *fn)
Constructor.
Definition: filename.c:22
void InitParametersFromFile(char *file, Tparameters *p)
Constructor from a file.
Definition: parameters.c:51
Type defining the equations on which the atlas is defined.
Definition: wcs.h:30
char * GetFileFullName(Tfilename *fn)
Gets the file full name (paht+name+extension).
Definition: filename.c:151
int main(int argc, char **arg)
Main body of the cuikrrtcosts application.
Definition: cuikrrtcosts.c:65
#define CS_WD_EXT
Possible extensions for the equation files.
Definition: wcs.h:48
void DeleteParameters(Tparameters *p)
Destructor.
Definition: parameters.c:295
#define CS_WD_INIT(pr, name, wcs)
Initializes the equations from a file.
Definition: wcs.h:89
Definition of the Tparameters type and the associated functions.