View Single Post
  #4   Spotlight this post!  
Unread 15-10-2004, 23:56
wun's Avatar
wun wun is offline
Registered User
AKA: David Wolever
#0865 (Warp7)
Team Role: Programmer
 
Join Date: Dec 2003
Rookie Year: 2001
Location: Toronto
Posts: 84
wun will become famous soon enough
Send a message via AIM to wun Send a message via MSN to wun
Re: Create a low speed drive in programming

Quote:
Originally Posted by Bharat Nain
Our robots are a little too fast for anyone other than the driver to control. Since we take our robots out for demos and stuff, I being the programmer would want it to be safe. So I have been trying to come up with a program to drive this thing at half speed when the joystick are at full forward. We can't just divide all the values by 2 because that moves the center from 127 to 63.5. Anybody done such a thing, or can come up with a working program for this? I would appreciate any help
Thanks,
-Bharat
Another good way is look up tables. Then you can also set it up so it "ramps" (eg: if you move the joystick 1/2 of the way, it will only bring it up to 1/4 the possible speed, then when you push the joystick all the way, the robot will go up to 1/2 speed (or what have you). The code would look something like this:
Code:
const rom unsigned char mytable[256] = {
     56,56,55,55....
};
I wrote a little python script (which I promptly lost) that would generate them for me. There is also an auto-generator here (but your gonna need M$ excel to open it =\)
__________________
Help Microsoft stop piracy. Use Linux!

I have three gmail invitations, message me if you want one