The reason why that constructor is protected is that you're not supposed to use it if you are just making a Joystick object (which assumes you are using an Attack 3 joystick, so it sets up the axes and buttons according to that joystick). But if you are trying to make a Joystick object that is not for an Attack 3, then Jared's suggestion would be the right thing to do. Make your own subclass of Joystick to represent your gamepad. In that case you be representing your own custom Joystick, so you would need to customize the axes and buttons.
Some more complete example code might be:
Code:
import edu.wpi.first.wpilibj.Joystick;
public class Gamepad extends Joystick {
final static int NUM_AXES = 3; // these would be the default values for the
final static int NUM_BUTTONS = 11; // Attack 3 joysticks included in the KOP
Gamepad(int USBport) {
super(USBport, NUM_AXES, NUM_BUTTONS); // initialize Joystick with the provided USB port
// and the constants for number of buttons and axes
}
}
Extending the Joystick class basically makes it so Gamepad inherits all the methods and variables that Joystick has (and allows you to access protected methods and variables), but you can add in more functionality.