Skip to content

Commit fc71658

Browse files
Testing on 3/31
1 parent ee60ca3 commit fc71658

File tree

4 files changed

+62
-4
lines changed

4 files changed

+62
-4
lines changed

src/main/java/frc/robot/HeadHoncho.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,21 @@ public void initialize() {
374374
LIFT_SUBSYSTEM.setState(TargetLiftStates.STOW);
375375
}
376376

377+
@Override
378+
public SystemState nextState() {
379+
if (s_cancelButton.getAsBoolean()) return STOW;
380+
if (timer.hasElapsed(0.5)) return ALGAE_KICK;
381+
return this;
382+
}
383+
},
384+
ALGAE_KICK {
385+
Timer timer = new Timer();
386+
@Override
387+
public void initialize() {
388+
timer.restart();
389+
LIFT_SUBSYSTEM.setState(TargetLiftStates.A_KICK);
390+
}
391+
377392
@Override
378393
public SystemState nextState() {
379394
if (s_cancelButton.getAsBoolean()) return STOW;
@@ -389,6 +404,7 @@ public void initialize() {
389404

390405
@Override
391406
public SystemState nextState() {
407+
if (s_cancelButton.getAsBoolean()) return STOW;
392408
if (END_EFFECTOR_SUBSYSTEM.isEmpty()) return INTAKE;
393409

394410
return this;
@@ -410,6 +426,7 @@ public void initialize() {
410426

411427
@Override
412428
public SystemState nextState() {
429+
if (s_cancelButton.getAsBoolean()) return STOW;
413430
if (END_EFFECTOR_SUBSYSTEM.isEmpty()) return INTAKE;
414431

415432
return this;

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
package frc.robot;
66

77
import edu.wpi.first.cameraserver.CameraServer;
8+
import edu.wpi.first.wpilibj.Servo;
89
import edu.wpi.first.wpilibj.Threads;
910
import edu.wpi.first.wpilibj2.command.Command;
1011
import edu.wpi.first.wpilibj2.command.CommandScheduler;
@@ -20,8 +21,12 @@ public class Robot extends LoggedRobot {
2021

2122
private final RobotContainer m_robotContainer;
2223

24+
private final Servo phlapServo;
25+
2326
public Robot() {
2427

28+
phlapServo = new Servo(3);
29+
2530
if (isReal()) {
2631
Logger.addDataReceiver(new WPILOGWriter("/U/")); // Log to a USB stick ("/U/logs")
2732
Logger.addDataReceiver(new NT4Publisher()); // Publish data to NetworkTables
@@ -67,6 +72,8 @@ public void disabledExit() {}
6772
public void autonomousInit() {
6873
Logger.recordOutput("Auto/Lift/State", "starting");
6974
m_autonomousCommand = m_robotContainer.getAutonomousCommand();
75+
76+
phlapServo.set(1);
7077

7178
if (m_autonomousCommand != null) {
7279
m_autonomousCommand.schedule();
@@ -83,6 +90,8 @@ public void autonomousExit() {}
8390

8491
@Override
8592
public void teleopInit() {
93+
phlapServo.set(1);
94+
8695
if (m_autonomousCommand != null) {
8796
m_autonomousCommand.cancel();
8897
}

src/main/java/frc/robot/subsystems/drivetrain/DriveSubsystem.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ public void end(boolean interrupted) {
395395

396396
// private static ArrayList<AprilTagCamera> m_cameras;
397397

398-
private static double s_driveSpeedScalar = 0.2;
398+
private static double s_driveSpeedScalar = Constants.Drive.FAST_SPEED_SCALAR;
399399

400400
protected final Thread m_limelight_thread;
401401

@@ -429,8 +429,8 @@ public DriveSubsystem(Hardware driveHardware, Telemetry logger) {
429429
s_autoDrive.HeadingController.setPID(5, 0, 0);
430430
s_autoDrive.HeadingController.enableContinuousInput(0, Math.PI * 2);
431431

432-
s_autoDrive.XController.setPID(1.5, 0, 0);
433-
s_autoDrive.YController.setPID(4, 0, 0);
432+
s_autoDrive.XController.setPID(6, 0, 0);
433+
s_autoDrive.YController.setPID(6, 0, 0);
434434

435435
s_drivetrain.registerTelemetry(logger::telemeterize);
436436

src/main/java/frc/robot/subsystems/lift/LiftSubsystem.java

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ public static enum TargetLiftStates {
5656
L4,
5757
A1,
5858
A2,
59-
A_SCORE
59+
A_SCORE,
60+
A_KICK
6061
}
6162

6263
private static TargetLiftStates nextState;
@@ -211,6 +212,9 @@ public SystemState nextState() {
211212
if (nextState == TargetLiftStates.TURBO) {
212213
return STOW_TURBO_S1;
213214
}
215+
if (nextState == TargetLiftStates.A_KICK) {
216+
return A_KICK;
217+
}
214218
return this;
215219
}
216220
},
@@ -439,6 +443,34 @@ public SystemState nextState() {
439443
if (nextState == TargetLiftStates.STOW) {
440444
return STOW;
441445
}
446+
if (nextState == TargetLiftStates.A_KICK) {
447+
return A_KICK;
448+
}
449+
return this;
450+
}
451+
},
452+
A_KICK {
453+
@Override
454+
public void initialize() {
455+
s_liftinstance.setElevatorHeight(STOW_HEIGHT);
456+
s_liftinstance.setArmAngle(SCORING_A1_ANGLE);
457+
}
458+
459+
@Override
460+
public void execute() {
461+
if (s_liftinstance.armAt(SCORING_A1_ANGLE) && s_liftinstance.elevatorAt(STOW_HEIGHT)) {
462+
isLiftReady = true;
463+
} else {
464+
isLiftReady = false;
465+
}
466+
}
467+
468+
@Override
469+
public SystemState nextState() {
470+
curState = TargetLiftStates.A_KICK;
471+
if (nextState == TargetLiftStates.STOW) {
472+
return STOW;
473+
}
442474
return this;
443475
}
444476
},

0 commit comments

Comments
 (0)