Sendable Chooser - can't make sense of the WPILIB Example

Does anyone have example code of this working in command based: Choosing an Autonomous Program — FIRST Robotics Competition documentation

Maybe I’m just tired, but can’t seem to get it to even plug into VSCode without errors.

I’m sure many people here would be glad to help you work through the issues you’re having, but it would help immensely if you actually told us what they were.

Could you share your code (preferably as a link to github or similar)?

Plugging into VS code errors is not enough information to help you. Post your code in github or somewhere so we can see, or provide more context to get specific help.

We’ve been using choosers for several years now successfully with Command-Based, so you can check out our versions over the years if you’d like. Here’s a link to our last year’s code that builds the chooser. We’re using Shuffleboard APIs, if you’re not familiar with that, you can just use SmartDashboard.put(m_chooser) and it will work just fine as well.

Here’s a link to a super simple example of what we had last year just using the WPILIB class.

1 Like

I ran into the same problem and I just decided to switch completely to m _chooser
Here is my Github code linked to the main part of that part you’re looking for, its for my auto mode and it starts on line 37
Code: SeaBots2023/Robot.java at main · sir-salamander/SeaBots2023 · GitHub

Before the matches, approximately how long will the sendablechooser take before it sends the autonomous mode to the robot? I noticed that it doesn’t let me change the autonomous mode when the driver station isn’t connected to the robot so it seems like there’s not a lot of time for the smartdashboard/shuffleboard to send the auto to the robot. Will this be an issue?

It’s pretty much instantaneous. On the dashboard you’ll see a check or similar indicator when the robot has echoed back the value; this means the robot code is seeing the same value as the dashboard setting. The robot is connected on the field long before the match starts (eg drivers have to get behind the lines, etc).

Is it good practice to restart the driver station and shuffleboard applications before each match?

Many teams do, yes.

1 Like

Thanks! Exactly what I was looking for!

1 Like

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