Log in

View Full Version : Cheesy Drive in Iterative Robot?


thatprogrammer
25-01-2015, 14:47
Hey, would someone mind posting sample code for cheesy drive in iterative robot? I tried coding this, but can't seem to get it to work. If possible, provide code using the old talons.

thatprogrammer
25-01-2015, 14:56
Here is the code I used 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);