Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package org.usfirst.frc.team6353.robot;
- import edu.wpi.first.wpilibj.IterativeRobot;
- import edu.wpi.first.wpilibj.Joystick;
- import edu.wpi.first.wpilibj.RobotDrive;
- import edu.wpi.first.wpilibj.Timer;
- import edu.wpi.first.wpilibj.livewindow.LiveWindow;
- /**
- * The VM is configured to automatically run this class, and to call the
- * functions corresponding to each mode, as described in the IterativeRobot
- * 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.
- */
- public class Robot extends IterativeRobot {
- RobotDrive myRobot = new RobotDrive(0, 2, 1, 3);
- Joystick stick = new Joystick(0);
- Timer timer = new Timer();
- /**
- * This function is run when the robot is first started up and should be
- * used for any initialization code.
- */
- @Override
- public void robotInit() {
- System.out.println("Start my robot");
- }
- /**
- * This function is run once each time the robot enters autonomous mode
- */
- @Override
- public void autonomousInit() {
- timer.reset();
- timer.start();
- }
- /**
- * This function is called periodically during autonomous
- */
- @Override
- public void autonomousPeriodic() {
- // Drive for 2 seconds
- if (timer.get() < 50.0) {
- myRobot.drive(-0.5, 0.0); // drive forwards half speed
- } else {
- myRobot.drive(0.0, 0.0); // stop robot
- }
- }
- /**
- * This function is called once each time the robot enters tele-operated
- * mode
- */
- @Override
- public void teleopInit() {
- }
- /**
- * This function is called periodically during operator control
- */
- @Override
- public void teleopPeriodic() {
- myRobot.arcadeDrive(stick);
- }
- /**
- * This function is called periodically during test mode
- */
- @Override
- public void testPeriodic() {
- LiveWindow.run();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement