View Single Post
  #4   Spotlight this post!  
Unread 17-02-2011, 10:07
Robby Unruh's Avatar
Robby Unruh Robby Unruh is offline
*insert random dial-up tone here*
FRC #3266 (Robots R Us)
Team Role: Coach
 
Join Date: Feb 2010
Rookie Year: 2010
Location: Eaton, OH
Posts: 338
Robby Unruh will become famous soon enough
Re: robotDrive.drive help?

Quote:
Originally Posted by RoboElite640 View Post
well, i didnt get a chance to try that, but essentially I'm trying to have it set up so that when i press one button the robot will drive faster. And if i press another button the robot will drive slower.
Ah, okay. What you're doing in the code above is basically autonomous. It'll just drive instead of powering the motors to a set limit.

I'd recommend having your program use Jaguar objects in your Drive train instead of integers (assuming you are using int's)

Once you do this you should be able to limit it in teleop.
Code:
RobotDrive drive = new RobotDrive(leftMotor, rightMotor);

if(leftMotor.get() >= 0.5) {
    leftMotor.set(0.5);
} else if(rightMotor.get() >= 0.5) {
    rightMotor.set(0.5);
}

// then call your drive methods and it'll limit the max speed to 0.5
__________________
[Robots R Us #3266]
2015: Georgia Southern Classic (Winners / Thanks 1319 & 1648!), Queen City
2014: Crossroads, Queen City
2013: Buckeye, Queen City, Crossroads
2012: Buckeye, Queen City

2011: Buckeye
2010: Buckeye
Reply With Quote