View Single Post
  #4   Spotlight this post!  
Unread 14-02-2003, 09:39
Jnadke Jnadke is offline
Go Badgers!
#0093
Team Role: Alumni
 
Join Date: Jan 2002
Location: Appleton, WI
Posts: 775
Jnadke is on a distinguished road
Send a message via ICQ to Jnadke Send a message via AIM to Jnadke Send a message via Yahoo to Jnadke
This is our motor/acceleration code from last year. It limits the maximum change in the motor values to MAX_ACC per every loop.

SAFE_ZONE CON 1000
MAX_ACC CON 10
MAX_ACC_VAL CON SAFE_ZONE + MAX_ACC
MIN_ACC_VAL CON SAFE_ZONE - MAX_ACC

speed_l = speed_l + (((p1_y - speed_l + SAFE_ZONE) min MIN_ACC_VAL max MAX_ACC_VAL) - SAFE_ZONE)



Modify it as you wish. This will accomplish tasks 1 and 3. speed_l is the speed of the left motor. Replace p1_y with your desired left motor value.
__________________
The best moments of our lives fall in two categories: those that did happen and those that did not.

Last edited by Jnadke : 14-02-2003 at 09:41.