CommandScheduler.getInstance().run();
robotContainer.logComponents();
+ robotContainer.periodic();
}
/**
// display the current robot id on smartdashboard
SmartDashboard.putString("RobotID", robotId.toString());
+ SmartDashboard.putNumber("Match Time", 0.0);
+
// Filling the SendableChooser on SmartDashboard
// autoChooserInit();
// Subsystem Pose3ds
});
}
+
+ /** Updates SmartDashboard values that need to be refreshed every loop */
+ public void periodic() {
+ // update match timer
+ double matchTime = DriverStation.getMatchTime();
+ if (matchTime > 0) {
+ SmartDashboard.putNumber("Match Time", matchTime);
+ }
+ SmartDashboard.putString("Alliance", DriverStation.getAlliance().toString());
+ }
}
trenchAssistPid.setIntegratorRange(-1, 1);
SmartDashboard.putNumber("0 degrees snap location", 0);
- SmartDashboard.putNumber("", 0);
}
@Override
Logger.recordOutput("Intake/Setpoint", setpointInches);
robotExtension.setLength(inchExtension);
+ SmartDashboard.putNumber("Intake Extension (in)", inchExtension);
+ SmartDashboard.putBoolean("Intake Extended", inchExtension > 1.0);
+
if(calibrating){
leftMotor.set(-0.1);
rightMotor.set(-0.1);
import edu.wpi.first.units.measure.Voltage;
import edu.wpi.first.wpilibj.RobotBase;
import edu.wpi.first.wpilibj.Timer;
+import edu.wpi.first.wpilibj.smartdashboard.Field2d;
+import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc.robot.constants.Constants;
import frc.robot.constants.FieldConstants;
private Rotation2d rawGyroRotation = new Rotation2d();
+ private final Field2d field = new Field2d();
+
/**
* Creates a new Swerve Style Drivetrain.
*/
});
// PPLibTelemetry.enableCompetitionMode();
+
+ SmartDashboard.putData("Field", field);
}
public void close() {
}
Logger.recordOutput("Odometry/module poses", modulePoses.getModulePoses());
updateOdometryVision();
+
+ field.setRobotPose(getPose());
}
// DRIVE
Logger.recordOutput("Shooter/realVelocity", shooterMotorLeft.getVelocity().getValueAsDouble() * ShooterConstants.SHOOTER_LAUNCH_DIAMETER);
Logger.recordOutput("Shooter/targetVelocity", shooterTargetSpeed);
- SmartDashboard.putString("WON AUTO?", (HubActive.wonAuto()) ? "WOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOON" : "lost");
+ // SmartDashboard.putString("WON AUTO?", (HubActive.wonAuto()) ? "WOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOON" : "lost");
+ double actualWheelVelocity = shooterMotorLeft.getVelocity().getValueAsDouble() * ShooterConstants.SHOOTER_LAUNCH_DIAMETER;
+ SmartDashboard.putNumber("Shooter Speed Error (mps)", shooterTargetSpeed - actualWheelVelocity);
+
+ boolean autoWon = HubActive.wonAuto();
+ SmartDashboard.putBoolean("Auto Won", autoWon);
+ SmartDashboard.putString("Auto Result", autoWon ? "WON" : "LOST");
}
/**
import edu.wpi.first.wpilibj.smartdashboard.Mechanism2d;
import edu.wpi.first.wpilibj.smartdashboard.MechanismLigament2d;
import edu.wpi.first.wpilibj.smartdashboard.MechanismRoot2d;
+import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.InstantCommand;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
SmartDashboard.putData("Start turret calibration", new InstantCommand(()-> calibrate()));
SmartDashboard.putData("Stop turret calibration", new InstantCommand(()-> stopCalibrating()));
+ SendableChooser<InstantCommand> turretTestChooser = new SendableChooser<>();
+ turretTestChooser.setDefaultOption("Turn to 0", new InstantCommand(()-> setFieldRelativeTarget(Rotation2d.fromDegrees(0), 0.0)));
+ turretTestChooser.addOption("Turn to -90", new InstantCommand(()-> setFieldRelativeTarget(Rotation2d.fromDegrees(-90), 0.0)));
+ turretTestChooser.addOption("Turn to 90", new InstantCommand(()-> setFieldRelativeTarget(Rotation2d.fromDegrees(90), 0.0)));
+ turretTestChooser.addOption("Turn to 200", new InstantCommand(()-> setFieldRelativeTarget(Rotation2d.fromDegrees(200), 0.0)));
+ turretTestChooser.addOption("Turn to -200", new InstantCommand(()-> setFieldRelativeTarget(Rotation2d.fromDegrees(-200), 0.0)));
+ SmartDashboard.putData("Turret Test Positions", turretTestChooser);
+
double leftPosition = encoderLeft.getAbsolutePosition().getValueAsDouble();
double leftAbs = wrapUnit(leftPosition - TurretConstants.LEFT_ENCODER_OFFSET);
//motor.setPosition(Units.degreesToRotations(238.86) * TurretConstants.GEAR_RATIO);
motor.setPosition(0.0);
-
- SmartDashboard.putData("Turn to 0", new InstantCommand(()->{setFieldRelativeTarget(Rotation2d.fromDegrees(0), 0.0);}));
- SmartDashboard.putData("Turn to -90", new InstantCommand(()->{setFieldRelativeTarget(Rotation2d.fromDegrees(-90), 0.0);}));
- SmartDashboard.putData("Turn to 90", new InstantCommand(()->{setFieldRelativeTarget(Rotation2d.fromDegrees(90), 0.0);}));
- SmartDashboard.putData("Turn to 200", new InstantCommand(()->{setFieldRelativeTarget(Rotation2d.fromDegrees(200), 0.0);}));
- SmartDashboard.putData("Turn to -200", new InstantCommand(()->{setFieldRelativeTarget(Rotation2d.fromDegrees(-200), 0.0);}));
}
/* ---------------- Public API ---------------- */