Skip to content

Commit 7091049

Browse files
committed
Vision Testing
1 parent 0aed0a1 commit 7091049

File tree

10 files changed

+529
-414
lines changed

10 files changed

+529
-414
lines changed

src/main/java/frc/paths/NewAutoPartOne.java

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

src/main/java/frc/paths/NewAutoPartTwo.java

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

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ public void robotPeriodic() {
122122
// robot's periodic
123123
// block in order for anything in the Command-based framework to work.
124124
CommandScheduler.getInstance().run();
125-
mRobotContainer.enableLights();
125+
// mRobotContainer.enableLights();
126+
126127
}
127128

128129
/** This function is called once each time the robot enters Disabled mode. */
@@ -146,7 +147,7 @@ public void disabledPeriodic() {
146147
}
147148
}
148149

149-
mRobotContainer.enableLights();
150+
mRobotContainer.disableLights();
150151
mRobotContainer.displaySwitch();
151152
}
152153

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,8 @@ public void configureButtonBindings() {
232232

233233
// new JoystickButton(driver, RMZ_E_UP).whenPressed(new ZeroHeading(mDrive));
234234

235-
new JoystickButton(driver, RMZ_A_IN).whenHeld(new TurnToAngle(mDrive, mLimelight, joysticks));
235+
new JoystickButton(driver, RMZ_A_IN).whenHeld(new TurnToAngle(mDrive, mLimelight, joysticks)
236+
.alongWith(new TurnOnLEDs(mLimelight)));
236237

237238
new JoystickButton(driver, RMZ_D_IN).whenPressed(new PullTrigger(mShooter));
238239
new JoystickButton(driver, RMZ_D_IN).whenReleased(new StopTrigger(mShooter));
@@ -351,10 +352,14 @@ public void configureButtonBindings() {
351352
// .alongWith(new TurnOffLEDs(mLimelight))
352353
// .alongWith(new IdleCommand()));
353354

354-
// xBoxX.whenHeld(new VisionShooter(mShooter, mLimelight));
355+
// xBoxX.whenHeld(new VisionShooter(mShooter, mLimelight)
356+
// .alongWith(new TurnOnLEDs(mLimelight))
357+
// .alongWith(new XBoxButtonCommand(X_BOX_X)));
355358
xBoxX.whenHeld(new MotionProfileTurn(mDrive, Math.PI/2));
356359

357-
// xBoxX.whenReleased(new StopShooter(mShooter));
360+
xBoxX.whenReleased(new StopShooter(mShooter)
361+
.alongWith(new TurnOffLEDs(mLimelight))
362+
.alongWith(new IdleCommand()));
358363

359364
JoystickButton xBoxY = new JoystickButton(operator, X_BOX_Y);
360365
xBoxY.whenHeld(new PresetFlywheelController(mShooter, "TUR")

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import frc.paths.NewAutoPartOne;
1515
import frc.paths.NewAutoPartThree;
1616
import frc.paths.NewAutoPartTwo;
17+
import frc.robot.Robot;
1718
import frc.robot.drive.Drivetrain;
1819
import frc.robot.drive.commands.ResetOdometry;
1920
import frc.robot.drive.commands.TrajectoryFollower;
@@ -26,6 +27,8 @@
2627
import frc.robot.shooter.commands.ResetEncoder;
2728
import frc.robot.shooter.commands.StopShooter;
2829
import frc.robot.shooter.commands.StopTrigger;
30+
import frc.robot.status.actions.ImageAction;
31+
import frc.robot.status.commands.ActionCommand;
2932

3033
// NOTE: Consider using this command inline, rather than writing a subclass. For more
3134
// information, see:
@@ -38,6 +41,7 @@ public NewAuto(Drivetrain drive, Shooter shooter, Intake intake) {
3841
new ResetEncoder(shooter),
3942
new ParallelDeadlineGroup(
4043
new WaitCommand(2.9),
44+
new ActionCommand(new ImageAction(Robot.fiveBallAutoImage, 0.02, ImageAction.FOREVER).brightness(0.7).oscillate()),
4145
new TrajectoryFollower(drive, new NewAutoPartOne()),
4246
new FastIntake(intake),
4347
new SequentialCommandGroup(
@@ -52,21 +56,21 @@ public NewAuto(Drivetrain drive, Shooter shooter, Intake intake) {
5256
),
5357
new WaitCommand(0.35),
5458
new ParallelDeadlineGroup(
55-
new WaitCommand(4.2),
59+
new WaitCommand(3.9),
5660
new TrajectoryFollower(drive, new NewAutoPartThree()),
5761
new SequentialCommandGroup(
5862
new WaitCommand(1.25),
5963
new FlywheelController(shooter, 1795, 76.0)
6064
),
6165
new SequentialCommandGroup(
62-
new WaitCommand(3.2),
66+
new WaitCommand(2.9),
6367
new PullTrigger(shooter)
6468
),
6569
new RetractIntake(intake)),
6670
new ParallelDeadlineGroup(
6771
new WaitCommand(3.0),
6872
new TrajectoryFollower(drive, new NewAutoPartFour()),
69-
new FlywheelController(shooter, 1795, 76.0),
73+
new FlywheelController(shooter, 1785, 75.5),
7074
new SequentialCommandGroup(
7175
new StopTrigger(shooter),
7276
new WaitCommand(1.25),

src/main/java/frc/robot/drive/Drivetrain.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public Drivetrain() {
101101
public void periodic() {
102102
// Update the odometry in the periodic block
103103
updateOdometry();
104-
// map.addPose(m_odometry.getPoseMeters(), Timer.getFPGATimestamp());
104+
map.addPose(m_odometry.getPoseMeters(), Timer.getFPGATimestamp());
105105

106106
SmartDashboard.putNumber("Heading", getHeading().getDegrees());
107107

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,14 @@ public class Shooter extends SubsystemBase {
2828
{2.95, 1980, 73.25}
2929
});
3030

31+
private static double erosion = 0.98;
32+
3133
private boolean hoodDirection;
3234
int highCurrentCount = 0;
3335
int lowCurrentCount = 0;
3436

37+
38+
3539
private double targetVelocity = 0.0; // Target velocity of the shooter.
3640
private boolean triggerPull = false;
3741
private boolean triggerEject = false;
@@ -251,7 +255,7 @@ public ShooterState(double hoodAngle, double velocity) {
251255
}
252256

253257
public static double lookupVelocity(double distance) {
254-
return INTERPOLATION_TABLE.sample(distance)[0];
258+
return INTERPOLATION_TABLE.sample(distance)[0] * erosion;
255259
}
256260

257261
public static double lookupHoodAngle(double distance) {

src/main/java/frc/robot/shooter/commands/VisionShooter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ void controller() {
6464
double voltage = flywheel.solveFeedforward(rpm, 0) + flywheelController.calculate(velocity, dt);
6565
// double voltage = flywheel.solveFeedforward(rpm, 0);
6666

67-
shooter.setShooterVoltage(voltage);
67+
shooter.setShooterVoltage(Math.min(voltage, 11.5));
6868

6969
lastPosition = position;
7070
lastTime = time;
Binary file not shown.

src/main/python/paths.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,12 @@ def main():
107107
generator.generate([
108108
[-0,0,-2.35],
109109
[1.1,0.3,-2.55],
110+
[0.95,0.15,-2.55],
110111
],
111112
"NewAutoPartOne")
112113

113114
generator.generate([
114-
[1,0.3,-2.55],
115+
[0.95,0.15,-2.55],
115116
[5.2,0.7,-2.275],
116117
[5.4,0.9,-2.275],
117118
[5.05,0.5,-2.275]

0 commit comments

Comments
 (0)