View Single Post
  #3   Spotlight this post!  
Unread 24-02-2010, 15:33
buddyb's Avatar
buddyb buddyb is offline
Registered User
FRC #1885 (ILITE)
Team Role: Programmer
 
Join Date: Dec 2009
Rookie Year: 2008
Location: Haymarket, VA
Posts: 65
buddyb has a spectacular aura aboutbuddyb has a spectacular aura aboutbuddyb has a spectacular aura about
Re: [FTC]: 4 Stage Gear Train HELP!

I agree with Abra. Our team uses 1:9, and it serves us really well. 1:36 seems like a bit much.

If you need to retain your current ratio, though, try code like this (pseudocode; will not compile in anything; you need to run this as a separate task, or integrate it in to your main loop such that it is executed without an explicit wait)
Code:
//5 for all of the values is arbitrary. For faster revving, go with 10 or so.
IF(abs(motor_power - desired_motor_power) < 5)
    motor_power = desired_motor_power;
ELSE IF(motor_power > desired_motor_power)
    motor_power = motor_power - 5;
ELSE
    motor_power = motor_power + 5;
WAIT 100 milliseconds;
If implemented, this code will get you from 0 to 100 power in 2 seconds. If you want to go from 0->100 in less time, increase 5 to anything you want. It is *highly* advised that you not decrease the wait time much, because if you go from 0->100 in 20ms, there's hardly any point to a revving system.
__________________
FRC - Team 1885 - Programmer.
Reply With Quote