Use both joysticks to drive robot on Xbox controller?

How can I use both thumb sticks on an Xbox controller to move the robot’s left and right motors?

robotDrive.tankDrive(xboxController.getRawAxis(1), xboxController.getRawAxis(3))

You can also try this:

robotDrive.tankDrive(xboxController.getY(Hand.kLeft), xboxController.getY(Hand.kRight));

What we did was define two variables as joysticks on the same port

From there use the Joystick.setChannel() method to change it to the y axis on the other stick. It should be channel 5.

after that it should work.

Sorry, I’m a bit confused about what you’re doing.

Bad idea. Why do you need to do this?
Can you post your code please?

What 18gillespiery recommends is below. I do not recommend teams do this. Instead use either of the examples above.

Once again, this code is not recommended!

public class Robot extends IterativeRobot {
	private RobotDrive drive;
	private Joystick joystick1;
	private Joystick joystick2;
	public void robotInit() {
		drive = new RobotDrive(0, 1);
		joystick1 = new Joystick(0);
		joystick2 = new Joystick(0);
		joystick2.setAxisChannel(AxisType.kY, 5);
	public void teleopPeriodic() {
		drive.tankDrive(joystick1, joystick2);


Okay, thank you all for your help!