Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of autonomous Robot Android by
defines.h
00001 #ifndef _DEFINES_H_ 00002 #define _DEFINES_H_ 00003 00004 /*! \file defines.h 00005 \brief All defines for the roboter you can see here. 00006 */ 00007 #include "mbed.h" 00008 00009 /** 00010 * @name Physical dimensions π; 00011 * @{ 00012 */ 00013 #define PI 3.141592654f 00014 /*! @} */ 00015 00016 /** 00017 * @name maxon motor #339282 EC 45 flat 30W 00018 * @{ 00019 */ 00020 00021 /** 00022 * @brief Number of of pole pairs 00023 */ 00024 #define POLE_PAIRS 8u 00025 00026 /** 00027 * @brief Gear on the motor 1/11.6f 00028 */ 00029 #define GEAR 1/11.6f 00030 00031 /** 00032 * @brief Pulses per electrical step form the Hallsensor, have 6 steps 00033 */ 00034 #define PULSES_PER_STEP 6u 00035 /*! @} */ 00036 00037 /** 00038 * @name Physical Dimension of the car 00039 * @{ 00040 */ 00041 00042 /** 00043 * @brief Value for the diffrerenz between left an right, given in [m] 00044 */ 00045 #define WHEEL_RADIUS_DIFF 0.0001f 00046 00047 /** 00048 * @brief Radius of the left wheel, given in [m] kleiner --> weiter 00049 */ 00050 #define WHEEL_RADIUS_LEFT 0.040190f 00051 00052 /** 00053 * @brief Radius of the left wheel, given in [m] 00054 */ 00055 #define WHEEL_RADIUS_RIGHT (WHEEL_RADIUS_LEFT - WHEEL_RADIUS_DIFF) 00056 00057 /** 00058 * @brief Distance of the wheel, given in [m] Greater --> turn more 00059 */ 00060 #define WHEEL_DISTANCE (0.1700f-0.001f) // org.0.17500f alt: 0.173f //(0.1700f-0.004f) immer zu weit links (0.1700f-0.006f) war mal gut aber jetz zu weit rechts 00061 00062 /** 00063 * @brief Sets the start X-point, given in [m] 00064 */ 00065 #define START_X_OFFSET -0.850f//-0.8f 00066 00067 /** 00068 * @brief Sets the start Y-point, given in [m] 00069 */ 00070 #define START_Y_OFFSET 0.775f//0.8f 00071 /*! @} */ 00072 00073 /** 00074 * @name State Bits of the car 00075 * @{ 00076 */ 00077 00078 /** 00079 * @brief Bit0 = stop pressed 00080 */ 00081 #define STATE_STOP 1u 00082 00083 /** 00084 * @brief Bit1 = Undervoltage battery 00085 */ 00086 #define STATE_UNDER 2u 00087 00088 /** 00089 * @brief Bit2 = left ESCON in error state 00090 */ 00091 #define STATE_LEFT 4u 00092 00093 /** 00094 * @brief Bit3 = right ESCON in error state 00095 */ 00096 #define STATE_RIGHT 8u 00097 /*! @} */ 00098 00099 /** 00100 * @name ESCON Constands 00101 * 00102 * @{ 00103 */ 00104 00105 /** 00106 * @brief Speed Factor how set in the ESCON Studio 00107 */ 00108 #define ESCON_SET_FACTOR 2400.0f 00109 00110 /** 00111 * @brief Speed Factor how get in the ESCON Studio 00112 */ 00113 #define ESCON_GET_FACTOR 2500.0f 00114 00115 /** 00116 * @brief Error patch of the drift of Analog input and pwn output for set speed 00117 */ 00118 #define SET_SPEED_PATCH (1+0.00262f) 00119 00120 /** 00121 * @brief Error patch of the drift of Analog input and pwn output for get speed 00122 */ 00123 #define GET_SPEED_PATCH (1+0.0019f) 00124 /*! @} */ 00125 00126 /** 00127 * @name position controller 00128 * @{ 00129 */ 00130 00131 /** 00132 * @brief Main Gain for k1, k2 and k3 00133 */ 00134 #define GAIN 0.65f 00135 00136 /** 00137 * @brief Gain k1 default 1.0f 00138 */ 00139 #define K1 1.45f * GAIN 00140 00141 /** 00142 * @brief Gain k2 default 3.0f 00143 */ 00144 #define K2 3.0f * GAIN 00145 00146 /** 00147 * @brief Gain k3 default 2.0f 00148 */ 00149 #define K3 2.0f * GAIN 00150 00151 /** 00152 * @brief Min. Distance to switch the position controller off. 00153 * Because when Distance Error goes to zero the ATAN2 is not define, given in [m] 00154 */ 00155 #define MIN_DISTANCE_ERROR 0.045f 00156 /*! @} */ 00157 00158 /** 00159 * @name Batterie control Battery Type: 1SP1P LG-18650 00160 * nominal voltage 3.6V 00161 * 5 batterys ==> 5 * 3.5V = 17.5V 00162 * @{ 00163 */ 00164 00165 /** 00166 * @brief Battery Multiplicator for the potential divider. 00167 * 00168 * R2 / (R1 + R2) = 0.153 R2= 10k , R1 = 1.8k 1/0.153 = 6.555 --> 3.3 * 6.555 = 21.6333333f 00169 */ 00170 #define BAT_MULTIPLICATOR 21.633333333f 00171 00172 /** 00173 * @brief minium operate voltage, given in [V] 00174 */ 00175 #define BAT_MIN 17.5f 00176 /*! @} */ 00177 00178 /** 00179 * @name sampling rate for a Task Object 00180 * @{ 00181 */ 00182 00183 /** 00184 * @brief 1kHz Rate for Robot Control, given in [s] 00185 */ 00186 #define PERIOD_ROBOTCONTROL 0.001f 00187 00188 /** 00189 * @brief 1kHz Rate for State Objekt , given in [s] 00190 */ 00191 #define PERIOD_STATE 0.001f 00192 00193 /** 00194 * @brief 10Hz Rate for the Android communication , given in [s] 00195 */ 00196 #define PERIOD_ANDROID (0.035f*2) //(0.025f*2) 00197 /*! @} */ 00198 00199 00200 /** 00201 * @brief struct state 00202 * structure containing system sensor data 00203 */ 00204 typedef struct state { 00205 /** @brief millis Time [ms]*/ 00206 int millis; 00207 /** @brief Battery voltage [V] */ 00208 float voltageBattery; 00209 /** @brief Number of pulses left */ 00210 int leftPulses; 00211 /** @brief Number of pulses right */ 00212 int rightPulses; 00213 /** @brief Velocity left [m/s] */ 00214 float leftVelocity; 00215 /** @brief Velocity right [m/s] */ 00216 float rightVelocity; 00217 /** @brief Velocity of the car [m/s] */ 00218 float velocity; 00219 /** @brief Velocity rotation [°/s] */ 00220 float omega; 00221 /** @brief X-Axis from co-ordinate [m] */ 00222 float xAxis; 00223 /** @brief Y-Axis from co-ordinate [m] */ 00224 float yAxis; 00225 /** @brief X-Axis Error [m] */ 00226 float xAxisError; 00227 /** @brief X-Axis Error [m] */ 00228 float yAxisError; 00229 /** @brief Angle Error [°] */ 00230 float angleError; 00231 /** @brief Angle from Car [°] */ 00232 float angle; 00233 /** @brief Setpoint X-Axis [m] */ 00234 float setxAxis; 00235 /** @brief Setpoint Y-Axis [m] */ 00236 float setyAxis; 00237 /** @brief Setpoint Angel [°] */ 00238 float setAngle; 00239 /** @brief Setpoint velocitiy [m/s] */ 00240 float setVelocity; 00241 /** @brief Setpoint rotation velocitiy [rad/s] */ 00242 float setOmega; 00243 /** @brief State of the car */ 00244 int state; 00245 /** @brief distance to Goal */ 00246 float rho; 00247 /** @brief theta to goal */ 00248 float lamda; 00249 /** @brief theta from the goal */ 00250 float delta; 00251 } state_t; 00252 00253 00254 00255 #endif
Generated on Tue Jul 12 2022 14:15:58 by
1.7.2
