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 alerts #51

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft

Driver dashboard alerts #51

wants to merge 5 commits into from

Conversation

mimizh2418
Copy link
Member

@mimizh2418 mimizh2418 commented May 21, 2024

Adds an alert display to the driver dashboard, allows drivers to see issues that the robot has detected (motor/camera disconnected, CAN bus disconnected, low battery, etc.). Only works on Elastic or Shuffleboard. Functionality of CAN error detection still needs to be to be tested on actual robot.

Alerts look like this:
image

(make your best guess as to where most of this code came from, it certainly was not me)

@mimizh2418 mimizh2418 requested review from rutmanz and WeilSimon May 21, 2024 16:20
src/main/java/org/team1540/robot2024/AlertManager.java Outdated Show resolved Hide resolved
@@ -122,6 +124,7 @@ public void robotPeriodic() {
// the Command-based framework to work.
CommandScheduler.getInstance().run();
if (Constants.currentMode == Constants.Mode.REAL) robotContainer.odometrySignalRefresher.periodic();
AlertManager.getInstance().update();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this take any considerable amount of time with the NT stuff? (wpilib apparently has profiling tools somewhere)

Copy link
Member Author

@mimizh2418 mimizh2418 May 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The alerts don't publish very much stuff to NT, so this shouldn't take a significant amount of time. We could profile it if we see loop overruns because of SmartDashboard.updateValues(). I can take a look at this when a test on the robot.

Comment on lines +95 to +105
inputs.driveMotorConnected = BaseStatusSignal.refreshAll(
driveVelocity,
driveAppliedVolts,
driveCurrent,
driveTempCelsius,
turnAbsolutePosition,
driveTempCelsius).isOK();
inputs.turnMotorConnected = BaseStatusSignal.refreshAll(
turnVelocity,
turnAppliedVolts,
turnCurrent,
turnTempCelsius);
turnTempCelsius).isOK();
inputs.turnEncoderConnected = BaseStatusSignal.refreshAll(turnAbsolutePosition).isOK();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This provides a performance improvement over separately calling refresh() on each signal.

Javadoc says that ^, do we know if it's enough to matter on the 250hz bus?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refresh is a non-blocking call, so the performance improvement is probably minimal. These signals are being update at 50hz, only drive and turn position are on 250hz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants