Shuffleboard IllegalArgumentException

Hello CD,

I’ve been trying to help my students understand Shuffleboard better with the hope that we’ll be able to give our drive team better, more dynamic information without them needed to hurry and rush to drag values from the selection view out to Shuffleboard.

I know that I can programmatically populate tabs and things, so thought that would be a good start.

I put the following example code together for them to use Shuffleboard to help troubleshoot the commands they are writing for their particular subsystem:

It seems to work fine, the first time.

The second time I run robot code, it crashes with “IllegalArgumentException” because there is already an element with that title. Which makes, because there already is an element on there with that name.

So, is the proper thing to do just wrap those addNumber() calls with a try/catch and not worry about it, or is there a way to programmatically clear a layout before we rebuild it?

Not sure what is the right thing to do here.

@Oblarg, I’m working on groking oblog myself, but I need more time (not in the build season) to get tutorials built up for them (most of my students are freshman this year) before we’re ready to move to that in a way that they will be understanding what’s happening. Offseason goal for us this year.

See this thread: Errors with shuffleboard

Thanks for the response Peter.

I will make that change and see, however, will I not have the same error if I startup a robot with an instance of Shuffleboard running that previously had those values?

The test code I have on there only runs the addNumber() function once, in the constructor of the command. So, is there a difference in calling it in robotinit() vs. being called once in the constructor of a class?

I don’t have access to a robot right now, perhaps it’s time I try to get the simulator setup to see if this is something I can even test off-robot.

I believe the check is local to the robot code, and is not dependent on what values are in NetworkTables. Also, the NetworkTables values are lost when the robot code restarts unless they were written to by something other than robot code.

Yes, this will be very testable in simulation. You will need to configure Shuffleboard’s NetworkTables preferences to connect to 127.0.0.1.

This usually works out-of-the-box, for me.

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