Skip to content

Commit 652495a

Browse files
committed
Competition Testing
1 parent 3a11a69 commit 652495a

File tree

9 files changed

+586
-515
lines changed

9 files changed

+586
-515
lines changed

src/main/java/frc/paths/FourBallPartThree.java

Lines changed: 201 additions & 201 deletions
Large diffs are not rendered by default.

src/main/java/frc/paths/FourBallPartTwo.java

Lines changed: 301 additions & 301 deletions
Large diffs are not rendered by default.

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import frc.robot.status.commands.IdleCommand;
2222
import frc.robot.status.commands.SetColor;
2323
import frc.robot.status.groups.LEDDemoCG;
24+
import frc.robot.vision.commands.TurnOffLEDs;
2425

2526
/**
2627
* The VM is configured to automatically run this class, and to call the
@@ -112,6 +113,9 @@ public void disabledPeriodic() {
112113
mRobotContainer.configureButtonBindings();
113114
}
114115
}
116+
117+
mRobotContainer.disableLights();
118+
mRobotContainer.displaySwitch();
115119
}
116120

117121
/**

src/main/java/frc/robot/RobotContainer.java

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ public class RobotContainer {
9292
private final Status mStatus = Status.getInstance();
9393
private final Climber mClimber = new Climber();
9494

95+
private final DigitalInput fiveBallAuto = new DigitalInput(3);
96+
private final DigitalInput twoBallSouthAuto = new DigitalInput(1);
97+
private final DigitalInput twoBallEastAuto = new DigitalInput(2);
98+
private final DigitalInput fourBallAuto = new DigitalInput(4);
99+
95100
/*
96101
* private final Indexer mIndexer = new Indexer();
97102
* private final PowerDistribution mPDP = new PowerDistribution(
@@ -132,11 +137,6 @@ public Command getAutonomousCommand() {
132137
// return new TrajectoryFollower(mDrive, new CollectSecondBall());
133138
Command autoCommand = null;
134139

135-
DigitalInput fiveBallAuto = new DigitalInput(0);
136-
DigitalInput twoBallSouthAuto = new DigitalInput(1);
137-
DigitalInput twoBallEastAuto = new DigitalInput(2);
138-
DigitalInput fourBallAuto = new DigitalInput(4);
139-
140140
try {
141141
if(!fiveBallAuto.get()){
142142
autoCommand = new FiveBallAuto(mDrive, mIntake, mShooter);
@@ -156,6 +156,25 @@ public Command getAutonomousCommand() {
156156
return autoCommand;
157157
}
158158

159+
public void displaySwitch() {
160+
// try {
161+
// if(!fiveBallAuto.get()){
162+
// SmartDashboard.putNumber("DIO", 3);
163+
// } else if (!twoBallSouthAuto.get()) {
164+
// SmartDashboard.putNumber("DIO", 1);
165+
// } else if (!twoBallEastAuto.get()) {
166+
// SmartDashboard.putNumber("DIO", 2);
167+
// } else if (!fourBallAuto.get()) {
168+
// SmartDashboard.putNumber("DIO", 4);
169+
// } else {
170+
// SmartDashboard.putNumber("DIO", -1);
171+
// }
172+
// } catch (Exception e) {
173+
174+
// }
175+
176+
}
177+
159178
public void setLEDs() {
160179
new SetColor(mStatus, Color.kCornsilk).schedule();
161180
}

src/main/java/frc/robot/auto/groups/FiveBallAuto.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import frc.robot.shooter.Shooter;
2727
import frc.robot.shooter.commands.FlywheelController;
2828
import frc.robot.shooter.commands.PullTrigger;
29+
import frc.robot.shooter.commands.ResetEncoder;
2930
import frc.robot.shooter.commands.ResetHood;
3031
import frc.robot.shooter.commands.StopShooter;
3132
import frc.robot.shooter.commands.StopTrigger;
@@ -38,12 +39,13 @@ public class FiveBallAuto extends SequentialCommandGroup {
3839
public FiveBallAuto(Drivetrain drive, Intake intake, Shooter shooter) {
3940
addCommands(
4041
new ResetOdometry(drive, new Pose2d(new Translation2d(0, 0), Rotation2d.fromDegrees(-90.0))),
42+
new ResetEncoder(shooter),
4143
new ParallelDeadlineGroup(
4244
new SequentialCommandGroup(
4345
new WaitCommand(1.0), // Give shooter time to spin up & hood to move
4446
new PullTrigger(shooter),
4547
new WaitCommand(0.5)),
46-
new ActionCommand(new ImageAction("THfade.png", 0.01).brightness(0.7)),
48+
// new ActionCommand(new ImageAction("THfade.png", 0.01).brightness(0.7)),
4749
new TrajectoryFollower(drive, new FiveBallPartOne()), // Turn to point at center
4850
new FlywheelController(shooter, 1810, 77.90)),
4951
new ParallelDeadlineGroup(

src/main/java/frc/robot/auto/groups/FourBallAuto.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import frc.robot.shooter.Shooter;
2424
import frc.robot.shooter.commands.FlywheelController;
2525
import frc.robot.shooter.commands.PullTrigger;
26+
import frc.robot.shooter.commands.ResetEncoder;
2627
import frc.robot.shooter.commands.ResetHood;
2728
import frc.robot.shooter.commands.StopShooter;
2829
import frc.robot.shooter.commands.StopTrigger;
@@ -35,11 +36,12 @@ public class FourBallAuto extends SequentialCommandGroup{
3536

3637
public FourBallAuto(Drivetrain drive, Intake intake, Shooter shooter) {
3738
addCommands(
38-
new ActionCommand(new ImageAction("fade.png",0.02).oscillate().brightness(0.7)),
39+
// new ActionCommand(new ImageAction("fade.png",0.02).oscillate().brightness(0.7)),
3940
new ResetOdometry(drive, new Pose2d(new Translation2d(0,0),Rotation2d.fromDegrees(-90))),
41+
new ResetEncoder(shooter),
4042
new ParallelDeadlineGroup(
4143
new WaitCommand(4.25),
42-
new ResetHood(shooter),
44+
// new ResetHood(shooter),
4345
new SequentialCommandGroup(
4446
new WaitCommand(1.75),
4547
new FlywheelController(shooter, 1800, 78.25)),

src/main/java/frc/robot/shooter/Shooter.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ public void resetHoodAngle() {
112112
setHoodPosition(ShooterConstants.kHoodMinAngle);
113113
}
114114

115+
public void resetHoodEncoder() {
116+
hoodEncoder.setPosition(ShooterConstants.kHoodMinAngle);
117+
}
118+
115119
public boolean checkHoodCurrentLimit() {
116120
if ( ShooterConstants.kHoodStopCurrentLimit < hoodMotor.getOutputCurrent()) {
117121
highCurrentCount++;
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright (c) FIRST and other WPILib contributors.
2+
// Open Source Software; you can modify and/or share it under the terms of
3+
// the WPILib BSD license file in the root directory of this project.
4+
5+
package frc.robot.shooter.commands;
6+
7+
import edu.wpi.first.wpilibj2.command.CommandBase;
8+
import frc.robot.shooter.Shooter;
9+
10+
public class ResetEncoder extends CommandBase {
11+
Shooter shooter;
12+
13+
public ResetEncoder(Shooter shooter) {
14+
this.shooter = shooter;
15+
}
16+
17+
// Called when the command is initially scheduled.
18+
@Override
19+
public void initialize() {
20+
shooter.resetHoodEncoder();
21+
}
22+
23+
@Override
24+
public boolean isFinished() {
25+
return true;
26+
}
27+
}

src/main/python/paths.py

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,25 @@ def main():
6161
# [6.35,0.0,-2.1]],
6262
# "FourBallPartTwo")
6363

64+
generator.generate([
65+
[0,0,-1.95],
66+
[2.5,0.85,-1.95],
67+
[5.7,-0.3,-2.1],
68+
[6.15,0.15,-2.1]],
69+
"FourBallPartTwo")
70+
6471
# generator.generate([
6572
# [6.35,0.0,-2.1],
6673
# [2.5,0.85,-2.1],
6774
# [-0.3,-0.3,-1.95]],
6875
# "FourBallPartThree")
6976

77+
generator.generate([
78+
[6.15,0.15,-2.1],
79+
[2.5,0.85,-2.1],
80+
[0.2,-0.3,-1.95]],
81+
"FourBallPartThree")
82+
7083
# generator.generate([
7184
# [0,0,-1.57],
7285
# [0,0.00000001,-1.85]],
@@ -85,10 +98,10 @@ def main():
8598
# ],
8699
# "FiveBallPartThree")
87100

88-
generator.generate([
89-
[6.47,0.2,-math.pi+0.7],
90-
[0.10,-0.375,-math.pi+0.9]
91-
],
92-
"FiveBallPartFour")
101+
# generator.generate([
102+
# [6.47,0.2,-math.pi+0.7],
103+
# [0.10,-0.375,-math.pi+0.9]
104+
# ],
105+
# "FiveBallPartFour")
93106

94107
main()

0 commit comments

Comments
 (0)