Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   robotDrive.drive help? (http://www.chiefdelphi.com/forums/showthread.php?t=92011)

RoboElite640 16-02-2011 15:08

robotDrive.drive help?
 
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

Re: robotDrive.drive help?
 
try robotDrive.arcadeDrive(speed,turn);

RoboElite640 16-02-2011 21:10

Re: robotDrive.drive help?
 
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

Re: robotDrive.drive help?
 
Quote:

Originally Posted by RoboElite640 (Post 1024725)
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


omalleyj 17-02-2011 11:19

Re: robotDrive.drive help?
 
Quote:

Originally Posted by RoboElite640 (Post 1024460)
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?


All times are GMT -5. The time now is 22:18.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi