Skip to content

Commit 9aedfa7

Browse files
author
Robotics
committed
competition changes day 2
1 parent 56a3bb4 commit 9aedfa7

File tree

16 files changed

+77
-53
lines changed

16 files changed

+77
-53
lines changed
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
18 KB
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

FRC2020/src/main/java/frc/robot/OI.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class OI {
1212
Joystick rightStick = RobotMap.rightJoystick;
1313
public XboxController xbox = RobotMap.xboxController;
1414

15-
public double valueShooterSpeed = 0.5;
15+
public static double valueShooterSpeed = 0.85;
1616

1717
Button leftbutton1 = new JoystickButton(leftStick, 1), leftbutton2 = new JoystickButton(leftStick, 2);
1818
Button leftbutton3 = new JoystickButton(leftStick, 3), leftbutton4 = new JoystickButton(leftStick, 4);
@@ -35,19 +35,19 @@ public class OI {
3535

3636
public double getLeftSpeed() {
3737
if (leftStick.getY() > 0.01) {
38-
return 0.5 * Math.pow(leftStick.getY(), 3) - 0.01;
38+
return 0.8 * Math.pow(leftStick.getY(), 3) + 0.01;
3939
} else if (leftStick.getY() <= -0.01) {
40-
return 0.5 * Math.pow(leftStick.getY(), 3) + 0.01;
40+
return 0.8 * Math.pow(leftStick.getY(), 3) - 0.01;
4141
} else {
4242
return 0.0;
4343
}
4444
}
4545

4646
public double getRightSpeed() {
4747
if (rightStick.getY() > 0.01) {
48-
return 0.5 * -1.0 * Math.pow(rightStick.getY(), 3) + 0.01;
48+
return 0.8 * -1.0 * Math.pow(rightStick.getY(), 3) - 0.01;
4949
} else if (rightStick.getY() < -0.01) {
50-
return 0.5 * -1.0 * Math.pow(rightStick.getY(), 3) - 0.01;
50+
return 0.8 * -1.0 * Math.pow(rightStick.getY(), 3) + 0.01;
5151
} else {
5252
return 0.0;
5353
}

FRC2020/src/main/java/frc/robot/Robot.java

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -91,26 +91,37 @@ public void autonomousInit() {
9191

9292
@Override
9393
public void autonomousPeriodic() {
94+
9495
boolean drive = true;
96+
double time = 2.0;
97+
double time2 = 4.0;
9598
double currentDistance = RobotMap.distanceSensor.getValue() * 0.125;
9699

97-
if (currentDistance < 12){
100+
if (currentDistance < 40){
98101
drive = false;
102+
Robot.driveTrain.stop();
99103
}
100104

101-
while ((timer.get() < 5)){ // the number represents seconds
105+
if ((timer.get() < time)){ // the number represents seconds
102106
if (drive){
103-
Robot.driveTrain.tankDrive(1.0, 1.0); //change speed
107+
//Robot.driveTrain.tankDrive(0.5, 0.5); //change speed
108+
RobotMap.LeftMotor.set(-0.5);
109+
RobotMap.RightMotor.set(0.45);
104110
}
105111
}
106-
if (timer.get() > 5){
112+
113+
if ( time < timer.get() && timer.get() < time2) {
114+
RobotMap.LeftMotor.set(0.5);
115+
RobotMap.RightMotor.set(0.45);
116+
}
117+
118+
if (timer.get() > time2){
107119
Robot.driveTrain.stop();
108120
}
109121
}
110122

111123
@Override
112124
public void teleopInit() {
113-
114125
// Init relay
115126
RobotMap.GreenLED.set(Relay.Value.kOn);
116127
RobotMap.GreenLED.set(Relay.Value.kReverse);
@@ -144,7 +155,7 @@ public void robotPeriodic() {
144155
SmartDashboard.putNumber("Confidence", match.confidence);
145156
SmartDashboard.putString("Detected Color", colorString);
146157
SmartDashboard.putNumber("Proximity", proximity);
147-
SmartDashboard.putNumber("ShooterSpeed", OI.valueShooterSpeed);
158+
SmartDashboard.putNumber("ShooterSpeed", frc.robot.OI.valueShooterSpeed);
148159
SmartDashboard.putNumber("Rotations Completed", ColorCycle.colorCycleValue);
149160
SmartDashboard.putNumber("Colors Passed", ColorCycle.colorsPassedValue);
150161
SmartDashboard.putNumber("Bottom Limit Switch", RobotMap.bottomLimitSwitch.get() ? 1:0);
@@ -157,17 +168,18 @@ public void teleopPeriodic() {
157168
Scheduler.getInstance().run();
158169

159170
if (OI.changeShooterSpeed() == 1) {
160-
if (OI.valueShooterSpeed < 1) {
161-
OI.valueShooterSpeed = OI.valueShooterSpeed + 0.02;
171+
if (frc.robot.OI.valueShooterSpeed < 1) {
172+
frc.robot.OI.valueShooterSpeed = frc.robot.OI.valueShooterSpeed + 0.02;
162173
}
163174
} else if (OI.changeShooterSpeed() == 2) {
164-
if (OI.valueShooterSpeed > 0) {
165-
OI.valueShooterSpeed = OI.valueShooterSpeed - 0.02;
175+
if (frc.robot.OI.valueShooterSpeed > 0) {
176+
frc.robot.OI.valueShooterSpeed = frc.robot.OI.valueShooterSpeed - 0.02;
166177
}
167-
}
178+
}
168179
}
169180

170181
@Override
182+
171183
public void testPeriodic() {
172184
}
173185
}

FRC2020/src/main/java/frc/robot/commands/ColorCycleController.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,16 @@ protected void execute() {
1717
if (oi.cycle() == true) {
1818
ColorCycle.colorCycleStart();
1919
} else if (oi.cycle() == false) {
20-
ColorCycle.colorCycleStop();
21-
}
22-
23-
if (ColorCycle.colorCycleValue == 3) {
24-
end();
25-
}
20+
ColorCycle.colorCycleStop();
21+
} else if (ColorCycle.colorCycleValue == 3) {
22+
end();
23+
try {
24+
Thread.sleep(250);
25+
}
26+
catch (Exception e) {
27+
System.out.println(e);
28+
}
29+
}
2630
}
2731

2832
protected boolean isFinished() {

0 commit comments

Comments
 (0)