Go to Post We do have a good time. Mr. Bill - Bill Beatty [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 18-02-2012, 10:41
KyleS KyleS is offline
Registered User
FRC #3016
 
Join Date: Feb 2012
Location: Houston, TX
Posts: 3
KyleS is an unknown quantity at this point
Xbox Tank Drive?

How would I get the Xbox controller to work with tank drive correctly? It's a pain the team insists on using it, but oh well. Just not sure how to combine the multiple axis's into something like TankDrive.
Reply With Quote
  #2   Spotlight this post!  
Unread 18-02-2012, 11:23
agartner01 agartner01 is offline
Captain + Control Sys & Design
FRC #4174
Team Role: Engineer
 
Join Date: Feb 2012
Rookie Year: 2012
Location: Hector MN
Posts: 109
agartner01 is an unknown quantity at this point
Re: Xbox Tank Drive?

I don't know if this will be useful to you, but I found this awhile back:

http://pastebin.com/fy0TMhP6

They use the 360 controller...
Reply With Quote
  #3   Spotlight this post!  
Unread 29-01-2013, 17:51
maria_edu maria_edu is offline
Registered User
FRC #1811
 
Join Date: Jan 2012
Location: Newark, NJ
Posts: 13
maria_edu is an unknown quantity at this point
Re: Xbox Tank Drive?

Is this possible with Labview? And if so, can someone help me with this?
Reply With Quote
  #4   Spotlight this post!  
Unread 29-01-2013, 19:46
jwakeman jwakeman is offline
Registered User
FRC #0063 (Red Barons)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: 16510
Posts: 182
jwakeman is just really nicejwakeman is just really nicejwakeman is just really nicejwakeman is just really nicejwakeman is just really nice
Re: Xbox Tank Drive?

Quote:
Originally Posted by KyleS View Post
How would I get the Xbox controller to work with tank drive correctly? It's a pain the team insists on using it, but oh well. Just not sure how to combine the multiple axis's into something like TankDrive.

You need to create a JoyStick object and a RobotDrive object. Then you just need to call the TankDrive() method of the RobotDrive class with the values from the left and right analog stick on the xbox controller.

Should look something like this:
Code:
void MySimpleRobot::OperatorControl()
{
   RobotDrive* pTeleopDrive = new RobotDrive(1,2,3,4);
   Joystick* pDriverXbox = new Joystick(1);
 
   while(IsOperatorControl() && IsEnabled())
   {
       pTeleopDrive->TankDrive(pDriverXbox->GetRawAxis(2), pDriverXbox->GetRawAxis(5));
   }
}
The 1,2,3,4 passed to the constructor of the RobotDrive represent the channels on the digital side car that your motor controllers are connected to. The value of 1 passed to the JoyStick constructor represents the usb port that your xbox controller is connected to. The 2 passed to GetRawAxis is for the Y-axis of the left analog stick and the 5 is for the Y-axis of the right analog stick.
Reply With Quote
  #5   Spotlight this post!  
Unread 31-01-2013, 16:56
zshelley's Avatar
zshelley zshelley is offline
Registered User
FRC #2550
 
Join Date: Jan 2013
Location: Oregon City
Posts: 4
zshelley is an unknown quantity at this point
Re: Xbox Tank Drive?

Team 2550 is using a Xbox360 controller with tank drive this year and we found some interesting things.
Mainly that the default tank and X,Y functions jump off a bridge when using a wired Xbox controller.
Instead we did some testing with GetRawAxis and this is what we found:
1 - Reads -Y Values of the left thumb stick
2 - Reads ALL values of the left thumb stick
3 - Reads DPAD X values
4 - Reads X values of right thumb stick
5 - Reads X values of right bumper
6 - Reads DPAD Y values
Twist - Right thumb stick X axis
Throttle - Triggers (-1 is left trigger 1 is right trigger 0 is both or neither)

Hope this helps, our controller is kinda funky, but it is xbox360. Your axises might be different though.
__________________
Thou shalt not add my speed to the speed of light.
Reply With Quote
  #6   Spotlight this post!  
Unread 31-01-2013, 17:58
Team3266Spencer's Avatar
Team3266Spencer Team3266Spencer is offline
Team Captain and Lead Programmer
AKA: Spencer Lanman
FRC #3266 (Robots-R-US)
Team Role: Programmer
 
Join Date: Oct 2011
Rookie Year: 2012
Location: Richmond, Indiana
Posts: 280
Team3266Spencer is an unknown quantity at this point
Re: Xbox Tank Drive?

Try using the run command (if using Windows) and search open "joy.cpl" without the parentheses. This will allow you to see what all the buttons and axis are in regards to their raw port (0, 2, etc.)
__________________
2012: Buckeye Regional, Queen City Regional, Human Player
2013: Queen City Regional, Buckeye Regional, Crossroads Regional
Shooter Operator
2014: Crossroads Regional, Queen City Regional
Catapult Operator
2015: Georgia Southern Classic Regional (Winner), Queen City Regional
Chainsaw Operator
Want to talk? TeamSpeak: team3266.noip.me
Reply With Quote
  #7   Spotlight this post!  
Unread 02-02-2013, 19:36
holly4win holly4win is offline
Registered User
FRC #1967
 
Join Date: Jan 2013
Location: San Jose
Posts: 2
holly4win is an unknown quantity at this point
Re: Xbox Tank Drive?

Team 1967 created a Janky Joystick Investigator that puts button and axis values on SmartDashboard. That way when you click a button or move a thumbstick you will be able to figure out which button number/axis that physical button or axis it corresponds to. Our team has a GitHub repository.

Here is the link to the Investigator:
https://github.com/bobwolff68/FRCTea...ckInvestigator

And here is the link to our full repository:
https://github.com/bobwolff68/FRCTeam1967

Hope this helps!
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:55.

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