Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   Cheesy Drive in Iterative Robot? (http://www.chiefdelphi.com/forums/showthread.php?t=133494)

thatprogrammer 25-01-2015 14:47

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.

thatprogrammer 25-01-2015 14:56

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);



All times are GMT -5. The time now is 12:01.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi