Using A Pair Of Controllers

Hello,

I’m currently trying to write a Java class file that can treat dual controllers as one.
How do I write the constructor method to initialize two independent controllers?

Well if I understand you correctly, the constructor would simply be

Joystick m_joystick1;
Joystick m_joystick2;
public DoubleController(int port1, int port2) {
    m_joystick1 = new Joystick(port1);
    m_joystick2 = new joystick(port2);
}

Or something like that depending on the device your using.

Have you looked at the SpeedControllerGroup class?

I’m actually mapping joysticks at the HAL level. The class is written similarly to the XboxController class in FRC.

1 Like

That doesn’t appear to have something useful for combining separate HIDs.

So you want to use a single Joystick or GenericHID in your code instead of keeping two references to a controller? I’m just trying to understand what you want to accomplish here.

I have a pair of ThrustMaster T16000M Flight Joysticks. They are independent joysticks that can each can stand alone. To make the programming a bit easier for my junior programmers, I am writing an entire class that can treat two independent joysticks as one.

I think that this is one of the best options for creating a class that contains references to both joysticks.

I think that letting your junior programmers decide how they want to use both joysticks is important because they will be able to easily map the button numbers by looking in the driver station for button IDs.

We usually put all of our references to our joysticks into one class. However, there’s many different ways to do it.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.