How to Consistently Reconnect Networktable using Python?

I have been using a rpi to do vision processing. The network table connection has been having consistency issues.

After testing, I found out that the first connection after booting the rpi is rather consistent. However, if I terminate the program, the proceeding connections to the roborio networktable server seem to always fail.

I am wondering if this is because the original network table in the first thread was still running and misleading the roborio to think that the rpi is connected.

Currently, I have “NetworkTables.stopClient()” and “NetworkTables.shutdown()” in my exit routine to try to combat this but it doesn’t seem to help.

Can anyone explain what is the most consistent way to connect and reconnect to networktable with python?

Though I do not necessarily have an answer, I have a few questions that may help.
Are you using a static IP for the Pi?
Are you using a switch or just the second port of the radio?
Are you programming the robot in Python as well as the Pi? I am not sure that matters as this is probably more of a universal network tables Pi issue, but I am curious.

1 Like

Hi, thanks for helping me here.

The rpi is set to use only DHCP. I should probably change it to DHCP with static fallback.
The rpi is just connected to the second port on the radio.
The robot is in java.

Okay. So, I think there is sometimes (often?) Some difficulty that happens with the Pi where it cannot get a good ip and network tables will not work.

I would recommend setting a static IP. Also, the radios are notorious for being partially proficient when both ports are used. I would recommend a switch. I cannot search roght now as I am on my phone, but you could search CD for zebra network switch or something similar, and you can find the excellent whitepaper the Zebracorns did on the subject. Amazon had the switch in stock a few weeks ago. Pololu has the power converter too.

1 Like

Thanks for the advice. I will get my team to buy a switch.

1 Like

I agree that a switch is a good idea, it allows you to leave a port open for tethering.
It is allowed by the rules, but there is a note in R703. The note leads me to believe the recommended radio network connections are to directly connect the roboRIO to the port nearest the barrel connector, and connect the switch to the second port.

R703 *Use specific Ethernet port for roboRIO. The roboRIO Ethernet port must be connected to the wireless bridge port labeled d “18-24 vPOE” (either directly, via a network switch, via an RPM, or via a CAT5 Ethernet pigtail).
Note: Placing a switch between the roboRIO and radio may impede the ability for
FIELD STAFF to troubleshoot roboRIO connection issues on the FIELD. Teams
may be asked to connect directly between the radio and the roboRIO as part of
troubleshooting efforts.

Thanks. We ended up getting a Brainboxes Switch SW-005 and it solved the issues.

1 Like

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