Thread: XBox controller
View Single Post
  #4   Spotlight this post!  
Unread 09-12-2012, 17:51
Toa Circuit's Avatar
Toa Circuit Toa Circuit is offline
Thaddeus Maximus
AKA: Thad Hughes
FRC #4213 (MetalCow Robotics)
Team Role: Leadership
 
Join Date: Nov 2012
Rookie Year: 2012
Location: Shirley, IL
Posts: 131
Toa Circuit is an unknown quantity at this point
Re: XBox controller

I had tried an xBox controller once, and had poor experiences with it.
I could not:
1. Get the left joystick Y axis value
2. Independently access the analog triggers

I had subclassed it and used the Joystick.GetRawAxis() functions. Everything else worked, but I couldn't get those things out of it.

Then again, that was my experience. If you wanted it to work, you should use the GetRawAxis(x) functions as said before.

Lets say you setup everything like you had before and plugged the xBox controller in as the first controller. Here is what you would write:
Code:
	void Autonomous(void)
	{
		myRobot->SetSafetyEnabled(true);
				
			while(IsAutonomous())
			{
			myRobot->Drive(leftStick->GetRawAxis(1), leftStick->GetRawAxis(2));
			}
	}
By doing this, we are doing what Zuelu562 had done somewhat, just minus creating extra variables that make code messier and use up more memory. You just pass the value you want the robot to move rather than passing a joystick to it. Zuelu562 also gave a spreadsheet that listed out all the values of buttons and axes, so you can replace the 1 and 2 with whichever values you like. This seemed to match up with what I had.
Reply With Quote