View Single Post
  #7   Spotlight this post!  
Unread 01-02-2015, 00:45
viggy96 viggy96 is offline
Registered User
FRC #3331
Team Role: College Student
 
Join Date: Jan 2015
Rookie Year: 2010
Location: Charlotte
Posts: 55
viggy96 is infamous around these partsviggy96 is infamous around these parts
Re: [C++] Use CAN Talons in RobotDrive

This should work, but as I don't have a bot with TalonSRXs, I can't confirm this, but you could try it. I have used the IterativeRobot class.

Code:
class Robot: public IterativeRobot
{
private:
	LiveWindow *lw;

	CANTalon leftFront = new CANTalon(1);
	CANTalon leftBack = new CANTalon(5);
	CANTalon rightFront = new CANTalon(2);
	CANTalon rightBack = new CANTalon(6);

	RobotDrive drive = new RobotDrive(leftFront, leftBack, rightFront, rightBack);

	Joystick stick = new Joystick(1);

	Gyro gyro = new gyro(0);

	void RobotInit()
	{
		lw = LiveWindow::GetInstance();
	}

	void AutonomousInit()
	{

	}

	void AutonomousPeriodic()
	{

	}

	void TeleopInit()
	{

	}

	void TeleopPeriodic()
	{
		drive.MecanumDrive_Cartesian(stick.getX(), stick.getY(), stick.getThrottle(), gyro.getAngle());
	}

	void TestPeriodic()
	{
		lw->Run();
	}
};