00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef PL_Sequential_h
00012 #define PL_Sequential_h 1
00013
00014
00015
00016
00017 #pragma warning( push )
00018 #pragma warning( disable : 4250 )
00019
00020
00021
00022 #include <stdio.h>
00023 #include <math.h>
00024 #include "Planners\sequential\sp3dstct.h"
00025 #include "Planners\sequential\spfiles.h"
00026
00027 #ifdef PC_PROTO
00028 #include <planners\output\o_bitmap.h>
00029 #endif
00030
00031
00032
00033 #include "Planners\PL_Boolean_Output.h"
00034 #include "Planners\PL_OpenGL.h"
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049 class PL_Sequential
00050 :
00051 public PL_Boolean_Output,
00052 public PL_OpenGL
00053 {
00054
00055
00056
00057 public:
00058
00059 virtual ~PL_Sequential();
00060
00061
00062 virtual bool DrawExplicit () const;
00063
00064
00065 virtual bool Plan ();
00066
00067
00068 void initialize_parameters ();
00069
00070
00071 virtual void SetCollisionDetector (CD_BasicStyle* collisionDetector);
00072
00073
00074
00075
00076 protected:
00077
00078
00079
00080
00081 private:
00082
00083
00084
00085 void convert_angle_to_index() ;
00086 int rad_to_index(double angle) ;
00087 double index_to_rad( int index ) ;
00088 void allocate_space_for_link_cs(int L) ;
00089 void allocate_space_for_working_tq_path() ;
00090 void allocate_space_for_Link_tq_path(int link1, int length);
00091 void free_space_for_link_cs(int L);
00092 int plan_path_for_first_link() ;
00093 int plan_path_for_nth_link( int lnkno,
00094 TQLinkCSpace *ptqlink,
00095 TQConfig *pblock,
00096 TQConfig *pblock_last,
00097 int *bl,
00098 int *BT_Flag,
00099 int *block_flag,
00100 int *narrow_flag);
00101 char **malloc2D ( int dy , int dz , int oc );
00102 void retrieve_global_path(double **globalpath, int pathlen,
00103 double *startdof, double *goaldof);
00104 void write_map(char *flnm, FileType filetype,
00105 char **map, int dimx, int dimy, int bitsize);
00106 void write_global_path(char *flnm, int length, int degree, double **gpath);
00107 int smoothpath(int nb_degree, int intervals, double **dofpath, int *pathlen);
00108 int compute_a_column_for_link_cspace(TQLinkCSpace *tqlcs,
00109 int lnkno,
00110 int col,
00111 TQConfig *para);
00112 void write_linkpath(char *flnm, FileType filetype,
00113 char *map, int dim, int bitsize);
00114 void write_linkpathtxt(char *flnm,
00115 TQConfig *map, int dim);
00116 void write_tqif(char *flnm, TQConfig tqi, TQConfig tqf);
00117 int compute_cspace_obstacle_map(int lnkno);
00118 void modify_cspace_obstacle_map(TQLinkCSpace *ptqlink,
00119 TQConfig *tqi,
00120 TQConfig *tqf,
00121 TQConfig *pblock,
00122 int len,
00123 int L1,
00124 int *BT_FLAG,
00125 int *narrow_flag);
00126 int find_main_path(
00127 int lnkno,
00128 IntPoint *tqinitial,
00129 IntPoint *tqfinal,
00130 TQLinkCSpace *ptqlink,
00131 LinkPath *result,
00132 int *narrow_flag);
00133 void find_forward_extension( int lnkno,
00134 IntPoint *tqinitial,
00135 IntPoint *tqfinal,
00136 TQLinkCSpace *ptqlink,
00137 LinkPath *result);
00138 void find_backward_extension( int lnkno,
00139 IntPoint *tqinitial,
00140 IntPoint *tqfinal,
00141 TQLinkCSpace *ptqlink,
00142 LinkPath *result);
00143 void combine_three_paths( LinkPath *combpath,
00144 LinkPath *mainpath,
00145 LinkPath *frwdpath,
00146 LinkPath *bkwdpath,
00147 int *iposition,
00148 int *fposition);
00149 void reparameterize_path( int bound,
00150 LinkPath *whole_path,
00151 LinkPath *result,
00152 int *ipos,
00153 int *fpos,
00154 int L1);
00155 int line_free(double **dofpath, int intervals, int start, int end,
00156 double **tmppath, int *path_len);
00157 int shift_dofpath(double **dofpath,
00158 int pathlen,
00159 double **gpath,
00160 int npathlen,
00161 int pt1,
00162 int pt2);
00163 void free2D(void **pp);
00164 void distance2d( unsigned char **in, int dimx, int dimy, short int **V, unsigned char **voro);
00165 void voro_heuristic2d(unsigned char **in,
00166 int dimx,
00167 int dimy,
00168 IntPoint goal,
00169 short int **V,
00170 unsigned char **voro,
00171 short int **heurpot,
00172 int *flag);
00173 void find_path_by_heuristic( LinkPath *result,
00174 short int **heurpot,
00175 int dimx,
00176 int dimy,
00177 IntPoint *start,
00178 IntPoint *goal);
00179 double qdist(double *q1, double *q2);
00180 int insert (int xx, int yy, IntPoint **FRONT, IntPoint *PFRONT, int nbfront, short int **V);
00181 int deletemin (int xx, int yy, IntPoint **FRONT, int nbfront, short int **V);
00182
00183
00184 int debug,
00185 arm_degree,
00186
00187 dimt[MAX_DEGREE],
00188 dimq[MAX_DEGREE];
00189
00190 unsigned char *wall;
00191
00192
00193 double COEFD_Q, COEFQ_D;
00194
00195
00196
00197
00198
00199
00200
00201 double *orig_initial_config, *orig_final_config;
00202 IntConfig initial_config, final_config;
00203 JointLimit original_joint_limit[MAX_DEGREE];
00204 IntJointLimit joint_limit[MAX_DEGREE];
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216 TQCSpace tqcs;
00217
00218 LinkPath *lnkcps, bkwdpath, frwdpath, mainpath, combpath;
00219
00220
00221
00222 TQConfig initial_tq[MAX_DEGREE], final_tq[MAX_DEGREE];
00223
00224 double **globalpath;
00225 int globaldim;
00226
00227 char datadir[40];
00228
00229 int max_level, max_bt_no;
00230
00231 int sp_debug_level;
00232 double distance_detect_range;
00233
00234
00235 int BT_level, BT_level_test, BT_number[MAX_BACKTRACKING_LEVEL+2];
00236
00237
00238 private:
00239
00240
00241
00242
00243 };
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253 #pragma warning( pop )
00254 #endif