Logitech Dual Action Setup for 2 Axis help please?

Hey, im kinda new to FRC java and i need assitance in making a basic drive program that will work 2 joysticks on 1 controller. How would i set it up correctly?

You mean like tank drive on an Xbox or PS3 controller, right? I’d assume you’d use it like any joystick. Define it on whatever USB port and you should be set.

There’s also a pretty good post about something like this here. (and VIA link from that thread here, too)

You just declare it like any ordinary joystick, and read each axis from each joystick independantly. One stick will be axis 1 and 2, the other will be 3 and 4 (Unless there are other analog inputs). Also, make sure the DS has the proper drivers!

alright, but how would i declare it? This is the way i thought it could work itself :

Joystick joy1 = new Joystick(1);

But, how would i refer to the axis number that i desire and not have it get a heart attack (stay away literal types (_v)

sums it up quite nicely.

Yes, thats exactly how to do it. As Robby Unruh said, you would them call

joy1.getRawAxis(1)

to get the value of the first axis, and you would use the proper index from the list that Robby Unruh posted. For a two sided drive system, I believe you would want 2 and 5.

We just modified last years code yesterday to get this working. We found axis mapping to be
Axis indexes:
1 - Left joystick X
2 - Left joystick Y
3 - Right joystick X
4 - Right joystick Y
5 - DPad x
6 - DPad y

to stay with tank drive and use both joysticks from one game pad plugged into USB port 1, the code looked like

in the constructor
m_driveStick = new Joystick(1);

in the teleop section
m_robotDrive.tankDrive(m_driveStick, 4, m_driveStick, 2);

where 4 and 2 are the axis numbers assigned to the left and right joystick arguments.

wjb

in these examples what would have to be imported in order for these to be used?

In my code I usually just use:

import edu.wpi.first.wpilibj.*;

so it imports everything. But for Joystick’s it’s just:

 import edu.wpi.first.wpilibj.Joystick;