View Single Post
  #8   Spotlight this post!  
Unread 22-03-2013, 21:48
BradenWatling BradenWatling is offline
Registered User
no team
 
Join Date: Mar 2011
Rookie Year: 2009
Location: Toronto, ON
Posts: 8
BradenWatling is an unknown quantity at this point
Re: Automatic 2 Speed Drivetrain Shifting Code

Quote:
Originally Posted by joelg236 View Post
I've not used Encoder.getRate() much. What kind of units would it return? (assuming default setup with the gear box and whatnot) How would I compare it to the joystick speed (-1 to +1)?

Also, is it bad to shift up if it is turning, but going forwards as well? (ie. +0.7 speed, -0.4 turn)
getRate returns encoder counts per second. one side of the drivetrain will be a negative value and the other side will be positive. To take the average, you'll have to subtract one side from the other. If you successfully average both sides, the average rate should directly vary with the joystick setpoint.

About shifting up on a curve, it depends on how well your robot turns in high gear. Our robot doesn't turn well in high gear so shifting up in the middle of a curve just results in the robot driving mostly straight.