Thread: XBox controller
View Single Post
  #7   Spotlight this post!  
Unread 02-01-2013, 00:14
ekapalka's Avatar
ekapalka ekapalka is offline
Registered User
FRC #3216
 
Join Date: Dec 2012
Location: Bermuda
Posts: 277
ekapalka has a spectacular aura aboutekapalka has a spectacular aura about
Re: XBox controller

Hey CD! I've had an epiphany! XBox is actually spelled xBox, just like Ipod is actually spelled iPod! I've taken into consideration all the information I received from this thread and the example code, and have constructed this:
Code:
#include <WPILib.h>
class DefaultRobot : public SimpleRobot
{	
	Joystick *xboxStickManip;              
	Joystick *leftStick;			       
	Joystick *rightStick;                  
	Jaguar *leftDrive;                     
	Jaguar *rightDrive;                    
	RobotDrive *myRobot;                   
public:
	DefaultRobot(void)
	{	
		xboxStickManip = new Joystick(1);  
		leftStick = new Joystick(2);
		rightStick = new Joystick(3);
		leftDrive = new Jaguar(1);
		rightDrive = new Jaguar(2);
		myRobot = new RobotDrive(leftDrive, rightDrive);
	}
	void Autonomous(void)
	{
			while(IsAutonomous())
			{
			}				
	}
	void OperatorControl(void)
	{
		myRobot->TankDrive(0.0, 0.0);		
		while (IsOperatorControl())
		{	
			float leftStickYAxis = leftStick->GetY();
			float rightStickYAxis = rightStick->GetY();	
			myRobot->TankDrive(-leftStickYAxis, -rightStickYAxis);
		}
	}
};

START_ROBOT_CLASS(DefaultRobot);
It compiles (amazingly) but will not load onto the cRIO II, even though DefaultRobotProject compiles and runs. I've begun to think that my code may be at fault... Does anyone have any ideas? I'm pretty sure it's also a bit redundant. Any help would be awesome! Cheers!
Reply With Quote