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?
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.
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).