Posted by Joe at 2/14/2001 9:10 PM EST
Student on team #506 from St. Anthony's HS.
In Reply to: Re: Limiting PWM in pbasic
Posted by Mark Pierce on 2/13/2001 12:59 PM EST:
: Another way to limit PWMs, especially if you are driving it from a joystick or analog input is to use a look up table. Build a table of values that has the desired shape and range of values. This also eliminates the need for deadband handling code and can be adjusted to give the operators more natural control. See Steve's page:
:
http://sharingfirst.mit.edu/users/st...%20Control.htm
After sitting looking at the code for about 45 I decided to come here looking for answeres. I saw your
post and investigated. It looks to me like you know what your doing well beyond my teams comprehension (were a rookie team with no programming experience). I decided to combine the ideas listed in a previous post (the one you responded to i think) with the tank drive system. Hopefully this will alow the tank drive to run at a slower, scaled speed. Please tell me if this works and if it has similar effects to what your program did.
PWM1 = (((((2000 + p1_y - p1_x + 127) Min 2000 Max 2254) - 2000) - 127) / 2 + 127)
PWM2 = (((((2000 + p1_y + p1_x - 127) Min 2000 Max 2254) - 2000) - 127) / 2 + 127)
notice the adition of the -127) / 2 + 127) at the end of both lines. This is untested and i'll be trying it out tomorrow. If anyone sees a problem or an even easier way please let me know.
also: if this works the degree of the scale can be adjusted by simply changing the / 2 to another number.