Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   Making a 2 axis controller turn the robot (http://www.chiefdelphi.com/forums/showthread.php?t=114650)

sunny1118 04-03-2013 17:40

Making a 2 axis controller turn the robot
 
We have our 3 axis controller do the tank drive, but we also want our 2 axis controller to also rotate. We plan to use on the x-axis left turn the robot counter clock wise and right to trun the robot clock wise. We want to know if it is possible and how? We program in java.

Ether 04-03-2013 20:16

Re: Making a 2 axis controller turn the robot
 
Quote:

Originally Posted by sunny1118 (Post 1243585)
We plan to use on the x-axis left turn the robot counter clock wise and right to trun the robot clock wise. We want to know if it is possible and how? We program in java.

You didn't say what kind of drivetrain you have.

If it's a skidsteer, what you are describing sounds like Arcade Drive. Look in RobotDrive.java in the WPILib.

If you have mecanum, and you want independent control of FWD/REV, strafe Left/Right, and rotate (turn) CW/CCW, then you need three inputs.



sunny1118 04-03-2013 21:00

Re: Making a 2 axis controller turn the robot
 
Quote:

Originally Posted by Ether (Post 1243673)
You didn't say what kind of drivetrain you have.

If it's a skidsteer, what you are describing sounds like Arcade Drive. Look in RobotDrive.java in the WPILib.

If you have mecanum, and you want independent control of FWD/REV, strafe Left/Right, and rotate (turn) CW/CCW, then you need three inputs.



We are using mecanum, we have one of our joystick for drive and the other is auxil. We want the auxil to just rotate the robot and are not sure which arcade drive to use

Ether 04-03-2013 23:31

Re: Making a 2 axis controller turn the robot
 
Quote:

Originally Posted by sunny1118 (Post 1243689)
We are using mecanum, we have one of our joystick for drive and the other is auxil. We want the auxil to just rotate the robot and are not sure which arcade drive to use

If you want independent control of mecanum FWD/REV, strafe Left/Right, and rotate (turn) CW/CCW, then you need three inputs.

Arcade drive is for skid steer and does not take 3 inputs.

A 2-axis joystick does not produce 3 outputs (unless you want to use the throttle for the 3rd output).

The mecanumDrive_Cartesian() method in the RobotDrive.java file in WPILib takes three inputs.

You need a DI (Driver Interface) that gives the driver three controls: one each for fwd/rev, strafe left/right, and rotate CW/CCW.

So your DI could be this:

Y axis of Joystick1 is FWD/REV

X axis of Joystick1 is Strafe Right/Left

X axis of Joystick2 is Rotate CW/CCW.

... and just feed those three outputs into the appropriate 3 inputs of the mecanumDrive_Cartesian() method.




AsianRookie 05-03-2013 14:25

Re: Making a 2 axis controller turn the robot
 
Well for the 2 axis joystick, you would have a toggle the mode or hold a button to rotate.


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

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