[70] | 1 | #ifndef GENERALDEFINITIONS
|
---|
| 2 | #define GENERALDEFINITIONS
|
---|
| 3 |
|
---|
| 4 | #define _CRT_SECURE_NO_WARNINGS
|
---|
| 5 |
|
---|
| 6 | //#define WIFIBOT_ROBOT
|
---|
| 7 | #define CAR_LIKE_ROBOT
|
---|
| 8 |
|
---|
| 9 | namespace pacpus {
|
---|
| 10 |
|
---|
| 11 | #define MS_DELAY 10
|
---|
| 12 | #define PI_VALUE 3.1415926535897932
|
---|
| 13 | //#define DELTA_T 0.1 // Time in seconds estimated for each interaction
|
---|
| 14 |
|
---|
| 15 | #ifdef WIFIBOT_ROBOT
|
---|
| 16 | //---------------- Wifibot DSPIC constraints ----------------------
|
---|
| 17 | #define SIZE_MSG_RECEIVE 21
|
---|
| 18 | #define SIZE_MSG_SEND 9
|
---|
| 19 | #define SIZE_MSG_PID_SEND 11
|
---|
| 20 |
|
---|
| 21 | #define W_SPEED_MAX 360
|
---|
| 22 |
|
---|
| 23 | //-----------------------------------------------------------------
|
---|
| 24 |
|
---|
| 25 | //------------------- WIFIBOT constraints -------------------------
|
---|
| 26 | #define W_WHEEL_R 0.07 // Wheel radius
|
---|
| 27 | #define W_DIST_L 0.19 // Distance from the robot frame to the wheel
|
---|
| 28 |
|
---|
| 29 | // Robot dimentions
|
---|
| 30 | #define W_LEFT -0.20 // negative
|
---|
| 31 | #define W_RIGHT 0.20 // positive
|
---|
| 32 | #define W_FRONT 0.20 // positive
|
---|
| 33 | #define W_BACK -0.20 // negative
|
---|
| 34 | #define W_ENLARGEMENT 0.2
|
---|
| 35 |
|
---|
| 36 | // REAL LIMIT
|
---|
| 37 | //#define W_V1_MAX 1.355 // Desired max robot linear velocity (m/s)
|
---|
| 38 | //#define W_V1_MIN 0.0 // Min robot linear Velocity (m/s)
|
---|
| 39 | //#define W_V1_ACC 0.6 // Max acceleration and desacceleration (m/s^2)
|
---|
| 40 | //#define W_V2_MAX (W_V1_MAX/W_DIST_L) // Max robot angular velocity (rad/s)
|
---|
| 41 | //#define W_V2_ACC (W_V1_ACC/W_DIST_L) // Max acceleration and desacceleration (rad/s^2)
|
---|
| 42 | //#define W_DELTA_V1 0.008 // Smallest linear velocity variation (m/s)
|
---|
| 43 | //#define W_DELTA_V2 (W_DELTA_V1/(2.0*W_DIST_L)) // Smallest angle velocity variation (rad)
|
---|
| 44 | //#define W_WHEEL_ANGULAR_VELOCITY_MAX (W_V1_MAX/W_WHEEL_R) // Max robot wheel angular velocity (rad/s)
|
---|
| 45 |
|
---|
| 46 | // Smooth actuator limit
|
---|
| 47 | #define W_V1_MAX 0.6 // Desired max robot linear velocity (m/s)
|
---|
| 48 | #define W_V1_MIN 0.0 // Min robot linear Velocity (m/s)
|
---|
| 49 | #define W_V1_ACC 0.4 // Max acceleration and desacceleration (m/s^2)
|
---|
| 50 | #define W_V2_MAX (PI_VALUE/4.0) // Max robot angular velocity (rad/s)
|
---|
| 51 | #define W_V2_ACC (PI_VALUE/4.0) // Max acceleration and desacceleration (rad/s^2)
|
---|
| 52 | #define W_DELTA_V1 0.05 // Smallest linear velocity variation (m/s)
|
---|
| 53 | #define W_DELTA_V2 0.018 // Smallest angle velocity variation (rad)
|
---|
| 54 | #define W_WHEEL_ANGULAR_VELOCITY_MAX (W_V1_MAX/W_WHEEL_R) // Max robot wheel angular velocity (rad/s)
|
---|
| 55 |
|
---|
| 56 | // Input convertion
|
---|
| 57 | #define LINEAR_VELOCITY 125.0 // 125 (int) == 1 (m/s)
|
---|
| 58 | #define WHEEL_ANGULAR_VELOCITY 8.75 // (int) == 1 (rad/s) == 0.07 m/s
|
---|
| 59 | #define V1_MAX_INT 127.0 // Maximum robot speed
|
---|
| 60 |
|
---|
| 61 | //-----------------------------------------------------------------
|
---|
| 62 | #endif
|
---|
| 63 |
|
---|
| 64 | #ifdef CAR_LIKE_ROBOT
|
---|
| 65 |
|
---|
| 66 | //#define CAN_CARMEN
|
---|
| 67 | //#define CAN_FLUENCEZE
|
---|
| 68 | #define CAN_ZOE
|
---|
| 69 |
|
---|
| 70 | //------------------- Car constraints -------------------------
|
---|
| 71 | #ifdef CAN_CARMEN
|
---|
| 72 |
|
---|
| 73 | #define CAR_WHEEL_R 0.5 // Wheel radius
|
---|
| 74 | #define CAR_DIST_L 2.75 // Distance from the robot frame to the wheel
|
---|
| 75 |
|
---|
| 76 | // Robot dimentions
|
---|
| 77 | #define CAR_LEFT 1.05 // negative
|
---|
| 78 | #define CAR_RIGHT -1.05 // positive
|
---|
| 79 | #define CAR_FRONT 3.795 // positive
|
---|
| 80 | #define CAR_BACK -1.045 // negative
|
---|
| 81 | #define CAR_ENLARGEMENT 0.5
|
---|
| 82 |
|
---|
| 83 | // REAL LIMIT
|
---|
| 84 | //#define CAR_V1_MAX 1.355 // Desired max car linear velocity (m/s)
|
---|
| 85 | //#define CAR_V1_MIN 0.0 // Min car linear Velocity (m/s)
|
---|
| 86 | //#define CAR_V1_ACC 0.6 // Max acceleration and desacceleration (m/s^2)
|
---|
| 87 | //#define CAR_PHI_MAX 0.5061 // Max steering angle (rad) (29.0*PI_VALUE/180.0)
|
---|
| 88 | //#define CAR_V2_MAX 0.2 // Max car steering angle velocity (rad/s)
|
---|
| 89 | //#define CAR_DELTA_V1 0.008 // Smallest linear velocity variation (m/s)
|
---|
| 90 | //#define CAR_DELTA_PHI 0.002 // Smallest steering angle variation (rad)
|
---|
| 91 |
|
---|
| 92 | // Smooth actuator limit
|
---|
| 93 | #define CAR_V1_MAX 1.355 // Desired max car linear velocity (m/s)
|
---|
| 94 | #define CAR_V1_MIN 0.0 // Min car linear Velocity (m/s)
|
---|
| 95 | #define CAR_V1_ACC 0.6 // Max acceleration and desacceleration (m/s^2)
|
---|
| 96 | #define CAR_PHI_MAX 0.5061 // Max steering angle (rad) (29.0*PI_VALUE/180.0)
|
---|
| 97 | #define CAR_PHI_WHEEL_MAX 9,5993 // Max steering wheel angle (rad) (550.0*PI_VALUE/180.0)
|
---|
| 98 | #define CAR_V2_MAX 0.2 // Max car steering angle velocity (rad/s)
|
---|
| 99 | #define CAR_DELTA_V1 0.008 // Smallest linear velocity variation (m/s)
|
---|
| 100 | #define CAR_DELTA_PHI 0.002 // Smallest steering angle variation (rad)
|
---|
| 101 |
|
---|
| 102 | #else ////////////////////////////////////////////////////////////////////////////////////////////
|
---|
| 103 | #ifdef CAN_FLUENCEZE
|
---|
| 104 |
|
---|
| 105 | #define CAR_WHEEL_R 0.5 // Wheel radius
|
---|
| 106 | #define CAR_DIST_L 2.75 // Distance from the robot frame to the wheel
|
---|
| 107 |
|
---|
| 108 | // Robot dimentions
|
---|
| 109 | #define CAR_LEFT 1.05 // negative
|
---|
| 110 | #define CAR_RIGHT -1.05 // positive
|
---|
| 111 | #define CAR_FRONT 3.795 // positive
|
---|
| 112 | #define CAR_BACK -1.045 // negative
|
---|
| 113 | #define CAR_ENLARGEMENT 0.5
|
---|
| 114 |
|
---|
| 115 | // REAL LIMIT
|
---|
| 116 | //#define CAR_V1_MAX 1.355 // Desired max car linear velocity (m/s)
|
---|
| 117 | //#define CAR_V1_MIN 0.0 // Min car linear Velocity (m/s)
|
---|
| 118 | //#define CAR_V1_ACC 0.6 // Max acceleration and desacceleration (m/s^2)
|
---|
| 119 | //#define CAR_PHI_MAX 0.5061 // Max steering angle (rad) (29.0*PI_VALUE/180.0)
|
---|
| 120 | //#define CAR_V2_MAX 0.2 // Max car steering angle velocity (rad/s)
|
---|
| 121 | //#define CAR_DELTA_V1 0.008 // Smallest linear velocity variation (m/s)
|
---|
| 122 | //#define CAR_DELTA_PHI 0.002 // Smallest steering angle variation (rad)
|
---|
| 123 |
|
---|
| 124 | // Smooth actuator limit
|
---|
| 125 | #define CAR_V1_MAX 1.355 // Desired max car linear velocity (m/s)
|
---|
| 126 | #define CAR_V1_MIN 0.0 // Min car linear Velocity (m/s)
|
---|
| 127 | #define CAR_V1_ACC 0.6 // Max acceleration and desacceleration (m/s^2)
|
---|
| 128 | #define CAR_PHI_MAX 0.5061 // Max steering angle (rad) (29.0*PI_VALUE/180.0)
|
---|
| 129 | #define CAR_PHI_WHEEL_MAX 9,5993 // Max steering wheel angle (rad) (550.0*PI_VALUE/180.0)
|
---|
| 130 | #define CAR_V2_MAX 0.2 // Max car steering angle velocity (rad/s)
|
---|
| 131 | #define CAR_DELTA_V1 0.008 // Smallest linear velocity variation (m/s)
|
---|
| 132 | #define CAR_DELTA_PHI 0.002 // Smallest steering angle variation (rad)
|
---|
| 133 |
|
---|
| 134 | #else /////////////////////////////////////////////////////////////////////////////////////////////////
|
---|
| 135 | #ifdef CAN_ZOE
|
---|
| 136 |
|
---|
| 137 | #define CAR_WHEEL_R 0.31045 // Wheel radius
|
---|
| 138 | #define CAR_DIST_L 2.588 // Distance from the robot frame to the wheel
|
---|
| 139 |
|
---|
| 140 | // Robot dimentions
|
---|
| 141 | #define CAR_LEFT 0.9725 // negative
|
---|
| 142 | #define CAR_RIGHT -0.9725 // positive
|
---|
| 143 | #define CAR_FRONT 3.427 // positive
|
---|
| 144 | #define CAR_BACK -0.657 // negative
|
---|
| 145 | #define CAR_ENLARGEMENT 0.9
|
---|
| 146 | #define CAR_ENLARGEMENT2 0.3
|
---|
| 147 |
|
---|
| 148 | // REAL LIMIT
|
---|
| 149 | //#define CAR_V1_MAX 4.0 // Desired max car linear velocity (m/s)
|
---|
| 150 | //#define CAR_V1_MIN 0.0 // Min car linear Velocity (m/s)
|
---|
| 151 | //#define CAR_V1_ACC 0.6 // Max acceleration and desacceleration (m/s^2)
|
---|
| 152 | //#define CAR_PHI_MAX 0.5061 // Max steering angle (rad) (29.0*PI_VALUE/180.0)
|
---|
| 153 | //#define CAR_PHI_WHEEL_MAX 8.6394 // Max steering wheel angle (rad) (495.0*PI_VALUE/180.0)
|
---|
| 154 | //#define CAR_V2_MAX 0.5726 // Max car steering angle velocity (rad/s) (Steering wheel = 560 °/s ====> Steering = 32.8 °/s )
|
---|
| 155 | //#define CAR_V2_MIN 0.0041 // Min car steering angle velocity (rad/s) (Steering wheel = 4 °/s ====> Steering = 0.234 °/s )
|
---|
| 156 | //#define CAR_DELTA_V1 0.008 // Smallest linear velocity variation (m/s)
|
---|
| 157 | //#define CAR_DELTA_PHI 0.002 // Smallest steering angle variation (rad)
|
---|
| 158 |
|
---|
| 159 | // Smooth actuator limit
|
---|
| 160 | #define CAR_V1_MAX 4.0 // Desired max car linear velocity (m/s)
|
---|
| 161 | #define CAR_V1_MIN 0.0 // Min car linear Velocity (m/s)
|
---|
| 162 | #define CAR_V1_ACC 0.6 // Max acceleration (m/s^2)
|
---|
| 163 | #define CAR_V1_DEC -2.4 // Max deceleration (m/s^2)
|
---|
| 164 | #define CAR_PHI_MAX 0.4090 // Max steering angle (rad) (23.43*PI_VALUE/180.0)
|
---|
| 165 | #define CAR_PHI_WHEEL_MAX 6.9813 // Max steering wheel angle (rad) (400.0*PI_VALUE/180.0) >>> THIS IS THE MAXIMUM FOR DON'T CRASH THE SYSTEM
|
---|
| 166 | #define CAR_V2_MAX 0.2556 // Max car steering angle velocity (rad/s) (Steering wheel = 250 °/s ====> Steering = 14.65 °/s )
|
---|
| 167 | #define CAR_V2_MIN 0.0041 // Min car steering angle velocity (rad/s) (Steering wheel = 4 °/s ====> Steering = 0.234 °/s )
|
---|
| 168 | #define CAR_DELTA_V1 0.14 // Smallest linear velocity variation (m/s)
|
---|
| 169 | #define CAR_DELTA_PHI 0.01 // Smallest steering angle variation (rad)
|
---|
| 170 |
|
---|
| 171 | #endif // CAN_ZOE
|
---|
| 172 | #endif // CAN_FLUENCE_ZE
|
---|
| 173 | #endif // CAN_CARMEN
|
---|
| 174 | //-----------------------------------------------------------------
|
---|
| 175 |
|
---|
| 176 | #endif // CAR_LIKE_ROBOT
|
---|
| 177 |
|
---|
| 178 | //--------------- Camera Grid constraints Wifibot -----------------
|
---|
| 179 | #define D_MAX_CAM_GRID_DEFAULT 10.0 // Max distance in the grid
|
---|
| 180 | #define CAM_GRID_COLS 361 // Grid image columns
|
---|
| 181 | #define CAM_GRID_ROWS 600 // Grid image rows
|
---|
| 182 | //#define CAM_GRID_DIST 60.0 // Max distance in the grid cell (pixels/meter)
|
---|
| 183 | #define ROBOT_FRONT_DIST 2.00 // Distance from the robot front to the camera (meters) - Just for symbolic representation
|
---|
| 184 | #define ROBOT_FRONT_WIDTH 2.10 // Width of the robot front (meters) - Just for symbolic representation
|
---|
| 185 |
|
---|
| 186 | //-----------------------------------------------------------------
|
---|
| 187 |
|
---|
| 188 | //-------------- Obstacle Detection constraints -------------------
|
---|
| 189 | #define ANG_VARIATION 20.0 // Planes are equal to lines with 90° + ANG_VARIATION
|
---|
| 190 | #define ANG_VARIATION2 7.0 // Obstacles are equal to lines between 90° +- ANG_VARIATION2
|
---|
| 191 | //#define MIN_V_DISPARITY 16
|
---|
| 192 | //#define MAX_V_DISPARITY 255
|
---|
| 193 |
|
---|
| 194 | //-----------------------------------------------------------------
|
---|
| 195 |
|
---|
| 196 | //---------------- Path Following Constraints----------------------
|
---|
| 197 | #define CONTROL_DELTA_T 0.1 // Estimated time between the control loop
|
---|
| 198 | #define DWA_DELTA_T_V1 0.3 // DWA time interval for the linear velocity
|
---|
| 199 | #define DWA_DELTA_T_PHI 0.7 // DWA time interval for the angular velocity
|
---|
| 200 | #define MAX_LINE_FEATURES_OUT 5 // Maximum image lane features interactions missing
|
---|
| 201 | //-----------------------------------------------------------------
|
---|
| 202 |
|
---|
| 203 | //============= Extended Kalman Filter parameters =================
|
---|
| 204 | //---------------------- GPS ERROR --------------------------------
|
---|
| 205 | #define GPS_DELTA_X 3.0 // Standard deviation of the estimated error of x
|
---|
| 206 | #define GPS_DELTA_Y 3.0 // Standard deviation of the estimated error of y
|
---|
| 207 | #define GPS_RHO 0.0 // Spartial correlation coefficient
|
---|
| 208 | //-----------------------------------------------------------------
|
---|
| 209 |
|
---|
| 210 | //---------------------- CAN ERROR --------------------------------
|
---|
| 211 | #define CAN_DELTA_V 0.2778 // Standard deviation of the estimated error of the speed
|
---|
| 212 | #define CAN_DELTA_PHI (0.5*PI_VALUE/180.0) // Standard deviation of the estimated error of steering rad
|
---|
| 213 | //-----------------------------------------------------------------
|
---|
| 214 |
|
---|
| 215 | //------------------- VISUAL ODOMETRY ERROR -----------------------
|
---|
| 216 | #define VO_DELTA_D 0.2 // Standard deviation of the estimated error of the translation distance variation
|
---|
| 217 | #define VO_DELTA_THETA (1.0*PI_VALUE/180.0) // Standard deviation of the estimated error of the rotation variation
|
---|
| 218 | //-----------------------------------------------------------------
|
---|
| 219 |
|
---|
| 220 | //------------------------ Model error ----------------------------
|
---|
| 221 | #define MODEL_ERROR_X 0.04
|
---|
| 222 | #define MODEL_ERROR_Y 0.04
|
---|
| 223 | #define MODEL_ERROR_THETA 0.005
|
---|
| 224 | #define MODEL_ERROR_PHI 0.0
|
---|
| 225 | #define MODEL_ERROR_V1 0.0
|
---|
| 226 | //-----------------------------------------------------------------
|
---|
| 227 | //=================================================================
|
---|
| 228 |
|
---|
| 229 | //------------------- Robot State definitions ---------------------
|
---|
| 230 | #define RS_RATE 10.0 // Frequency Hz
|
---|
| 231 | #define RS_RATE_EKF 40.0 // Frequency Hz
|
---|
| 232 | //-----------------------------------------------------------------
|
---|
| 233 |
|
---|
| 234 | };
|
---|
| 235 |
|
---|
| 236 | #endif |
---|