Skip to content
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

Graphs get duplicate entries on code deploy #720

Closed
randomstring opened this issue Jan 13, 2022 · 4 comments · Fixed by #774
Closed

Graphs get duplicate entries on code deploy #720

randomstring opened this issue Jan 13, 2022 · 4 comments · Fixed by #774

Comments

@randomstring
Copy link

Describe the bug
When graphing network table values after redeploying code, the graph will have two copies of the same NT value with the same name. I first discovered this when graphing two values on one graph, but the bug is present even when values are in separate graphs.

In my code I publish two doubles with this code.

https://github.com/FRC-Sonic-Squirrels/swerve-template/blob/0c9cf83f6509f439c864c6501059f33c5e1afcee/src/main/java/frc/robot/commands/DriveWithSetRotationCommand.java#L119-L120

To Reproduce
Steps to reproduce the behavior:

  1. publish value to shufflboard (see link to example code above)
  2. create entry on Shuffboard page and choose "disaplay as graph"
  3. observe graph works
  4. redeploy code from VS Code
  5. now there are two numbers graphed with identical NT names
  6. redeploy code
  7. now the graph has 3 identical NT entries all graphed
  8. repeat

Expected behavior
graph should only have one copy of the Network Table value in the graph

Screenshots
See screen shot
IMG_2281

Desktop (please complete the following information):

  • OS: Windows
  • Roborio 1.0, Image FRC_roborio_2022_v3.0
  • DS 22.0
  • Lib Java 2022.1.1
  • Pidgeon 22.0
  • PDP 1.40
  • CANCoder 22.0.0.0
  • TalonFX 22.0.0.0

Additional context
It feels like Shuffleboard is using more CPU and memory than prior to the 2022.1.1 release, I don't have a stats to back this up. Just the impression that on the same laptop with a far more complex Shuffleboard layout on the 2021 code base, Shuffleboard didn't cause my laptop to start "weezing" (i.e. run the fan nonstop and kill the battery).

@frc4255
Copy link

frc4255 commented Jan 15, 2022

Same here

@PeterJohnson
Copy link
Member

PeterJohnson commented Jan 17, 2022

Regarding the performance aspect, compared to which previous version--2021, 2020, 2019? What widgets are you using? What does the task manager show for CPU/GPU usage? Since you can install previous versions side-by-side, can you do a direct comparison (e.g. run 2021, then run 2022, and look at task manager for both cases)?

The graph widget was changed starting in 2021 (#657) to try to get better performance, but it's possible it actually has worse performance in some scenarios. I would recommend using Glass instead for intensive plotting.

@peter-popescu
Copy link

I've had the same issue since last year, but I always thought it was a problem with my implementation of SmartDashboard.putNumber. Glad I've found someone else with this issue, not sure how I haven't seen a CD post about it. W.r.t. the performance issues, I've found that ShuffleBoard starts maxing my CPU usage after I've redeployed my code a lot and SB starts struggling to plot 15 lines of the same data simultaneously...

@bovlb
Copy link

bovlb commented Dec 7, 2022

I believe this problem may stem from the implementation of getNumberSeries. We're using the source object as the key in the map, and apparently that is changing identity when the code is redeployed. We should never be adding a new series when receiving an update for an existing series.

Suggested mitigations:

  • Make numberSeriesMap map from the series name (networktable key) instead of from the source object. Similarly for getArraySeries and arraySeriesMap.
  • Add an equals() method (and also hashCode()) to DataSource that uses getName(). This potentially affects other code that uses DataSource.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants