Shuffleboard ToggleButton inquiry

Hello chief Delphi! I’m John from team 2383 and one of the student directors of electrical/programming. My team of programmers and I had an idea where we can use Shuffleboard’s widgets to create a button board to control scoring for this season’s game. While scrolling through Shuffleboard’s Github, I found a widget called ToggleButtonWidget that I am interested in using, but I’m not sure on how specifically it functions.

Now, my question: Will the ToggleButtonWidget unschedule/terminate a command once the command that is attached to it is finished and revert back to the default command without untoggling the ToggleButtonWidget? Or will the attached command continuously reschedule itself until the ToggleButtonWidget is untoggled?

Does anyone know? Thanks!

You can just put you commands straight onto the dashboard without doing anything.
We do this all the time when testing commands so you don’t have to bind them to buttons.

You click the button, the commands runs, the button changes while the command is running. When the command stops or it is interrupt it becomes clickable again.

image

I can’t remember if you have the option to cancel the running command or not. I can check tomorrow when connected to robot. The button image changes, I just can’t remember if it changes to the word cancel or running.

#ifdef COMMANDS_ON_DASHBOARD
  frc::SmartDashboard::PutData("Goto Intake Position", &m_armGoToIntake);
  frc::SmartDashboard::PutData("Goto Stowed Position", &m_armGoToStowed);
  frc::SmartDashboard::PutData("Goto Retracted Position", &m_armGoToRetracted);
  frc::SmartDashboard::PutData("Goto Level1 Position", &m_armGoToDeliveryL1CMD);
  frc::SmartDashboard::PutData("Goto Level2 Position", &m_armGoToDeliveryL2CMD);
  frc::SmartDashboard::PutData("Goto Level3 Position", &m_armGoToDeliveryL3CMD);
#endif

The #define allow us to switch blocks of code in and out very easily. We have a special file in our code base that is not tracked by github. So its different on every programmers laptop. This file is included in our code and it is solely used to hold #defines for various debugging feature that different programmer are working on. It means that if the Arm team are testing code they can turn off everyone else’s debug messages so they can only see their own debug messages.

2 Likes

There is already a sendable implementation for commands that turn the Command into a button that is clickable.

It maintains the state for you. One click schedules the command to run. A second click will cancel it. Otherwise, the command will run to completion. They have different visual states so you can see whether or not a command is running.

If you weren’t aware that was a thing, it’s a thing and it probably solves your problem. If you were aware of that, and it doesn’t solve your problem, I don’t think I understand your problem very well.

1 Like

Thank you for the responses! This will certainly assuage my doubts of implementing a sequential command to a shuffleboard button widget.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.