Go to Post I think we need to take away your hammer privileges. - Katy [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 19-01-2017, 00:07
Team3337_mentor's Avatar
Team3337_mentor Team3337_mentor is offline
Registered User
AKA: Amanda Salom
FRC #6659 (Cougar Robotics)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: San Diego, CA
Posts: 19
Team3337_mentor is an unknown quantity at this point
XboxController Class vs Joystick Class for KOP Xbox Controller

Hello everyone,

We are a rookie team, and though I have mentored before, I never got a chance to work with Xbox controllers before. I'm managed to find some sample codes here and there, but I've never found a sample code that used the XboxController library. Any reason as to why the Joystick class is used over the XboxController class? Does it not work properly? I just don't want to set up the team to fail for any hidden reason that we never discover, God forbid, we learn the hard way during the middle of a match.

Regards,
__________________
Amanda Salom
Mentor
FRC 6659 Cougar Robotics
Reply With Quote
  #2   Spotlight this post!  
Unread 19-01-2017, 00:21
Bradley Boxer's Avatar
Bradley Boxer Bradley Boxer is offline
Registered User
AKA: Bradley Boxer
FRC #0303 (TEST Team 303)
Team Role: Programmer
 
Join Date: May 2015
Rookie Year: 2015
Location: United States
Posts: 26
Bradley Boxer is an unknown quantity at this point
Re: XboxController Class vs Joystick Class for KOP Xbox Controller

The XboxController class is new this year in wpilib, so most FRC example code will be written with the API that does not include it. If you look at the source code for the XboxController class (at C:\Users\(your user)\wpilib\java\current\lib\WPILib-sources\edu\wpi\first\wpilibj), you can see that it boils down to getRawAxis() and getRawButton() calls in GamepadBase, but does the figuring out of which controller button corresponds to which index for you.

For example, the method getAButton() literally just returns getRawButton(1).

Note: I assume it works the same way in C++, as I only checked the java source code.
__________________
The opinions expressed in this post are mine and do not necessarily reflect those of my team.

Last edited by Bradley Boxer : 19-01-2017 at 00:24. Reason: clarity
Reply With Quote
  #3   Spotlight this post!  
Unread 19-01-2017, 00:23
AustinShalit's Avatar
AustinShalit AustinShalit is online now
Registered User
AKA: אוסטין
no team (WPILib Suite Developer)
 
Join Date: Dec 2013
Rookie Year: 2008
Location: Los Angeles/Worcester/Israel
Posts: 144
AustinShalit is a glorious beacon of lightAustinShalit is a glorious beacon of lightAustinShalit is a glorious beacon of lightAustinShalit is a glorious beacon of lightAustinShalit is a glorious beacon of lightAustinShalit is a glorious beacon of light
Re: XboxController Class vs Joystick Class for KOP Xbox Controller

The XboxController class is new this year. That is probably why you cannot find many code examples. Although both will work, if you are using a Xbox controller use the XboxController class. It has methods like getY(Hand) that will make your code easier to read in the long run.
__________________
Reply With Quote
  #4   Spotlight this post!  
Unread 19-01-2017, 00:29
Team3337_mentor's Avatar
Team3337_mentor Team3337_mentor is offline
Registered User
AKA: Amanda Salom
FRC #6659 (Cougar Robotics)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: San Diego, CA
Posts: 19
Team3337_mentor is an unknown quantity at this point
Thumbs up Re: XboxController Class vs Joystick Class for KOP Xbox Controller

Thank you both Austin and Bradley. That makes much more sense. I though I was going crazy.
__________________
Amanda Salom
Mentor
FRC 6659 Cougar Robotics
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 13:37.

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