Networktables robot_enabled value(s) on field

Hello!
I have written a python script that runs on a Pi3 to control RGB LED lights on our robot.
The script to connects to NetworkTables so that it knows when the robot is enabled and disabled to be able to display robot status on the field. After the robot is enabled the full capability of the LEDs are enabled (Team Color, shooting status, etc).
I researched the robot enabled codes using the robot simulator executed from WPILib. Testing off the field when the control laptop is directly connected to the radio over wifi or tethered, everything works fine.
What I discovered in our “off-season” comps is that the competition field must be sending a different numeric codes to signal robot enabled and disabled then what the simulator does.

Can anyone tell me what the numeric codes in Networktables for robot_enabled and robot_disabled are when on a comp field?
Or, do you have an alternative way to detect robot state?

Thank You
Robert
Coding Mentor - #4935

To help, here are the numeric codes I have listed now:
robot_disabled = [32.0, 34.0] # Values in FMSInfo table that indicate robot disabled

robot_enabled = [33.0, 35.0] # Values in FMSInfo that indicate robot enabled Autonomous=35.0; Teleop=33.0

robot_connected = [32.0, 34.0, 33.0, 35.0] # Indicating that pi sees robot / network tables

This probably isn’t what you want to hear but it would be not too difficult to run a signal directly from the roborio to signify the robot is enabled or disabled.

In what way? I am already reading from the RIO’s default Networktables entries over local ethernet connection. The Pi is connected to the RIO via an ethernet switch on the robot.

Through the GPIO on the pi

I can certainly explore that as an option.
I would need to find what connection on the RIO is enabled when the robot is enabled. Maybe a DIO pin.

FMSInfo is a combination of individual bit fields. One of the bits represents the enabled state, another represents autonomous, and yet another represents whether the FMS is connected. What you want to do is test the specific bit for enabled, rather than the entire value. The enabled bit is the least significant bit, so you can test it with if ((value & 1) != 0).

The full definition of the control word can be found here: https://github.com/wpilibsuite/allwpilib/blob/main/hal/src/main/native/include/hal/DriverStationTypes.h#L32

3 Likes

This looks like what I was looking for. I’m going to read and try that out.
Thank You

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