We’ve been a 1-driver team for a while now, with the operator being a backup driver, more or less. After our first district event, our driver has had trouble multi-tasking (priming our launcher and driving at the same time) and so I need to incorporate a Gamepad (360) so I can manage our shooting mechanism while he drives.
Problem is, we use Tank Drive. IE, we’ve defined Left and Right Joysticks, and because we’ve defined both sticks already, I don’t know if we can define our gamepad’s sticks. I’m wondering if there is an alternate way to incorporate the gamepad as a controller into the code, without overwriting the two Joysticks.
Would calling the gamepad’s ‘Joysticks’ “LeftJoystick(3) and RightJoystick(4)” work? I haven’t looked at our code in a while, but I think we defined our original Joysticks as (1) and (2) in ordnance with the DS.
You can use up to 4 joystick (or consoles), enumerated 1 through 4. It does not really matter what you call them in the robot software. Be sure to get the order correct in the setup tab of the driver station.
HTH
A gamepad is actually a single device (so you would only call Joystick(3) in your code, unless for some reason you have two)
If you look in Control Panel, there is a special category where gamepads/joysticks show up (Devices and Printers in windows 7), if you go to the gamepad properties, you can get the raw button and axis values of the joystick (the screen shows the state and axis/button id of each); some gamepads don’t bind their inputs the way you expect them to, so it’s a good idea to look here to figure out your button/axis IDs.
If I recall correctly, the Xbox 360 controller may not be fully supported by the Joystick class or have some weird bindings that aren’t intuitive in code, but I’ve never tried myself so I could be wrong. A lot of teams use the Logitech f310 for gamepads (for an alternative to PS3/XB360).
We personally use a Logitech Extreme 3D Pro, I like the button layout for standard joysticks a little better than gamepads. I generally try to map operator (and driver) buttons so that they mimic the outcome of actions (such as using the upper/lower buttons of a button pair to raise and lower a mechanism) and this tends to work out a little better on a regular joystick.
Usually, I avoid giving the operator any analog inputs, as this forces them to ‘guess’, it’s better to have a fixed setpoint for nearly everything where precision/repeatability is important.