View Full Version : robotDrive.drive help?
RoboElite640
16-02-2011, 15:08
So we had the program work so that if (stickRight.getRawButton(1) == true)
{robotDrive.drive(1.0,0.0); }
if (stickLeft.getRawButton(1) == true)_
{robotDrive.drive(0.2,0.0); }
but when we try this it works partially. When we push button 1 on stickRight, it moves faster but only one motor moves faster. Vice versa with button 1 on stickLeft, only one motor moves slow. Any help?
xinchi.he
16-02-2011, 16:28
try robotDrive.arcadeDrive(speed,turn);
RoboElite640
16-02-2011, 21:10
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.
Robby Unruh
17-02-2011, 10:07
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.
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
omalleyj
17-02-2011, 11:19
So we had the program work so that if (stickRight.getRawButton(1) == true)
{robotDrive.drive(1.0,0.0); }
if (stickLeft.getRawButton(1) == true)_
{robotDrive.drive(0.2,0.0); }
but when we try this it works partially. When we push button 1 on stickRight, it moves faster but only one motor moves faster. Vice versa with button 1 on stickLeft, only one motor moves slow. Any help?
The other advice given has been good but don't address directly your statement that only one motor works in each case. The 'if' control statements shouldn't affect the .drive that way regardless of your reason for wantign to do it. What does your RobotDrive constructor call look like?
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.