No SmartDashboard data with AdvantageKit

I’ve implemented AdvantageKit in my code according to the documentation and examples, and when I run the WPILib Simulator and AdvantageScope I get no SmartDashboard data showing. I’m implementing SmartDashboard outputs my project.

As a test I reverted the code back prior to the implementation of AdvantageKit and the SmartDashboard output is now showing in the Simulator. Is there anything in AdvantageKit that prevents the SmartDashboard data from showing in the Simulator? Also, none of the Logged inputs are showing in AdvantageScope. I used the Simulator as my input source.

I’ve believe that I’ve followed the documentation closely, not sure what I’m missing. Thank you.

I’m using AdvantageKit [v3.0.0-beta-6] with WPILib 2024.1.1-beta-4

Could you send a link to your code (on GitHub or similar)? AdvantageKit should not affect the publishing of SmartDashboard data, so it would be helpful if we can recreate the problem and investigate in more detail.

Here it is. Thank you.

This code doesn’t appear to use AdvantageKit, and I’m seeing the SmartDashboard data published correctly. Is this the code where you were seeing issues? It sounds like you had problems with a different version that used AdvantageKit.

I’m sorry. I didn’t push it. Please try the link again.

With AdvantageKit, there are essentially two ways to run simulation — either log replay (running as fast as possible using a log file) or a physics sim (running in real time). The installation guide shows the simplest way to set up AdvantageKit, which means that simulation is always configured for log replay. With your code, you can see in the console that the code prompts for a path to use for replay. This means the main code isn’t actually running yet, and nothing is published to SmartDashboard. If you provide a log file to use for replay, the code will run as fast as possible and then exit (so it doesn’t make sense to connect over NetworkTables).

It sounds like you want to run with a real-time physics sim. The example projects show one way to configure that, with a constant to switch between REAL, SIM, and REPLAY. You can see the relevant code here.

1 Like

Is there a way to switch modes without changing the code?

All of the setup is handled in the robotInit method, so you can use any logic you like to switch between modes. Changing a constant is probably the simplest way, but 6328 uses a different method that handles multiple robots. If you have a different way that you want to indicate the mode, you are free to use it (environment variable, custom VSCode extension, etc).

1 Like

Excellent explanation! Now I understand it, and I’ve got it working with the code sample. Thank you very much.

1 Like