View Single Post
  #2   Spotlight this post!  
Unread 25-01-2015, 14:56
thatprogrammer's Avatar
thatprogrammer thatprogrammer is offline
Registered User
AKA: Ahad Bawany
no team (None)
Team Role: Programmer
 
Join Date: Apr 2014
Rookie Year: 2014
Location: Florida
Posts: 609
thatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond repute
Re: Cheesy Drive in Iterative Robot?

Here is the code I used
Code:
class Robot: public IterativeRobot
{
private:
    RobotDrive *myrobot;
	LiveWindow *lw;
	Talon *kFrontLeftMotor;
	Talon *kBackLeftMotor;
	float turning;
	float straight;
	Joystick *Driver;
	float frontMultiplier;
	float backMultiplier;
    Solenoid *shifter;
	void RobotInit()
	{
myrobot = new RobotDrive (0,1);
		lw = LiveWindow::GetInstance()
		kFrontLeftMotor = new Talon (0);
		kBackLeftMotor = new Talon(1);
		Driver = new Joystick (0);
		turning = Driver->GetRawAxis(3);
		straight = Driver->GetX();
		frontMultiplier = turning + straight;
		backMultiplier = turning - straight;
		

	}

	void AutonomousInit()
	{

	}

	void AutonomousPeriodic()
	{

	}

	void TeleopInit()
	{


	}


	void TeleopPeriodic()
	{
   
        	if( ( frontMultiplier > 1 ) || ( frontMultiplier < -1 ) )
        	{
        	frontMultiplier = ((0.0 < frontMultiplier) - (frontMultiplier < 0.0));
        	}




    	kFrontLeftMotor->Set (frontMultiplier);
    	kBackLeftMotor->Set (backMultiplier);

    }




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

START_ROBOT_CLASS(Robot);
Reply With Quote