MIDI Controller as Driver Station: Network Table Code

Our team is trying to write an application for reading a MIDI device input as a joystick. We were wondering if anyone has written code for doing this. We were thinking of sending values of Networktables, and were wondering if there is a way to do this locally on the driver station laptop using a python script that reads the midi input and sends values over Networktables, or if there is another better approach.

1 Like

There was a recent discussion about this.

I’ve not written an actual application, but either Java or Python should work well for this (Java has good MIDI APIs too). It won’t appear as a Joystick in robot code, but you can send the values via NT easily enough. Just make sure to flush NT after setting the values to keep latency low. The whole thing should be less than 100 lines of code.

you can see the team 100 midi/joystick bridge code here:

it uses an adafruit controller and midi shield, maybe $20 in parts?

if you need more than 32 buttons, this provides two joysticks worth of buttons from one midi controller:

we haven’t wired up the midi cc axes (e.g. knobs) because we don’t have a control that uses them.

2 Likes

I think this is what the students are my team are trying to do to. We just got our MIDI device today and was able to use this Python library (python-rtmidi · PyPI) to get the values from the MIDI device and show them on our laptop.

Now to figure out the Networktables part…

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