|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Cheesy Drive in Iterative Robot?
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.
|
|
#2
|
||||
|
||||
|
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);
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|