We are trying to connect a raspberry pi 3 with the roboRio. The raspberry pi processes the visual data and detects apriltags, then sends them through a socket to the roboRio where it will handle it accordingly.
The Raspberry Pi creates the socket server and the rio will connect to it.
Currently, we are having problems with connection. We keep on getting a ConnectionRefused error.
Here is how the socket is implemented rPi side:
server = socket.socket()
port = 5801
host = 'wpilibpi.local'
server.bind((host, port))
print("Awaiting socket connection...")
server.listen(2)
conn, address = server.accept()
And here is how we attempt to connect rio side:
Socket socket = new Socket("wpilibpi.local", 5801);
The robot for some reason cannot connect. We have an ethernet cable linking directly between the rio and the pi. When I connect using a laptop connected to the pi’s network, it does work.
I can’t answer why it’s not working, but I highly recommend looking into NetworkTables instead. It handles all of the low-level network connections for you.
Is there some example code / good documentation for both the Raspberry Pi and the rio (Java)? We tried looking at the documentation and it was very fragmented and all-over-the-place, so it was hard for us to use it.