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 
#define FALSE
FALSE.
Definition: boolean.h:30
void DeleteRRT(Trrt *rrt)
Destructor.
Definition: rrt.c:4201
Data structure to hold the information about the name of a file.
Definition: filename.h:271
#define RRT_EXT
File extension for files storing rrt's.
Definition: filename.h:213
void SaveRRTNodes(Tparameters *pr, char *fname, boolean saveWithDummies, Trrt *rrt)
Stores the nodes of the RRT.
Definition: rrt.c:3883
Definition of the Tfilename type and the associated functions.
#define PARAM_EXT
File extension for parameter files.
Definition: filename.h:132
A RRT on a manifold.
Definition: rrt.h:322
#define CS_WD_DELETE(wcs)
Destructor of the equation structure.
Definition: wcs.h:592
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:4041
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
#define CS_WD_EXT
Possible extensions for the equation files.
Definition: wcs.h:48
void DeleteParameters(Tparameters *p)
Destructor.
Definition: parameters.c:294
#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.
int main(int argc, char **arg)
Main body of the cuikrrtnodes application.
Definition: cuikrrtnodes.c:65