Raspberry Pi Stops PyNetworkTables

Hello everyone,

My team is attempting to create a vision processing system with a raspberry pi connected to the RIO through ethernet and with pynetworktables. Today, while we were testing, the pi just stopped sending networktables values. We couldn’t change anything on the table. The server appears to be working fine on the RIO where we could change variables with the outline viewer from our computer, but nothing is working from the Pi. Everything is imaged, the pi is picking up a RIO on the network (verified with ping), we have the pi connected to the RIO by using the initialize command (with the mDNS name of the RIO), but nothing is working. When we ran the .isConnected() method on the pi, all it returned was false. We know we’ve set all the variables up correctly, but the pi just doesn’t want to connect to the RIO. How do we fix this?

Code on Github: https://github.com/FernbankLINKSRobotics/LINKSVision/blob/master/main.py

Thanks,

Jonathan Daniel
Head Programmer
Fernbank LINKS Robotics

I’m assuming that if you restarted the vision program then it would work again? Or did you try that and it didn’t work?

Also, was there any console output? And are you positive that your code loop was still executing (maybe inserting a periodic print statement?).

Oh, also, you ignored the first rule when setting up pynetworktables – NEVER use mDNS names, always use static IPs. Try changing that and see if it fixes your issue.

http://robotpy.readthedocs.io/en/stable/guide/nt.html#robot-configuration

We did attempt the static IP and it still wouldn’t connect. It also wouldn’t work after rebooting the Pi and the RIO.

The loop was executing, and it was running the lines responsible for inputting variables. We even tested it in the python shell cmd line and it still wouldn’t input values.

Did you change the code to reflect the static IP after switching (eg, NetworkTables.initialize(server=‘10.xx.xx.2’) )

Yes. What’s funny is that we were able to use the mDNS before this happened, and all of a sudden it just stopped. We didn’t change any code, and it still won’t pick up the tables. We’re pretty sure it’s in the right port on the radio.

Yes, but mDNS has a tendency to not work correctly on the field, which is why I don’t recommend using anything other than static IPs at this time. :slight_smile:

Did you look at the console output of the RoboRIO via the driver station or netconsole? Maybe there were some errors there.

We didn’t look at the RIO output, we mainly looked at the outline viewer. I’ll make sure to check that next time. Is there anything else you can think of that would cause the pi to stop?

So, at our last meeting the pi was able to connect for about a second, but then it stopped working again. We were using the static IP and made sure it was etherneted into the right radio port. We are running the latest version of Raspbian on a Pi 3. Is there any other way to force it to connect?

  • Are there errors? Have you enabled logging? (see the documentation)
  • Is the code still running or did it exit?

We haven’t tried logging from the pi yet. We know that our RIO is able to use the network tables along with our laptops (of which we tested connected to the radio’s ethernet port), but the pi has refused to run. The robot code is still running, along with the pi code, but when we have it print out the result of table.isConnected(), it always returns false.

One of our mentors thought that maybe our version of Raspbian might be messing with it. Would that be a possible cause?

I don’t understand why that would change anything. Python is python.

Try running this example on the PI and let me know what results you have: pynetworktables/samples/global_listener.py at main · robotpy/pynetworktables · GitHub

Will do at tomorrow’s meeting. If it doesn’t work, what would you recommend doing?

If you enable logging (which the example does), then pynetworktables will output various messages that should be useful for figuring out what’s going wrong.

If there’s no error message, then it means that you either have the IP address wrong (don’t use mDNS), or the PI cannot actually talk to the roborio (verify this by ssh from the pi to the rio). I suppose you could have a firewall on the PI restricting outgoing connections, but that seems very unlikely.

So, we tried that and it still isn’t telling us anything. We don’t have a firewall on the pi, and it doesn’t give us an error. We are using the static IP of 10.44.68.01, and it is connecting sporadically. We’ve been able to get it to work whenever we flip the ethernet ports sometimes, but that hasn’t been working well.

Isn’t 10.44.68.01 the router?

No, that’s the RIO’s address according to the RIO web dashboard.

That’s a bit strange. You should probably set it to .2, as that’s the recommended setup for the field.