Detecting If We're Competing

Does anyone know of a way to detect if we’re at competition? I’m trying to implement a battery-saving mechanism on the driver station that will beep at you (kind of like an alarm clock) after 3 seconds of being below 11 volts, and will disable the robot after 13 seconds; however, I need to make sure the robot doesn’t get shut down in the middle of a match. While a simple solution might be to have a control on the dash board, I’d rather have something that can’t be so easily flipped.

Java and C++ have a method in the DriverStation class called isFMSAttached.

You may want to experiment with your thresholds once you have the robot built.

One small addendum - I would be very, very careful with any code that disables your robot. A bug, misconfiguration, or regression in that could could have the undesirable side effect of disabling your robot at competition.

I wasn’t sure what language. It doesn’t look like LV exposes that in a palette VI, but it is easy to get from one of the lower level VIs not in the palette.

But before doing this, does the robot use that much more power when enabled than when disabled? Is it the compressor? Because it may be simpler to have a toggle for energy saving that is more explicit. Binding this to being on a field could happen later, but it will in fact be hard to test before you are at an event.

Greg McKaskle

IIRC, isFMSAttached didn’t work last year.

Just have a checkbox, with it’s value saved. That way, whenever you go to comps, you just need to press the comp checkbutton once and you’re set. It’s not too hard either!

What about the practice field?

TL;DR: Set a flag in your autonomous routine, only triggered when you are playing a real game or during “practice” on driver station.

We are going to be doing something different on the real field then at our pits with one of presets on the robot we are building and I had a similar problem.

I will tell you how I plan to only allow a preset when we are in the pits versus during the actual game and you can see if it applies for you.

Basically, we use IterativeRobot in Java and C++ and we are setting a flag during the autonomous portion. While that flag is tripped, then we are in a real game and as such I do not want to return to our start position of the robot. When it is not tripped, that means we just flipped the driver station to teleop and are playing around in the pit and I will allow the robot to be returned to start position automatically then.

I have asked this question in the past and the answers I received are in the following thread.

Also, I’ve attached a photo of how we are using the information.



We have a similar situation where we want to automatically up the data rate of telemetry data from the robot to the driver’s station when not on a competition field. If the cRIO can keep up, we’re talking roughly 2Mbits on top of video & normal FMS traffic, so we really want to scale it back on the field.

Can anyone confirm that the FMS Attachment bit still works? Does it detect the actual FMS & FMS Lite?

After looking at our code from last year, the FMS method did not work during the match we tried it at.

Make it so that no matter what the battery level is, the power can not be cut until at least 2 and a half minutes have passed (I would do three just to be safe), then once 2.5 minutes have passed, the program can cut off power after 11 volts

The solutions proposed so far are elegant and seem effective. However I suggest 1 more possible option. You could have a simple switch wired to a digital input. The default position (as well as the switch unplugged position) would be competition settings and the other option could be for testing.

I believe that the bit in the protocol is set, but I can’t really verify that the bit makes it to the control byte unmodified. Anytime the FMS Present message and blue strip shows on the DS, that will trigger the FMS bit. So this should work with FMS lite.

Greg McKaskle