Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   Xbox Tank Drive? (http://www.chiefdelphi.com/forums/showthread.php?t=103156)

KyleS 18-02-2012 10:41

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.

agartner01 18-02-2012 11:23

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...

maria_edu 29-01-2013 17:51

Re: Xbox Tank Drive?
 
Is this possible with Labview? And if so, can someone help me with this?

jwakeman 29-01-2013 19:46

Re: Xbox Tank Drive?
 
Quote:

Originally Posted by KyleS (Post 1129449)
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.

zshelley 31-01-2013 16:56

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.

Team3266Spencer 31-01-2013 17:58

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.)

holly4win 02-02-2013 19:36

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!:)


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

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