How to create a Combo Box Chooser for a SendableChooser in Shuffleboard?

We’ve coded a edu.wpi.first.wpilibj.smartdashboard.SendableChooser and it seems to be working:

public RobotContainer() {

chooser = new SendableChooser<String>();
chooser.setDefaultOption("im going to go strait", "strait");
chooser.addOption("how about right", "right"); //etc
chooser.addOption("lets go with left", "left");
chooser.addOption("were going to go nowhere", "none");

SmartDashboard.putData("Auto Selector", chooser);

What we can’t seem to do is get Shuffleboard 2023 to show our combo box. How do people add it so you can choose something?

I recorded a video here on what I’m trying to do: Loom | Free Screen & Video Recording Software | Loom

Ryan

I could not get your video link to work, but you can use the ShuffleboardTab.add() method using the kComboBoxChooser widget. Something like this:

Shuffleboard.getTab("Autonomous")
    .add("Autonomous Mode", chooser)
    .withWidget(BuiltInWidgets.kComboBoxChooser)
    .withPosition(0, 0)
    .withSize(2, 1);

I’m sorry about the video.

@tomjwinter Is there no way to add the widget without writing code? Can it be done with just the UI?

If you expand the network tables tree on the left, do you see your chooser object? If so, you can drag/drop it onto your shuffleboard tab and it should render properly. That said, I believe it should do that automatically by default as well (on the smartdashboard tab at least), so you’ll want to ensure shuffleboard is actually connected to network tables if not (or if the network tables tree is blank)

With the code you wrote, it should show up automatically on the SmartDashboard tab in Shuffleboard.

This is what I get in shuffleboard when running your code in simulation.

2 Likes

Thank you so much for trying to help. I really appreciate it.

I can’t get my dashboard to show anything like that. I tried recording another video: Loom | Free Screen & Video Recording Software | Loom

Here’s what it looks like on my dashboard:

I’ve searched our code base for “Select Autonomous” and that text doesn’t seem to show up anywhere. So weird.

Halp!

Ryan

P.S. I’m using Shuffleboard 2023.4.2, if that matters.

The video worked this time.

Do you also have the LabVIEW dashboard open? I suspect it’s interfering since it’s using the same name. Choose a different name here:

This worked! Thank you @tomjwinter !

@Joe_Ross We closed the LabView dashboard and it didn’t help. I’m convinced this can’t be done manually. It has to be done programmatically.

Ryan

In the video, the data was present. See Smartdashboard - displaying expressions - Stale Data

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