Thread: Drive Equations
View Single Post
  #7   Spotlight this post!  
Unread 14-02-2006, 16:27
iamthetallpaul iamthetallpaul is offline
Registered User
FRC #1189
 
Join Date: Jan 2006
Location: Grosse Pointe
Posts: 13
iamthetallpaul is on a distinguished road
Re: Drive Equations

Quote:
Originally Posted by CronosPrime1

If you want the syntax for the table,

Code:
rom const int drive_lookup[]= {0, 0, 0, 0, 0, 5, 10, 13, 15, 16,
18, 20, 21, 23, 24, 26, 28, 29, 31, 32, 34, 35, 36, 38, 39, 41,
42, 43, 45, 46, 47, 49, 50, 51, 53, 54, 55, 56, 58, 59, 60, 61,
62, 63, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 88, 89, 90, 91, 92, 93,
94, 94, 95, 96, 97, 98, 98, 99, 100, 101, 101, 102, 103, 103, 104,
105, 106, 106, 107, 108, 108, 109, 110, 110, 111, 111, 112, 113,
113, 114, 114, 115, 116, 116, 117, 117, 118, 118, 119, 120, 120,
121, 121, 122, 122, 123, 123, 124, 124, 125, 125, 126, 126, 127,
127, 127, 128, 128, 129, 129, 130, 130, 131, 131, 132, 132, 133,
133, 134, 135, 135, 136, 136, 137, 137, 138, 139, 139, 140, 140,
141, 142, 142, 143, 143, 144, 145, 145, 146, 147, 147, 148, 149,
150, 150, 151, 152, 152, 153, 154, 155, 155, 156, 157, 158, 159,
159, 160, 161, 162, 163, 164, 165, 165, 166, 167, 168, 169, 170,
171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183,
184, 185, 186, 187, 188, 190, 191, 192, 193, 194, 195, 197, 198,
199, 200, 202, 203, 204, 206, 207, 208, 210, 211, 212, 214, 215,
217, 218, 219, 221, 222, 224, 225, 227, 229, 230, 232, 233, 235,
237, 238, 240, 245, 250, 254, 254, 254, 254, 254, 254};
You can plug this right into your program and just say:
Code:
pwm01 = drive_lookup [p1_y];
to map your pwm01 to your p1_y using my curve.

At the endpoints, I chose to replace several of the last terms with an endvalue. Notice how there are several 254 terms at the end and several zeros in the beginning.

Thanks for the table version, but where exactly do you put this in the program? I've tried copying your code into DefaultRoutine() as well as Process_Data_From_Master_uP(), both result in errors. I searched the forums and found a lot of threads about making lookup tables but none about where to acutally put the code.