diff --git a/src/main/java/frc/robot/Robot.java b/src/main/java/frc/robot/Robot.java index 61e3f7e..9a61f88 100644 --- a/src/main/java/frc/robot/Robot.java +++ b/src/main/java/frc/robot/Robot.java @@ -10,71 +10,25 @@ import edu.wpi.first.wpilibj.Joystick; import edu.wpi.first.wpilibj.Spark; import edu.wpi.first.wpilibj.TimedRobot; -import edu.wpi.first.wpilibj.Timer; import edu.wpi.first.wpilibj.drive.DifferentialDrive; /** - * The VM is configured to automatically run this class, and to call the - * functions corresponding to each mode, as described in the TimedRobot - * documentation. If you change the name of this class or the package after - * creating this project, you must also update the manifest file in the resource - * directory. + Zhan-Zhan's version of acrade driving */ public class Robot extends TimedRobot { - private final DifferentialDrive m_robotDrive - = new DifferentialDrive(new Spark(0), new Spark(1)); - private final Joystick m_stick = new Joystick(0); - private final Timer m_timer = new Timer(); + private DifferentialDrive m_myRobot; + private Joystick m_xSpeed; + private Joystick m_zRotation; - /** - * This function is run when the robot is first started up and should be - * used for any initialization code. - */ @Override public void robotInit() { + m_myRobot = new DifferentialDrive(new Spark(0), new Spark(1)); + m_xSpeed = new Joystick(0); + m_zRotation = new Joystick(1); } - /** - * This function is run once each time the robot enters autonomous mode. - */ - @Override - public void autonomousInit() { - m_timer.reset(); - m_timer.start(); - } - - /** - * This function is called periodically during autonomous. - */ - @Override - public void autonomousPeriodic() { - // Drive for 2 seconds - if (m_timer.get() < 2.0) { - m_robotDrive.arcadeDrive(0.5, 0.0); // drive forwards half speed - } else { - m_robotDrive.stopMotor(); // stop robot - } - } - - /** - * This function is called once each time the robot enters teleoperated mode. - */ - @Override - public void teleopInit() { - } - - /** - * This function is called periodically during teleoperated mode. - */ @Override public void teleopPeriodic() { - m_robotDrive.arcadeDrive(m_stick.getY(), m_stick.getX()); - } - - /** - * This function is called periodically during test mode. - */ - @Override - public void testPeriodic() { + m_myRobot.arcadeDrive(m_xSpeed.getY(), m_zRotation.getX()); } }