Shop OBEX P1 Docs P2 Docs Learn Events
No luck with auto correlation curves using Calibrate_All — Parallax Forums

No luck with auto correlation curves using Calibrate_All

Martin_HMartin_H Posts: 4,051
edited 2014-09-14 10:09 in Robotics
I'm running the Calibrate_All with a home made BS2E robot and wheel encoders. I then used the Calibrate All Windows program to download and graph the data which you can see below.

sensor_data.png


The pulse widths versus velocity curves look great (except for a slight flattening around the origin for the left wheel). To me that says that both encoders are working, and that's been my experience with some other test programs I've run. But what is strange is the photo sensor and auto correlation curves. The curves don't look half bad, except the red and green curves are 180 degrees out of phase. I guess I'm wondering what's up with that? I read the source code to "Calibrate_All.bs2" and it samples the photocell once, wires a word, and then pulses both wheels. So I don't understand how this could happen. Here's a snippet of the code that does this.
  CASE 3

    PAUSE 5000
    FOR i = 0 TO 512 STEP 2
      HIGH Photo
      PAUSE 6
      RCTIME Photo, 1, Value
      WRITE i + 64, Value.HIGHBYTE
      WRITE i + 65, Value.LOWBYTE
      Dist(LEFT) = i.BIT1
      Dist(RIGHT) = 1 - Dist(RIGHT)
      Dir(LEFT) = FWD
      Dir(RIGHT) = BAK
      Veloc = 1
      GOSUB DoMove
    NEXT
    END

The one thing that struck me as odd was the line Dist(RIGHT) = 1 - Dist(RIGHT). I guess I would have expected Dist(RIGHT) = 1 - Dist(LEFT).

Update: I made that change and it made no different. The data is still 180 degrees out of phase. Here's the raw correlation data.
Copy and paste these DATA statements into your BASIC Stamp programs:

DATA @0, 6,15,23,28,33,38,43,47
DATA     52,57,62,68,74,80,86,92
DATA     10,17,21,28,34,39,44,50
DATA     55,61,66,72,78,84,89,95
DATA     16,19,23,28,32,37,41,46
DATA     51,55,60,66,72,77,83,89
DATA     18,20,25,31,36,40,45,51
DATA     57,62,68,75,81,87,93,100

Autocorrelation data for Calibrate_All.exe:

8,10,11,18,23,55,64,83
97,117,138,155,163,172,190,213
227,242,228,223,228,245,264,287
298,333,399,430,442,402,351,286
229,188,173,156,148,129,116,98
84,30,9,8,8,7,7,9
12,19,36,59,71,89,104,118
125,148,178,200,211,202,190,191
194,201,214,227,239,267,283,306
322,319,291,277,262,237,206,166
138,116,98,83,70,54,12,5
5,5,5,5,7,10,17,39
57,66,83,95,112,134,163,181
188,191,193,187,185,184,185,186
187,190,195,203,215,224,258,293
305,302,270,235,211,171,159,128
103,89,76,67,40,9,5,5
4,4,5,8,11,23,43,60
74,87,100,115,140,171,189,193
186,179,178,180,184,194,207,216
238,264,294,300,272,240,189,160
128,113,90,77,68,49,12,5
5,5,4,4,6,9,15,37
57,68,84,96,111,133,162,173
181,185,180,172,174,180,189,201
218,233,276,304,315,291,263,215
186,169,160,144,127,103,88,76
64,37,6,5,5,5,5,5
9,13,27,48,65,77,88,101
119,139,168,180,186,177,176,179
185,195,208,221,232,248,294,306
310,312,305,280,247,199,163,135

END
548 x 495 - 61K

Comments

  • Martin_HMartin_H Posts: 4,051
    edited 2014-09-14 08:56
    I reran the fourth calibration program again and made a great deal of effort to improve the lighting. I added a little hood around the CDS cell, now it only sees light from the front. I took it into a room with one sunny window, two interior walls, and one window away from the sun. I made sure the robot wasn't in direct sunlight, but was exposed to the sunny window. This got rid of the spike, valley, spike in the brightest part of the room, and the curves don't look bad to me. But the Callibrate_all.exe program still doesn't like them.

    sensor_data2.png


    I'm not sure what I can do to improve my data.
    Copy and paste these DATA statements into your BASIC Stamp programs:
    
    DATA @0, 6,15,23,28,33,38,43,47
    DATA     52,57,62,68,74,80,86,92
    DATA     10,17,21,28,34,39,44,50
    DATA     55,61,66,72,78,84,89,95
    DATA     16,19,23,28,32,37,41,46
    DATA     51,55,60,66,72,77,83,89
    DATA     18,20,25,31,36,40,45,51
    DATA     57,62,68,75,81,87,93,100
    
    Autocorrelation data for Calibrate_All.exe:
    
    88,82,76,83,92,96,99,102
    122,133,178,212,240,279,511,772
    844,835,922,951,958,960,960,975
    981,980,1006,1099,1134,1148,1165,1214
    1357,1435,1637,1744,1837,1808,1668,1451
    1277,1111,1016,944,819,609,328,185
    130,106,90,79,78,86,90,91
    95,102,109,115,129,150,191,212
    240,329,416,689,783,844,852,848
    869,929,961,961,966,972,972,992
    1103,1118,1159,1283,1509,1697,1815,1800
    1677,1470,1300,1135,1041,946,853,703
    388,213,141,110,94,83,78,86
    90,92,93,99,107,117,139,160
    181,192,282,407,765,817,840,856
    840,923,961,961,972,970,1026,1118
    1147,1249,1323,1491,1634,1764,1780,1673
    1505,1309,1148,1041,950,849,734,512
    354,239,202,161,135,116,107,95
    82,77,75,79,87,92,107,126
    156,184,200,324,464,742,802,820
    860,946,957,958,958,970,979,990
    1004,1048,1112,1164,1179,1211,1335,1509
    1693,1789,1803,1776,1646,1560,1402,1248
    1136,1070,1001,951,863,798,556,408
    220,177,125,111,104,96,86,80
    78,75,77,80,84,90,97,103
    112,117,127,164,223,278,340,575
    792,837,842,926,950,963,961,972
    991,1005,1086,1153,1203,1337,1492,1600
    1770,1833,1861,1809,1690,1579,1406,1292
    1166,1097,1073,1047,989,941,908,852
    
    END
    
    548 x 497 - 60K
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2014-09-14 09:28
    Martin,

    What the program appears to be complaining about is the increasing period, not the shape of the curve. Are you doing the calibration on carpet by any chance? A hard surface works best.

    -Phil
  • Martin_HMartin_H Posts: 4,051
    edited 2014-09-14 10:09
    Thanks for the response. The first try was on a stone counter, the second was on a card table. Let me retry with a few tweaks and see if I can fix that.
Sign In or Register to comment.