Hi, I’m trying to use the real time logs from roborio (we use advantagekit for logging) to perform actions on an Arduino that is connected to the driver station. I want to extract 1 of the fields that is logged (Robot/State) and send it to the Arduino using the serial port. How to go about achieving this?
Check out network tables, the protocol that underlies the logging you are seening in advantage scope
Unfortunately, network tables is backed by tcp/ip, and doesn’t know anything about serial ports.
There isn’t anything off the shelf that I know of which turns values in network tables into serial port messages. You will probably have to write your own.
Python has both network tables, and a serial port library. It might be a good choice to start with.
We did something like this previously, to drive a custom operator panel that we briefly experimented with. The critical “glue” to make it work was exactly what @gerthworm suggests - a Python script running on the driver station, speaking NetworkTables to the robot and driving a serial-over-USB connection to an Arduino Leonardo (that also emulated a couple of joysticks and a keyboard). Most of the low-level specifics won’t apply - we invented our own serial protocol to convey all the state to the Arduino and used custom NetworkTables fields for the robot code to set states - but it might provide a useful example of how this sort of thing can work.
The Python script and the code for the Arduino are all in this repository. I will caution that this was written in 2020 and has not been actively used or maintained since.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.