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

Current Dashboard #82

Merged
merged 6 commits into from
Apr 26, 2024
Merged

Current Dashboard #82

merged 6 commits into from
Apr 26, 2024

Conversation

NoahWeishan
Copy link
Contributor

Get current values from the PDH and display them on a dashboard.

@NoahWeishan NoahWeishan self-assigned this Mar 21, 2024
Copy link
Contributor

@pordonj pordonj left a comment

Choose a reason for hiding this comment

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

Please also write code that can stop the arm from moving if it draws over a certain level of current

try (PowerDistribution PDH = new PowerDistribution(1, ModuleType.kRev)) {
tab.addDouble("Right Arm Motor Current",()-> PDH.getCurrent(18));
tab.addDouble("Left Arm Motor Current",()-> PDH.getCurrent(5));
} catch(Exception e){
Copy link
Contributor

Choose a reason for hiding this comment

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

what can throw an exception here?

tab.addDouble("Right Arm Motor Current",() -> PDH.getCurrent(18));
tab.addDouble("Left Arm Motor Current",() -> PDH.getCurrent(5));
//Shooter Motors
tab.addDouble("Shooter Motor 1 Current",() -> PDH.getCurrent(6));
Copy link
Contributor

Choose a reason for hiding this comment

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

Lets make a TEMPORARY (like, we are going toi delete it before merging this) command for the shooter subsystem that takes in a can id and runs the motor for that can id at like 10%. Then we can watch this dashboard and know whiuch PD channel corresponds to each can ID. Then record that in Constants and delete the temp command.

if (currentNeedsInit){
ShuffleboardTab tab = Shuffleboard.getTab("Current Info");
//Arm Motors
tab.addDouble("Right Arm Motor Current",() -> PDH.getCurrent(18));
Copy link
Contributor

Choose a reason for hiding this comment

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

All these PDH channels used in the getCurrent calls should be defined in Constants (maybe make a PDH class in constants to store them)

@pordonj pordonj merged commit 78d3d09 into main Apr 26, 2024
2 checks passed
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