]
}
}
+ },
+ {
+ "name": "Hood Down",
+ "waypointRelativePos": 0,
+ "endWaypointRelativePos": null,
+ "command": {
+ "type": "named",
+ "data": {
+ "name": "Hood Down"
+ }
+ }
+ },
+ {
+ "name": "Stop Hood Down",
+ "waypointRelativePos": 0.5534308211473522,
+ "endWaypointRelativePos": null,
+ "command": {
+ "type": "named",
+ "data": {
+ "name": "Stop Hood Down"
+ }
+ }
}
],
"globalConstraints": {
"waypoints": [
{
"anchor": {
- "x": 3.5467141162514837,
- "y": 0.6942704626334513
+ "x": 4.396690391459075,
+ "y": 0.43604982206405685
},
"prevControl": null,
"nextControl": {
- "x": 5.83681954887218,
- "y": 0.7017406015037613
+ "x": 6.580806642941875,
+ "y": 0.823380782918149
+ },
+ "isLocked": false,
+ "linkedName": null
+ },
+ {
+ "anchor": {
+ "x": 7.301672597864768,
+ "y": 0.823380782918149
+ },
+ "prevControl": {
+ "x": 6.72798848994848,
+ "y": 0.776996631189148
+ },
+ "nextControl": {
+ "x": 7.911232317280483,
+ "y": 0.8726655898756941
},
"isLocked": false,
"linkedName": null
"y": 1.5158029801324506
},
"prevControl": {
- "x": 8.742932937101976,
- "y": 0.1380740879492448
+ "x": 8.57960288807054,
+ "y": 0.5564572982632667
},
"nextControl": {
- "x": 8.5023178807947,
- "y": 2.1111175496688723
+ "x": 8.571257413997628,
+ "y": 2.265112692763938
},
"isLocked": false,
"linkedName": null
"y": 3.57
},
"prevControl": {
- "x": 8.519890563503097,
- "y": 2.960165562913907
+ "x": 8.62505338078292,
+ "y": 2.275871886120997
},
"nextControl": null,
"isLocked": false,
],
"rotationTargets": [
{
- "waypointRelativePos": 0.42628774422735277,
+ "waypointRelativePos": 0.85,
"rotationDegrees": 29.999999999999996
},
{
- "waypointRelativePos": 0.6975023126734518,
+ "waypointRelativePos": 1.4,
"rotationDegrees": 90.84924216679515
}
],
"constraintZones": [
{
"name": "Constraints Zone",
- "minWaypointRelativePos": 0.7792207792207767,
- "maxWaypointRelativePos": 1.6989130434782616,
+ "minWaypointRelativePos": 1.55,
+ "maxWaypointRelativePos": 2.6989130434782616,
"constraints": {
"maxVelocity": 3.0,
"maxAcceleration": 3.0,
{
"name": "Constraints Zone",
"minWaypointRelativePos": 0,
- "maxWaypointRelativePos": 0.7151943462897536,
+ "maxWaypointRelativePos": 1.45,
"constraints": {
"maxVelocity": 6.0,
"maxAcceleration": 5.0,
}
],
"pointTowardsZones": [],
- "eventMarkers": [],
+ "eventMarkers": [
+ {
+ "name": "Intake",
+ "waypointRelativePos": 0,
+ "endWaypointRelativePos": null,
+ "command": {
+ "type": "parallel",
+ "data": {
+ "commands": [
+ {
+ "type": "named",
+ "data": {
+ "name": "Extend Intake"
+ }
+ },
+ {
+ "type": "named",
+ "data": {
+ "name": "Spin Intake Rollers"
+ }
+ },
+ {
+ "type": "named",
+ "data": {
+ "name": "Hood Down"
+ }
+ }
+ ]
+ }
+ }
+ },
+ {
+ "name": "Stop Hood Down",
+ "waypointRelativePos": 0.65,
+ "endWaypointRelativePos": null,
+ "command": {
+ "type": "named",
+ "data": {
+ "name": "Stop Hood Down"
+ }
+ }
+ }
+ ],
"globalConstraints": {
"maxVelocity": 3.0,
"maxAcceleration": 3.0,
]
}
}
+ },
+ {
+ "name": "Hood Down",
+ "waypointRelativePos": 0.9111361079864995,
+ "endWaypointRelativePos": null,
+ "command": {
+ "type": "named",
+ "data": {
+ "name": "Hood Down"
+ }
+ }
+ },
+ {
+ "name": "Stop Hood Down",
+ "waypointRelativePos": 1.7885264341957245,
+ "endWaypointRelativePos": null,
+ "command": {
+ "type": "named",
+ "data": {
+ "name": "Stop Hood Down"
+ }
+ }
}
],
"globalConstraints": {
}
],
"pointTowardsZones": [],
- "eventMarkers": [],
+ "eventMarkers": [
+ {
+ "name": "Retract Intake",
+ "waypointRelativePos": 0.5354330708661407,
+ "endWaypointRelativePos": null,
+ "command": {
+ "type": "parallel",
+ "data": {
+ "commands": [
+ {
+ "type": "named",
+ "data": {
+ "name": "Retract Intake"
+ }
+ },
+ {
+ "type": "named",
+ "data": {
+ "name": "Hood Down"
+ }
+ }
+ ]
+ }
+ }
+ }
+ ],
"globalConstraints": {
"maxVelocity": 3.0,
"maxAcceleration": 3.0,
},
"prevControl": null,
"nextControl": {
- "x": 0.9893708609271523,
- "y": 6.002997790234502
+ "x": 0.925765932523468,
+ "y": 5.968318426038064
},
"isLocked": false,
"linkedName": null
"y": 5.966
},
"prevControl": {
- "x": 1.3625978647686838,
- "y": 5.944756820877817
+ "x": 1.497518014658156,
+ "y": 5.9695580132966395
},
"nextControl": null,
"isLocked": false,
SmartDashboard.putString("RobotID", robotId.toString());
// Filling the SendableChooser on SmartDashboard
- autoChooserInit();
+ //autoChooserInit();
// dispatch on the robot
switch (robotId) {
PathGroupLoader.loadPathGroups();
// Load the auto command
try {
- String leftSideAuto = "Left Side Auto";
+ String leftSideAuto = "Left(No SOTM) - Under Trench";
PathPlannerAuto.getPathGroupFromAutoFile(leftSideAuto);
auto = new PathPlannerAuto(leftSideAuto);
} catch (IOException | ParseException e) {
e.printStackTrace();
}
+
if(turret != null){
turret.setDefaultCommand(new Superstructure(turret, drive, hood, shooter, spindexer));
}
}
if (hood != null){
- Command hoodDown = new InstantCommand(()-> {hood.setFieldRelativeTarget(Rotation2d.fromDegrees(HoodConstants.MAX_ANGLE), 0);}, hood);
- NamedCommands.registerCommand("Hood Down", new InstantCommand(()->{hoodDown.schedule();}));
- NamedCommands.registerCommand("Stop Hood Down", new InstantCommand(()-> {hoodDown.cancel();}));
+ NamedCommands.registerCommand("Hood Down", new InstantCommand(()->{hood.forceHoodDown(true);}));
+ NamedCommands.registerCommand("Stop Hood Down", new InstantCommand(()-> {hood.forceHoodDown(false);}));
}
}
}
- public Command getAutoCommand() {
- // get the selected Command
- Command autoSelected = autoChooser.getSelected();
-
- return autoSelected;
+ public Command getAutoCommand(){
+ return auto;
}
public void logComponents() {
hood.setFieldRelativeTarget(new Rotation2d(Units.degreesToRadians(hoodSetpoint)), hoodVelocity);
shooter.setShooter(ShotInterpolation.exitVelocityMap.get(goalState.exitVel()));
- SmartDashboard.putNumber("Turret Calculated Setpoint", turretSetpoint);
- SmartDashboard.putNumber("Hood Calculate Setpoint", hoodSetpoint);
- SmartDashboard.putNumber("Shooter Calculate Velocity", goalState.exitVel());
+ Logger.recordOutput("Turret Calculated Setpoint", turretSetpoint);
+ Logger.recordOutput("Hood Calculate Setpoint", hoodSetpoint);
+ Logger.recordOutput("Shooter Calculate Velocity", goalState.exitVel());
/** Spindexer Stuff!! */
if(spindexer != null){
--- /dev/null
+package frc.robot.commands.gpm;
+
+import edu.wpi.first.wpilibj2.command.Command;
+import frc.robot.subsystems.spindexer.Spindexer;
+import frc.robot.subsystems.turret.Turret;
+
+public class RunSpindexer extends Command {
+ private Spindexer spindexer;
+ private Turret turret;
+
+ public RunSpindexer(Spindexer spindexer, Turret turret){
+ this.spindexer = spindexer;
+ this.turret = turret;
+
+ addRequirements(spindexer);
+ }
+
+ @Override
+ public void execute() {
+ //if (turret.atSetpoint()){
+ spindexer.maxSpindexer();
+ // } else{
+ // spindexer.stopSpindexer();
+ // }
+ }
+
+ @Override
+ public void end(boolean interrupted) {
+ spindexer.stopSpindexer();
+ }
+}
Translation2d.kZero,
target3d.minus(lookahead3d),
target == FieldConstants.getHubTranslation().toTranslation2d() ?
- 2.0 : 5.0);
+ 2.0 : 2.0);
double TOFAdjustment = 0.75;
timeOfFlight = goalState.timeOfFlight() * TOFAdjustment;
SmartDashboard.putNumber("Turret Offset", turretOffset);
// Phase manager stuff
phaseManager.update(drivepose, shooter, turret);
- target = phaseManager.getTarget();
+ target = phaseManager.getTarget(drivepose);
updateDrivePose();
updateSetpoints(drivepose);
} else {
turret.setFieldRelativeTarget(Rotation2d.fromDegrees(turretSetpoint), turretVelocity - drivetrain.getAngularRate(2));
- if(phaseManager.getCurrentState() == CurrentState.UNDER_TRENCH){
- hood.setFieldRelativeTarget(Rotation2d.fromDegrees(HoodConstants.MAX_ANGLE), 0.0);
- } else{
+ // if(phaseManager.getCurrentState() == CurrentState.UNDER_TRENCH){
+ // hood.setFieldRelativeTarget(Rotation2d.fromDegrees(HoodConstants.MAX_ANGLE), 0.0);
+ // } else{
hood.setFieldRelativeTarget(Rotation2d.fromDegrees(ShotInterpolation.hoodAngleMap.get(hoodSetpoint)), hoodVelocity);
- }
+ // }
shooter.setShooter(-ShotInterpolation.exitVelocityMap.get(goalState.exitVel()));
// }
}
- SmartDashboard.putNumber("Turret Calculated Setpoint", turretSetpoint);
- SmartDashboard.putNumber("Hood Calculate Setpoint", hoodSetpoint);
- SmartDashboard.putNumber("Shooter Calculate Velocity", goalState.exitVel());
+ Logger.recordOutput("Turret Calculated Setpoint", turretSetpoint);
+ Logger.recordOutput("Hood Calculate Setpoint", hoodSetpoint);
+ Logger.recordOutput("Shooter Calculate Velocity", goalState.exitVel());
SmartDashboard.putString("Phase Manager State", phaseManager.getCurrentState().toString());
}
import frc.robot.commands.gpm.ClimbDriveCommand;
import frc.robot.commands.gpm.IntakeMovementCommand;
import frc.robot.commands.gpm.ReverseMotors;
+import frc.robot.commands.gpm.RunSpindexer;
import frc.robot.commands.gpm.Superstructure;
import frc.robot.constants.Constants;
import frc.robot.subsystems.Climb.LinearClimb;
() -> false, getDrivetrain()).withTimeout(2));
// Trench align
- controller.get(DPad.LEFT).whileTrue(new StartEndCommand(
+ controller.get(PS5Button.CIRCLE).whileTrue(new StartEndCommand(
() -> {
getDrivetrain().setTrenchAssist(true);
getDrivetrain().setTrenchAlign(true);
// Reverse motors
if (intake != null && spindexer != null) {
- controller.get(PS5Button.CIRCLE).whileTrue(new ReverseMotors(intake, spindexer));
controller.get(PS5Button.LB).whileTrue(new ReverseMotors(intake, spindexer));
}
// Spindexer
if (spindexer != null) {
// Will only run if we are not calling default shoot command
- controller.get(PS5Button.LEFT_TRIGGER).onTrue(new InstantCommand(() -> spindexer.maxSpindexer()))
- .onFalse(new InstantCommand(() -> spindexer.stopSpindexer()));
+ controller.get(PS5Button.LEFT_TRIGGER).whileTrue(new RunSpindexer(spindexer, turret));
}
// Auto shoot
private final ShooterIOInputsAutoLogged inputs = new ShooterIOInputsAutoLogged();
- double powerModifier = .75;
+ double powerModifier = 1.0;
public Shooter(){
updateInputs();
}
/**
- * @return If the turret is at setpoint with tolerance of 5 degrees
+ * @return If the turret is at setpoint with tolerance of 10 degrees
*/
public boolean atSetpoint() {
- return Math.abs(goalAngle.getRadians() - getPositionRad()) < Units.degreesToRadians(5.0);
+ return Math.abs(goalAngle.getRadians() - getPositionRad()) < Units.degreesToRadians(10.0);
}
/**
double motorGoalRotations = Units.radiansToRotations(best) * TurretConstants.GEAR_RATIO;
// Clamp position setpoint to min and max angles
- motorGoalRotations = MathUtil.clamp(motorGoalRotations, Units.degreesToRotations(-180) * TurretConstants.GEAR_RATIO, Units.degreesToRotations(180) * TurretConstants.GEAR_RATIO);
+ motorGoalRotations = MathUtil.clamp(motorGoalRotations, Units.degreesToRotations(TurretConstants.MIN_ANGLE) * TurretConstants.GEAR_RATIO, Units.degreesToRotations(TurretConstants.MAX_ANGLE) * TurretConstants.GEAR_RATIO);
// Multiply goal velocity by kV
double robotTurnCompensation = goalVelocityRadPerSec * TurretConstants.FEEDFORWARD_KV;
public Translation2d getTarget(Pose2d drivePose) {
return wantedState == WantedState.SHOOTING ? FieldConstants.getHubTranslation().toTranslation2d()
: (FieldConstants.isOnLeftSideOfField(drivePose.getTranslation())
- ? FieldConstants.getAllianceSideTranslation(true).toTranslation2d()
- : FieldConstants.getAllianceSideTranslation(false).toTranslation2d());
+ //TODO: reversed for sm reason
+ ? FieldConstants.getAllianceSideTranslation(false).toTranslation2d()
+ : FieldConstants.getAllianceSideTranslation(true).toTranslation2d());
}
}
\ No newline at end of file
};
public static final double[] SLIDE_LATITUDES = new double[] {
- FieldConstants.FIELD_WIDTH - Units.inchesToMeters(30.0),
- Units.inchesToMeters(30.0), // should be accurate, i think our field is slightly too small
+ FieldConstants.FIELD_WIDTH - Units.inchesToMeters(27.0),
+ Units.inchesToMeters(27.0), // should be accurate, i think our field is slightly too small
// 6.550,
// 0.668,