Question regarding v2020.3.2 frc::DriverStation::GetMatchTime() and Simulator


We finally got our code ported over to the new 2020 command API. Yay!

We decided to add some FMS/DS info to our Shuffleboard. One of those was “remaining time”, using frc::DriverStation::GetMatchTime(). According to the documentation:


Return the approximate match time. The FMS does not send an official match time to the robots, but does send an approximate match time. The value will count down the time remaining in the current period (auto or teleop). …

Time remaining in current match period (auto or teleop)

The italics are part of our question. Our question is this: Right now we are using the simulator. Using the Shuffleboard with the simulator, it shows 0 seconds “remaining” after starting the simulator (with it starting in disabled mode). After starting autonomous, tele-operated, or test, the “remaining” time starts at 0 and counts up. Going back to disabled, the time pauses.

From the documentation, we would have expected the output of GetMatchTime() to indicate “0:15.0” at start, countdown to 0:00.0, and then go to 2:15.0 at start of teleop, and count down to 0. But we are seeing basically an elapsed time, not remaining time.

Is this a problem with the simulator, or are the docs incorrect? Is the elapsed time what is intended?

Any help appreciated!

The simulator is incorrect. On the real robot (e.g. during a practice match), it is -1 during disabled mode, and counts down during other modes. In “open” teleop or auto mode (not practice) it is always -1. I can fix this for 2021, but I need to think about the correct behavior–should it just go down to 0 and remain at 0 until it’s reset by going back to disabled mode? Or should we add a practice mode to the simulator?

Thank you for confirming the simulator is incorrect. That’s what I figured, but wanted to be sure.

So just to make sure I understand you correctly:

On the real robot, practice match: -1.0 during disabled, then +0:15.0 to 0:0.0 for auto, and +2:15.0 to 0.0 for teleop.

On the real robot, open mode: -1.0 during disabled, auto, and teleop (no countdown)

I’m assuming that the “real robot” means you are using a driver station with a physical robot, no FMS involved.

I’m also assuming that the practice match and open mode you discussed is also using the driver station with a physical robot, no FMS involved as well. Is this correct?

Does the GetMatchTime() output change when the FMS is involved? Or does it behave like the practice match from the driver station?

In my opinion, I think it would be useful to have a practice mode on the simulator, where the remaining time for each period (auto and teleop) is output via GetMatchTime(), per the docs. In my opinion, a simulator should get as close to the real environment as possible, as long as it is not overly cumbersome.

Note: It might be desirable to have the user set the auto time, as I was looking back thru previous posts, and one year (I think 2014) auto period was 10 seconds instead of 15, and back in 2019, we had 0 seconds for auto, and went straight to teleop during the sandstorm.

Is there a method for getting match elapsed time directly from the driver station? (in other words, what the simulator was doing?)

I appreciate the help, and really appreciate the simulator. It greatly helped porting code over to the new 2020 command API without having access to the physical robot during the COVID-19 pandemic. Hopefully it works just as well on the physical robot!

Thanks again!


I don’t know the answer to this. I’m certain the intent is for it to behave the same in a practice mode as in a real match.

In 2019 there was still an auto period, it just didn’t lock out the joysticks in auto.

I’m not sure what you mean by this. It is possible to connect the real DS to the simulated robot; currently it’s not obvious how to enable this feature, but we’re making it more obvious in 2021.

Thank you for the clarification!

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