This repository has been archived by the owner on Apr 10, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRobot.java
94 lines (81 loc) · 2.42 KB
/
Robot.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
package org.usfirst.frc.team6763.robot;
//Imports the other files needed by the program
import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.livewindow.LiveWindow;
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.Victor;
import edu.wpi.first.wpilibj.livewindow.LiveWindow;
//Imports the other files needed by the program
import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.RobotDrive;
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, 1, 2, 3);
Joystick stick = new Joystick(1);
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() {
}
/**
* 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() < 2.0) {
myRobot.drive(-0.5, 0.0); // drive forwards half speed
} else if (timer.get() > 2.0 && timer.get() < 5.75) {
myRobot.drive(-0.5, 0.5); // drive right
} else if (timer.get() > 5.75 && timer.get() < 7.75) {
myRobot.drive(-0.5, 0.0); // drive forward
} else {
myRobot.drive(0.0, 0.0); // stop
}
}
/**
* 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();
}
}