|
Re: That seems a bit complicated.
Posted by Mark Pierce at 2/15/2001 10:14 PM EST
Other on team #288, RoboDAWGS, from Grandville High School and X-Rite, Delphi, and others.
In Reply to: That seems a bit complicated.
Posted by Joe on 2/14/2001 9:10 PM EST:
What you have should work, be careful about changing the 2 and 127 to ensure that rounding errors don't cause over flow (this is a whole number only processor).
In my first post I was thinking about limiting PWMs used to drive devices other than the drive. We always want to have our drive motors to have max. speed available and reduce speed with gearing. I wasn't thinking about tank drive, but a look up table can be used to simplify this as well.
As an attempt at explaining:
First, build a table with 128 - 0 values, followed by 256 values that range from 0 to 254, followed by 128 - 254 values:
PWMTBL Data 000, 000, 000, 000, 000, 000, 000, 000 ' 0
(repeat the above line 15 times)
Data 000, 001, 002, 003, 004, 005, 006, 007 ' 128
Data 008, 009, 010, 011, 012, 013, 014, 015 ' 136
Data 016, 017, 018, 019, 020, 021, 022, 023 ' 144
Data 024, 025, 026, 027, 028, 029, 030, 031 ' 152
Data 032, 033, 034, 035, 036, 037, 038, 039 ' 160
Data 040, 041, 042, 043, 044, 045, 046, 047 ' 168
Data 048, 049, 050, 051, 052, 053, 054, 055 ' 176
Data 056, 057, 058, 059, 060, 061, 062, 063 ' 184
Data 064, 065, 066, 067, 068, 069, 070, 071 ' 192
Data 072, 073, 074, 075, 076, 077, 078, 079 ' 200
Data 080, 081, 082, 083, 084, 085, 086, 087 ' 208
Data 088, 089, 090, 091, 092, 093, 094, 095 ' 216
Data 096, 097, 098, 099, 100, 101, 102, 103 ' 224
Data 104, 105, 106, 107, 108, 109, 110, 111 ' 232
Data 112, 113, 114, 115, 116, 117, 118, 119 ' 240
Data 120, 121, 122, 123, 124, 125, 126, 127 ' 248
Data 127, 128, 129, 130, 131, 132, 133, 134 ' 256
Data 135, 136, 137, 138, 139, 140, 141, 142 ' 264
Data 143, 144, 145, 146, 147, 148, 149, 150 ' 272
Data 151, 152, 153, 154, 155, 156, 157, 158 ' 280
Data 159, 160, 161, 162, 163, 164, 165, 166 ' 288
Data 167, 168, 169, 170, 171, 172, 173, 174 ' 296
Data 175, 176, 177, 178, 179, 180, 181, 182 ' 304
Data 183, 184, 185, 186, 187, 188, 189, 190 ' 312
Data 191, 192, 193, 194, 195, 196, 197, 198 ' 320
Data 199, 200, 201, 202, 203, 204, 205, 206 ' 328
Data 207, 208, 209, 210, 211, 212, 213, 214 ' 336
Data 215, 216, 217, 218, 219, 220, 221, 222 ' 344
Data 223, 224, 225, 226, 227, 228, 229, 230 ' 352
Data 231, 232, 233, 234, 235, 236, 237, 238 ' 360
Data 239, 240, 241, 242, 243, 244, 245, 246 ' 368
Data 247, 248, 249, 250, 251, 252, 253, 254 ' 376
Data 254, 254, 254, 254, 254, 254, 254, 254 ' 384
(repeat the last line 15 times)
Then your equations can be re-written as follows:
READ 256+p1_y-p1_x,PWM1
READ p1_y+p1_x,PWM2
To adjust the scale, change the zeros and 254s to some other numbers centered on 127 and scale the middle numbers accordingly. We use a spreadsheet to calculate these, but doing it by hand isn't difficult either.
Good Luck,
Mark
__________________
This message was archived from an earlier forum system. Some information may have been left out. Start new discussion in the current forums, and refer back to these threads when necessary.
|