-
Notifications
You must be signed in to change notification settings - Fork 28
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
Delay DSClient start to fix 'Disappearing Chooser problem #186
Conversation
Can the DS client be enabled after the save file has been loaded? There is a real reason to have that enabled, as it makes connecting more robust in a field environment. Alternatively, could everything in the static block be moved to a function and called after the save file is loaded? |
@PeterJohnson I think my latest update and your comment crossed in the mail -- it should now work as you suggest. |
@PeterJohnson Well maybe I'm getting close to the root cause of this problem (instead of pasting it over with tweaks to startup order). The SD code calls (I put this PR back in Draft status, hoping it can be supplanted by one fixing the root cause.) |
Multiple tables is not the cause of the problem (or at least not the only cause). After fixing that the behavior is the same. Still looking. |
After figuring out how to use the DSClient so it didn't cause problems, the changes here were put back into PR #185 so this PR is no longer needed. |
This change is motivated by observing that when SmartDashboard learns the robot address from the DriverStation prior to processing the save.xml file, sendable choosers listed in the save.xml file do not appear. It seems likely that the same issue underlies the misbehaving buttons identified in #81.
Disabling the NetworkTables DriverStation client "fixes" the problem of StringChoosers not appearing on SmartDashboard in the following specific circumstances: the String Chooser is listed in the SmartDashboard save.xml file; and the DriverStation program is running (on the same computer) and connected to the robot when the SmartDashboard program is started. The problem occurs because in this situation SmartDashboard processes the incoming NetworkTable entries before processing the save.xml file. Why this leads to the chooser not appearing is still unknown to me -- fixing that would maybe be a better approach but I have not been able to figure out why this specifically affects Choosers (and probably buttons as in #81).
In this PR, the DSClient is stopped initially and then restarted after the save.xml file is processed. A half-second sleep is inserted after starting the DSClient before setting the team number/ip from the preferences file -- this gives the DSClient time to learn the robot address before attempting to connect using the info from the preferences. Nothing bad happens if it attempts to connect using that info -- it may work or it may suffer a connection timeout if the preferences info is wrong in which case the info from the DSClient gives success on the next connection attempt.
This all feels like standing on a floor made of jello -- remember that SmartDashboard is pinned to WPILib as of 2021 in addition to having no maintainers who actually know details of how it is designed to work. Still, I think this is an improvement in the team experience versus having widgets not show up. (See #173 for my effort at moving SmartDashboard to WPILib 2023.4.3 and NT4.)