Go to Post I guess my only option is to either stop picking on Dave or come up with an even better picture! Now, which one do you think I'll choose? - MissInformation [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 06-03-2014, 01:55
JagCode's Avatar
JagCode JagCode is offline
Bring Your "B" Game
AKA: Noah
FRC #2929 (JagBots)
Team Role: Programmer
 
Join Date: Mar 2014
Rookie Year: 2014
Location: Puyallup, WA
Posts: 19
JagCode will become famous soon enough
Is It Possible to Code for 2 Joysticks and a Gamepad?

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.
Reply With Quote
  #2   Spotlight this post!  
Unread 06-03-2014, 04:52
wireties's Avatar
wireties wireties is offline
Principal Engineer
AKA: Keith Buchanan
FRC #1296 (Full Metal Jackets)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2004
Location: Rockwall, TX
Posts: 1,169
wireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond repute
Send a message via AIM to wireties
Re: Is It Possible to Code for 2 Joysticks and a Gamepad?

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
__________________
Fast, cheap or working - pick any two!

Last edited by wireties : 06-03-2014 at 12:43. Reason: grammar
Reply With Quote
  #3   Spotlight this post!  
Unread 06-03-2014, 10:52
DjScribbles DjScribbles is offline
Programming Mentor
AKA: Joe S
FRC #2474 (Team Excel)
Team Role: Mentor
 
Join Date: Oct 2011
Rookie Year: 2012
Location: Niles MI
Posts: 284
DjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to behold
Re: Is It Possible to Code for 2 Joysticks and a Gamepad?

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.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 12:11.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi