Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Driver Dashboard configuration #144

Merged
merged 5 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/main/java/org/jmhsrobotics/frc2024/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ public class RobotContainer implements Logged {
// DefaultIntakeCommand(intakeSubsystem,
// shooterSubsystem);

private final DriveCommand driveCommand;

public RobotContainer() {
SwitchableControlBoard swboard = new SwitchableControlBoard(new CompControl());
if (Robot.isSimulation()) { // Switch to single control in sim
Expand All @@ -97,6 +99,7 @@ public RobotContainer() {
// swboard.setControlBoard(new CompControl());

this.control = swboard;
this.driveCommand = new DriveCommand(this.driveSubsystem, visionSubsystem, this.control);
this.driveSubsystem
.setDefaultCommand(new DriveCommand(this.driveSubsystem, this.visionSubsystem, this.control));

Expand All @@ -106,6 +109,9 @@ public RobotContainer() {

configureSmartDashboard();
SmartDashboard.putBoolean("HasNote", false);
SmartDashboard.putBoolean("LockAtGoal", this.driveCommand.lockAtGoal());
SmartDashboard.putNumber("MatchTime", DriverStation.getMatchTime());
SmartDashboard.putNumber("MatchNumber", DriverStation.getMatchNumber());
SmartDashboard.putData("lock speaker", new LockSpeaker(this.driveSubsystem, this.visionSubsystem));
configureDriverFeedback();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ public void periodic() {
new Pose3d(-0.213, 0, 0.286, new Rotation3d(0, -Units.degreesToRadians(armPID.getGoal().position), 0)));
log("angleDegrees", getArmPitch());
log("angleGoalDegrees", armPID.getGoal().position);
log("ArmAtGoal", this.atGoal());
}

SingleJointedArmSim armSim;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.BuiltInAccelerometer.Range;
import edu.wpi.first.wpilibj.DriverStation.Alliance;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import monologue.Logged;
import monologue.Annotations.Log;
Expand Down Expand Up @@ -92,6 +93,7 @@ public void periodic() {
log("Y-Gs-rio", rio_Accelerometer.getY());
log("X-Gs-rio", rio_Accelerometer.getX());
log("Z-Gs-rio", rio_Accelerometer.getZ());
SmartDashboard.putNumber("GyroAngle", m_gyro.getAngle());

if (Robot.isSimulation()) {
Robot.objSim.update(pose2d);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import edu.wpi.first.math.geometry.Transform2d;
import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.DriverStation.Alliance;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.Command;

public class DriveCommand extends Command {
Expand Down Expand Up @@ -78,7 +77,8 @@ public void execute() {
// SmartDashboard.putNumber("SwerveDrive/Input/SwerveDriveXSpeed", ySpeed);
// SmartDashboard.putNumber("SwerveDrive/Input/SwerveDriveXSpeed",
// rotationSpeed);
SmartDashboard.putNumber("Angle Offset", computeAngleLockValue());
// SmartDashboard.putNumber("Angle Offset", computeAngleLockValue());

if (this.control.AprilLockOn().getAsBoolean()) {
rotationSpeed += computeAngleLockValue();
}
Expand Down Expand Up @@ -140,5 +140,8 @@ public boolean isFinished() {
private double getSquareInput(double input) {
return Math.pow(input, 2) * Math.signum(input);
}
public boolean lockAtGoal() {
return this.lockPID.atSetpoint();
}

}
Loading