-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathRobot.java
More file actions
110 lines (73 loc) · 2.92 KB
/
Robot.java
File metadata and controls
110 lines (73 loc) · 2.92 KB
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package frc.robot;
import static frc.robot.Ports.*;
import edu.wpi.first.cameraserver.CameraServer;//Leave this
import edu.wpi.first.wpilibj.TimedRobot;
import edu.wpi.first.wpilibj.DriverStation;//Leave this
// import com.analog.adis16448.frc.ADIS16448_IMU; // Gyro import, leave in
/**
* 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 build.gradle file in the
* project.
*/
public class Robot extends TimedRobot {
private boolean isDriverControlling;
private double matchTime;//undefined right now
private Boolean endgameInit;//if this giving an error ignore it
public final DriveTrain driveTrain = new DriveTrain(LEFT_DRIVETRAIN_1, LEFT_DRIVETRAIN_2, RIGHT_DRIVETAIN_1,
RIGHT_DRIVETAIN_2, GYRO_PORT);
public final BallSpitter ballSpitter = new BallSpitter(5);
private final LambdaJoystick joystick1 = new LambdaJoystick(0, driveTrain::updateSpeed);
private final LambdaJoystick joystick2 = new LambdaJoystick(1, ballSpitter::updateSpeed);
//private MotionProfiling path = new MotionProfiling(driveTrain, setupLeft, setupRight); (Setup left/right are path/trajectory files)
@Override
public void robotInit() {
}
@Override
public void robotPeriodic() {
joystick1.addButton(1, driveTrain::setThrottleDirectionConstant);// flips heading
joystick1.addButton(3, driveTrain::togglethrottleMode);// Switches throttlemode
}
@Override
public void autonomousInit() {
driveTrain.startAuto();
}
@Override
public void autonomousPeriodic() {
//Hey this is fun
//Get back to work
//No
//Stop having conversations in the code
//No
//sigh
}
@Override
public void teleopInit() {
isDriverControlling = true;
driveTrain.stopAuto();
}
@Override
public void teleopPeriodic() {
joystick1.listen();
joystick2.listen();
// endgameInit = (30 >= matchTime) ? true : false;
// if (endgameInit = true) {
// }
}
@Override
public void testInit(){
}
@Override
public void testPeriodic(){
}
public void changeDriverControl() {
this.isDriverControlling = !isDriverControlling;
}
}