Revision 8dced1c9 devices/DiWheelDrive/userthread.hpp

View differences:

devices/DiWheelDrive/userthread.hpp
5 5
#include <amiroosconf.h>
6 6
#include <amiro/Color.h>
7 7
// #include "global.hpp"
8
// #include "linefollow.hpp" 
8
// #include "linefollow.hpp"
9 9
#include <cmath>
10 10

  
11 11

  
......
22 22
#define DOCKING_CORRECTION_TIMEOUT 200
23 23
#define REVERSE_DOCKING_TIMEOUT 2*DOCKING_CORRECTION_TIMEOUT
24 24
#define REVERSE_ADJUSTMENT_TIMEOUT 200
25
// #define MAX_RING_PROX_VALUE_DEVIATION 
25
// #define MAX_RING_PROX_VALUE_DEVIATION
26 26

  
27 27
// Thresh for wheel proxy sensors, when summed values fall below the state changes
28 28
// #define PROXY_WHEEL_THRESH 18000
......
35 35
// #define WHITE_COUNT_THRESH 150
36 36
#define WHITE_DETETION_TIMEOUT 150
37 37
// #define RING_PROX_COUNT_THRESH 1000
38
#define RING_PROX_DETECTION_TIMEOUT 800
38
#define RING_PROX_DETECTION_TIMEOUT 400
39 39
// Rotation around 180 degrees in microradian
40 40
// #define ROTATION_180 3141592
41 41
#define ROTATION_180 3141592
......
121 121
    uint32_t buf = 0;
122 122
    uint8_t meanWindow = 150;
123 123
  };
124
  
124

  
125 125
  struct deviation_correction {
126 126
    bool RCase = true;
127 127
    int8_t pCount = 0;
......
132 132
  // static const struct ut_counter emptyUtCount;
133 133
  ut_counter utCount;
134 134
  proxy_ctrl pCtrl;
135
  bottom_prox_calibration proxCalib; 
135
  bottom_prox_calibration proxCalib;
136 136
  deviation_correction devCor;
137 137

  
138 138

  
......
160 160
  * Returns percentage of mean deviation between two given values.
161 161
  * It is intended to calculate the mean deviation between two proxy sensor
162 162
  * values. PROX_DEVIATION_MEAN_WINDOW determains the size of the mean window.
163
  * Keep in mind that initial results are wrong. 
163
  * Keep in mind that initial results are wrong.
164 164
  * */
165 165
  int32_t meanDeviation(uint16_t a, uint16_t b);
166 166

  
......
168 168
   * Check sectors around and stop if a thresh in one sector is detected.
169 169
   */
170 170
  void preventCollision(int (&rpmSpeed)[2], uint16_t (&proxVals)[8]);
171
  
171

  
172 172
  /**
173 173
   * Same as prevent collision but also lowers the speed when object is detected.
174 174
   */
......
176 176
  void getProxySectorVals(uint16_t (&proxVals)[8], uint16_t (&sProx)[8]);
177 177
  void getMaxFrontSectorVal(uint16_t (&sProx)[8], int32_t &sPMax);
178 178
  void chargeAsLED();
179
  
179

  
180 180
  /**
181 181
   * Returns true when front sensors reaching high values
182 182
   * and all others are low. This indicates that the loading station is ahead.
......
186 186

  
187 187
  /**
188 188
   * Check if current position changes when the wheel are deactivated.
189
   * 
189
   *
190 190
   * When AMiRo drives towards the loading station, it stops when a specific marker is reached.
191 191
   * In order to validate that the AMiRo is correctly positioned in the loading station
192 192
   * the wheels are turned off. When the position remains the same the docking procedure
193
   * was successful (return 1) otherwise a correction is needed (return 0). 
193
   * was successful (return 1) otherwise a correction is needed (return 0).
194 194
   */
195 195
  int checkDockingSuccess();
196 196

  

Also available in: Unified diff