nd.h
00001 00002 /*************************************************************************************/ 00003 /* */ 00004 /* File: nd.h */ 00005 /* Author: Javier Minguez */ 00006 /* Modified: 20/10/2005 */ 00007 /* */ 00008 /* This library implements a mixture between: */ 00009 /* */ 00010 /* J. Minguez, L. Montano. */ 00011 /* Nearness Diagram Navigation (ND): Collision Avoidance in Troublesome Scenarios. */ 00012 /* IEEE Transactions on Robotics and Automation, pp 154, 2004. */ 00013 /* */ 00014 /* */ 00015 /* J. Minguez, J. Osuna, L. Montano. */ 00016 /* A Divide and Conquer Strategy based on Situations */ 00017 /* to Achieve Reactive Collision Avoidance in Troublesome Scenarios. */ 00018 /* IEEE International Conference on Robotics and Automation (ICRA 2004), */ 00019 /* 2004. New Orleans, USA. */ 00020 /* */ 00021 /*************************************************************************************/ 00022 00023 00024 /*****************************************************************************/ 00025 // 00026 // EVERYTHING IN THE INTERNATIONAL SYSTEM (METERS AND RADIANS) 00027 // 00028 /*****************************************************************************/ 00029 00030 00031 #ifndef nd_h 00032 #define nd_h 00033 00034 // ---------------------------------------------------------------------------- 00035 // GENERIC TYPES 00036 // ---------------------------------------------------------------------------- 00037 00038 // Cartesian coordinates. 00039 00040 typedef struct { 00041 float x; 00042 float y; 00043 } TCoordenadas; 00044 00045 // System of reference 00046 00047 typedef struct { 00048 TCoordenadas posicion; 00049 float orientacion; 00050 } TSR; 00051 00052 00053 00054 // ---------------------------------------------------------------------------- 00055 // SPECIFIC TYPES. 00056 // ---------------------------------------------------------------------------- 00057 00058 00059 00060 // ************************ 00061 00062 // TParametrosND (information of the robot and laser for the ND) 00063 00064 typedef struct { 00065 00066 // GEOMETRY 00067 // The vehicle is considered to be symetric at both sides of the X axis. 00068 // The flag is 1 if the robot is resctangular, 0 if it is circular 00069 short int geometryRect; 00070 00071 // --- RECTANGULAR --- 00072 // distance (m) from the wheels to the: 00073 // front: frontal part 00074 // back: back part 00075 // left: left side. Notice that the vehicle is symetric 00076 float front,back,left; 00077 00078 // --- CIRCULAR --- 00079 // radius of the robot is is circular 00080 float R; 00081 00082 // MOTION 00083 // The falg is 1 if the robot is holonomous, or 0 is diff-drive or syncro 00084 short int holonomic; 00085 00086 // Maximum linear and angular velocities 00087 float vlmax,vamax; 00088 00089 // Maximum linear and angular acelerations 00090 float almax,aamax; 00091 00092 // OTHER STUFF 00093 00094 // -- SECURITY DISTANCE --- 00095 // Distance to consider an obstacle dangerous (i.e. to start the avoidance maneouvre) 00096 // dsmax: Distance from the frontal robot bounds. 00097 // dsmin: Distance from the back robot bounds. 00098 // engorde: Inner value. The suggestion is 20% of the dsmin (i.e. 0.2*dsmin) 00099 float dsmax,dsmin,enlarge; 00100 00101 // -- DISCONTINUITY -- 00102 // Minimum space where the robot fits. I suggest same value than "izquierda" value. 00103 float discontinuity; 00104 00105 // -- SAMPLING PERIOD -- 00106 float T; 00107 00108 // LASER 00109 // Distance from the wheels axis to the laser, X axis. 00110 //float laser; 00111 00112 } TParametersND; 00113 00114 // ************************************** 00115 00116 00117 00118 00119 00120 00121 // ************************ 00122 00123 // TVelocities (information of linear v, and angular velocities w) 00124 00125 typedef struct { 00126 float v; // linear velocity 00127 float w; // angular velocity 00128 float v_theta; // velocity angle (just if holonomous vehicle) 00129 } TVelocities; 00130 00131 // ************************************** 00132 00133 00134 00135 00136 00137 // ************************ 00138 00139 // TInfoMovimiento (information of the robot) 00140 00141 typedef struct { 00142 TSR SR1; // Current vehicle location in GLOBAL coordinates 00143 TVelocities velocidades; // Current vehicle velocities 00144 } TInfoMovimiento; 00145 00146 // ************************************** 00147 00148 00149 00150 00151 // ************************ 00152 00153 // TInfoEntorno (list of obstacle points) 00154 00155 // Maximum number of points of the environment 00156 // This number depends on the maximum number of obstacle points that 00157 // you want to give to the ND 00158 00159 //#define MAX_POINTS_SCENARIO 1440 00160 #define MAX_POINTS_SCENARIO 10000 00161 00162 typedef struct { 00163 int longitud; 00164 TCoordenadas punto[MAX_POINTS_SCENARIO]; 00165 } TInfoEntorno; 00166 00167 // ************************************** 00168 00169 00170 00171 00172 00173 // ---------------------------------------------------------------------------- 00174 // FUNCTIONS 00175 // ---------------------------------------------------------------------------- 00176 00177 00178 00179 00180 // ********************************** 00181 // This function initialites the ND 00182 // Input-- 00183 // parametros:: information of the robot and laser used by the ND 00184 // Ouput-- 00185 00186 void InicializarND(TParametersND *parametros); 00187 00188 // ********************************** 00189 00190 00191 00192 00193 00194 00195 // ********************************** 00196 // This runs the ND. The input is the current obstacle list and the goal location 00197 // and the output the motion command. 00198 // Input-- 00199 // objetivo:: current objective in GLOBAL coordinates. Notice that this 00200 // location can change each time you call ND. 00201 // movimiento:: this is the current velocity of the robot. 00202 // mapa:: this is a list of the obstacle points in global coordinates. 00203 // You can use the current sensor reading or implement a kind of memory 00204 // to remember last scans. Whatever, ND wants a list of points in GLOBAL coordinates. 00205 // information:: variable for debug. 00206 // 00207 // Ouput-- 00208 // movimiento:: this is the output of the ND. 00209 // * Linear and angular velocities (and direction if holonomic). 00210 // * NULL an emergency stop is required 00211 // * pointer to (0,0) goal reached. 00212 00213 extern TVelocities *IterarND(TCoordenadas objetivo, 00214 float goal_tol, 00215 TInfoMovimiento *movimiento, 00216 TInfoEntorno *mapa, 00217 void *informacion); 00218 // if you do not want to see the internal information in nh2.h informacion = NULL 00219 00220 // ********************************** 00221 00222 00223 #endif 00224