Skip to content

Commit

Permalink
Driver Dashboard configuration (#144)
Browse files Browse the repository at this point in the history
* post camera to smartdashboard

* add driver dashboard data

* remove CameraServe in RobotContainer

---------

Co-authored-by: Connor Murphy <[email protected]>
  • Loading branch information
Lu-han-wang and Connor Murphy authored Apr 3, 2024
1 parent e3ea033 commit 8ff9fd4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
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();
}

}

0 comments on commit 8ff9fd4

Please sign in to comment.