Skip to content

Commit f9e2e82

Browse files
author
marc-afk
committed
updated OI with old talons
2 parents 445ca5b + 2e86c38 commit f9e2e82

File tree

4 files changed

+24
-35
lines changed

4 files changed

+24
-35
lines changed
0 Bytes
Binary file not shown.

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

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
package frc.robot;
22

3-
// import edu.wpi.first.wpilibj.CameraServer;
4-
// import edu.wpi.first.wpilibj.DriverStation;
5-
// import edu.wpi.first.wpilibj.Spark;
63
import edu.wpi.first.wpilibj.Joystick;
74
import edu.wpi.first.wpilibj.Relay;
85
import edu.wpi.first.wpilibj.TimedRobot;
@@ -36,6 +33,7 @@ public class Robot extends TimedRobot {
3633
public final Color kRedTarget = ColorMatch.makeColor(0.561, 0.232, 0.114);
3734
public final Color kYellowTarget = ColorMatch.makeColor(0.361, 0.524, 0.113);
3835
public Harvester harvester = new Harvester();
36+
int shooterCycle = 0;
3937

4038
@Override
4139
public void robotInit() {
@@ -99,12 +97,21 @@ public void robotPeriodic() {
9997
colorString = "Unknown";
10098
}
10199

102-
if (OI.shoot() == true) {
100+
if ((shooterCycle == 0) == false) {
101+
shooterCycle = shooterCycle + 1;
102+
} else if (OI.shoot() == true) {
103103
Shooter.shooterShoot(OI.valueShooterSpeed);
104-
} else if (OI.shoot() == false) {
104+
shooterCycle = 1;
105+
} else {
105106
Shooter.shooterStop();
106107
}
107108

109+
if (shooterCycle == 10) {
110+
Shooter.initiateShot();
111+
} else if (shooterCycle == 20) {
112+
shooterCycle = 0;
113+
}
114+
108115
if (OI.changeShooterSpeed() == 1) {
109116
if (OI.valueShooterSpeed < 1) {
110117
OI.valueShooterSpeed = OI.valueShooterSpeed + 0.02;
@@ -141,25 +148,6 @@ public void robotPeriodic() {
141148

142149
@Override
143150
public void teleopPeriodic() {
144-
/*
145-
* // Left trigger pressed, end OI commands and start tape script if
146-
* (leftstick.getTriggerPressed() && toggle == false) {
147-
* RobotMap.GreenLED.set(Relay.Value.kForward);
148-
* Scheduler.getInstance().removeAll();
149-
* Scheduler.getInstance().add(newautonomous(1)); toggle = true; }
150-
*
151-
* // Right trigger pressed, end OI commands and start ball script if
152-
* (rightstick.getTriggerPressed() && toggle == false) {
153-
* Scheduler.getInstance().removeAll();
154-
* Scheduler.getInstance().add(newautonomous(2)); toggle = true; }
155-
*
156-
* // Both triggers released, end autoomous scripts and start OI scripts if
157-
* (leftstick.getTriggerReleased() && rightstick.getTriggerReleased() &&
158-
* toggle){ DriverStation.reportError("TRIGGER", false);
159-
* RobotMap.GreenLED.set(Relay.Value.kReverse);
160-
* Scheduler.getInstance().add(newautonomous(0)); OICommands(); toggle = false;
161-
* }
162-
*/
163151
Scheduler.getInstance().run();
164152

165153
}

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

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import edu.wpi.first.wpilibj.I2C;
44
import edu.wpi.first.wpilibj.Joystick;
55
import edu.wpi.first.wpilibj.Relay;
6-
import edu.wpi.first.wpilibj.Spark;
76
import edu.wpi.first.wpilibj.XboxController;
87
import edu.wpi.first.wpilibj.DigitalInput;
98
import edu.wpi.first.wpilibj.Talon;
@@ -20,16 +19,13 @@ public class RobotMap {
2019
public static WPI_TalonSRX Shooter = new WPI_TalonSRX(5);
2120
public static WPI_TalonSRX Harvester = new WPI_TalonSRX(6);
2221

23-
// Spark/Spike motors setup
24-
public static Spark Conveyor = new Spark(1);
25-
public static Spark Spinner = new Spark(2);
26-
public static Spark Gatherer = new Spark(3);
27-
public static Spark Flap = new Spark(4);
22+
// TalonSR motors setup
23+
public static Talon Conveyor = new Talon(1);
24+
public static Talon Spinner = new Talon(2);
25+
public static Talon Gatherer = new Talon(3);
26+
public static Talon Flap = new Talon(4);
2827

29-
// Talon SR Speed Controller (used as Spark)
30-
public static Talon talon = new Talon(0); //What's the channel?
31-
32-
//Digital Input setup
28+
// Digital Input setup
3329
public static DigitalInput topLimitSwitch = new DigitalInput(0);
3430

3531
// Joysticks/Controllers setup
@@ -44,5 +40,4 @@ public class RobotMap {
4440

4541
// Relay
4642
public static Relay GreenLED = new Relay(3);
47-
4843
}

FRC2020/src/main/java/frc/robot/subsystems/Shooter.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,11 @@ public static void shooterShoot(double speed) {
1717
public static void shooterStop() {
1818
RobotMap.Conveyor.set(0);
1919
RobotMap.Shooter.set(0);
20+
RobotMap.Flap.set(0);
21+
}
22+
23+
public static void initiateShot(){
24+
RobotMap.Conveyor.set(1);
25+
RobotMap.Flap.set(1);
2026
}
2127
}

0 commit comments

Comments
 (0)