Revision bfffb0bd devices/DiWheelDrive/userthread.cpp
| devices/DiWheelDrive/userthread.cpp | ||
|---|---|---|
| 56 | 56 |
const int sizeOfPolicy = sizeof(policy) / sizeof(states); |
| 57 | 57 |
int policyCounter = 0; // Do not change this, it points to the beginning of the policy |
| 58 | 58 |
|
| 59 |
// Different speed settings (all values in "rounds per minute") |
|
| 60 |
// const int rpmTurnLeft[2] = {-10, 10};
|
|
| 61 |
// const int rpmTurnRight[2] = {rpmTurnLeft[1],rpmTurnLeft[0]};
|
|
| 62 |
// const int rpmHalt[2] = {0, 0};
|
|
| 63 |
|
|
| 64 |
// Definition of the fuzzyfication function |
|
| 65 |
// | Membership |
|
| 66 |
// 1|_B__ G __W__ |
|
| 67 |
// | \ /\ / |
|
| 68 |
// | \/ \/ |
|
| 69 |
// |_____/\__/\______ Sensor values |
|
| 70 |
// SEE MATLAB SCRIPT "fuzzyRule.m" for adjusting the values |
|
| 71 |
// All values are "raw sensor values" |
|
| 72 |
/* Use these values for white ground surface (e.g. paper) */ |
|
| 73 |
|
|
| 74 |
// const int blackStartFalling = 0x1000; // Where the black curve starts falling |
|
| 75 |
// const int blackOff = 0x1800; // Where no more black is detected |
|
| 76 |
// const int whiteStartRising = 0x2800; // Where the white curve starts rising |
|
| 77 |
// const int whiteOn = 0x6000; // Where the white curve has reached the maximum value |
|
| 78 |
// const int greyMax = (whiteOn + blackStartFalling) / 2; // Where grey has its maximum |
|
| 79 |
// const int greyStartRising = blackStartFalling; // Where grey starts rising |
|
| 80 |
// const int greyOff = whiteOn; // Where grey is completely off again |
|
| 81 |
|
|
| 82 |
/* Use these values for gray ground surfaces */ |
|
| 83 |
/* |
|
| 84 |
const int blackStartFalling = 0x1000; // Where the black curve starts falling |
|
| 85 |
const int blackOff = 0x2800; // Where no more black is detected |
|
| 86 |
const int whiteStartRising = 0x4000; // Where the white curve starts rising |
|
| 87 |
const int whiteOn = 0x5000; // Where the white curve starts rising |
|
| 88 |
const int greyMax = (whiteOn + blackStartFalling) / 2; // Where grey has its maximum |
|
| 89 |
const int greyStartRising = blackStartFalling; // Where grey starts rising |
|
| 90 |
const int greyOff = whiteOn; // Where grey is completely off again |
|
| 91 |
*/ |
|
| 59 |
|
|
| 92 | 60 |
|
| 93 | 61 |
int vcnl4020AmbientLight[4] = {0};
|
| 94 | 62 |
int vcnl4020Proximity[4] = {0};
|
| ... | ... | |
| 206 | 174 |
vcnl4020AmbientLight[i] = global.vcnl4020[i].getAmbientLight(); |
| 207 | 175 |
vcnl4020Proximity[i] = global.vcnl4020[i].getProximityScaledWoOffset(); |
| 208 | 176 |
} |
| 177 |
|
|
| 178 |
|
|
| 209 | 179 |
// lf.stableFollow(vcnl4020Proximity, rpmFuzzyCtrl, &global); |
| 210 | 180 |
// chprintf((BaseSequentialStream*) &SD1, "0x%04X 0x%04X 0x%04X 0x%04X\n", |
| 211 | 181 |
// vcnl4020Proximity[constants::DiWheelDrive::PROX_WHEEL_LEFT], |
| ... | ... | |
| 216 | 186 |
// lineFollownew |
| 217 | 187 |
//else |
| 218 | 188 |
// lineFollowing(vcnl4020Proximity, rpmFuzzyCtrl, &global); |
| 189 |
lf.followLine(rpmFuzzyCtrl); |
|
| 219 | 190 |
setRpmSpeed(rpmFuzzyCtrl); |
| 220 | 191 |
} |
| 221 | 192 |
|
Also available in: Unified diff