View Single Post
  #15   Spotlight this post!  
Unread 10-02-2011, 01:56
iNiLz iNiLz is offline
Mentor
no team (None)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2000
Location: NY
Posts: 5
iNiLz is an unknown quantity at this point
Re: Programming Mecanum?

Sorry for the late reply.
So far this is what I currently have done and understand well.
Code:
import edu.wpi.first.wpilibj.SimpleRobot;
import edu.wpi.first.wpilibj.Compressor;
import edu.wpi.first.wpilibj.GenericHID;
import edu.wpi.first.wpilibj.Gyro;
import edu.wpi.first.wpilibj.Victor;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.Jaguar;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.Joystick;

//Program
public class RobotTemplate extends SimpleRobot {
    //Drive Program
    RobotDrive drive = new RobotDrive(1, 3, 2, 4);

    //Joystick
    private Joystick leftStick = new Joystick(1);
    //private Joystick rightStick = new Joystick(2);

    //Autonomous Program
    public void autonomous() {
        
    }

    //Teleop
    public void operatorControl() {
    getWatchdog().setEnabled(true);

        //WatchDog Enabled //Infinite Loop
        while (isEnabled() && isOperatorControl()) {
            getWatchdog().feed();
            drive.mecanumDrive_Polar(leftStick.getDirectionDegrees(), leftStick.getMagnitude(), leftStick.getTwist());
            Timer.delay(0.005);
    }

   }
}
I haven't tested it yet but will tomorrow.
Once I figure out how Cartisian works, I'll update the code.
Now to figure out the gyro and encoder.
Reply With Quote