We’ve imaged 3 different raspberry pi’s with photonvision and struggled each time. I wanted to share our experience with it in case it helps someone else, and perhaps to get some validation. If nothing else, so I’ll remember that I posted here the next time we’re struggling :-/.
That is, if you connect a newly flashed photonvision system directly to a laptop or with a switch, what we have found is that the pi does not establish a link local IP, but has no IP at all. It seems to require a DHCP server in order to boot and obtain an IP.
Further, if you login to the pi, because you’re a Linux geek and you think you know what you’re doing, setting up a static IP does not work as expected. That is, all the top Pi howtos suggest using dhcpcd.conf to set up a static IP. But that does not work, and what’s more, the dhcpcd systemd configuration file appears to run a command from a directory that does not exist.
It appears as though these images are NetworkManager first images. Thus, to assign a static IP, I needed to invoke:
nmcli con mod “Wired connection 1” ipv4.addresses 10.28.23.9/24
nmcli con mod “Wired connection 1” ipv4.method manual
nmcli con up “Wired connection 1”
(change the 28.23.9 to your team + ip preference)
That’s all fine. The one thing we hit that appears to be a bug is that, prior to using the nmcli command, we instead manually assigned an IP, logged into the photonvision GUI, and then used the settings UI to try to set a static IP. But that did not work for us, and I don’t know why.
At any rate, perhaps that helps someone else, and perhaps an expert can correct any misconceptions I’ve raised.
Yes - link local is very flakey in my experience. I would generally not recommend testing on anything except a network that looks like a robot network - DHCP server included.
If you are able to, please go to the settings page, perform the static IP set operation, and download a log file afterward. If you could post that here, or open an issue on github, it might help shed some light on what did or didn’t work in your case.
The network configuration provided by the user is saved to a .json file, and re-applied by photonvision at every startup or modification. Photon doesn’t currently rely on the underlying OS mechanisms to save the networking configuration over power cycle.
I had a similar problem yesterday while flashing PhotonVision 2023 on the Pi, where the IP address was not being shown during a direct connection between the Pi and a Windows laptop. I needed to run the connection through the Radio and Ethernet Switch for the connection to show up. Its most likely an issue of how Windows assigns the IP address and you may be able to change your Adapter Settings on PC to set a specific IP to try assigning to it, and using the command in the previous post to set a static IP on the Pi.
Other than that, if you ever need to test the PhotonVision, you need to run it through a Robot Radio as of now unless something gets changed.
I heard exactly the same thing last evening from my team’s networking guru and more specifically for this topic "don’t set static IP addresses on any device unless it is proven to you that it doesn’t work without it and then only on the device with a problem and only for the particular situation. Thus we don’t use static IP addresses. Some years ago we had a problem with an RPi disconnecting at a competition and set it to static IP. But that’s not a license to keep doing it.
I would disagree with this. My recommendation to any team using a coprocessor is to set static addresses for everything–Rio (.2), DS (.5, with 255.0.0.0 netmask), and coprocessor (.10-.20). It connects much faster and is more reliable in general. DHCP is convenient and more beginner-friendly, but if you have the knowledge to set things correctly, it’s just yet another potential source of failure.
@gerthworm : mind hitting me with a clue bat on the location of the .json file? I can see if it is populated as expected or not. I’ll also see if I can get a log and/or reproduce the problem situation.
I can’t reproduce the problem condition I reported earlier. I feel confident that it happened, but now I find that if I set nmcli back to auto (with a blank ip address), and then manually add a link address, the ‘save’ button in the photonvision UI does correctly populate /opt/photonvision_/photonvision_logs/networkSettings.json, and then after photonvision startup, that ip address is set. If I see it again, I’ll try to capture a log.
Any fixes for this topic? I am trying to connect the Pi4 running photonvision to an ethernet switch which then connects to the radio for ease at competitions for tethering.
Even with a static IP set on photon vision to 10.35.34.11 using the GUI, when connected to the ethernet switch, no comms… the only way i have found is i can connect the pi directly for a second, then reconnect it to the ethernet switch and plug the ethernet switch back into the radio. Not desirable, considering I am able to achieve the desired networking function using limelight, I don’t know how the static IP is not working if not directly connected to the radio.
I’ll have to mess around with this but i am pretty sure you can do something in /etc/network/interfaces and if all else fails just create a systemd service which adds the ip to the interface. netplan might also be a good solution but I am not sure if Raspian has moved over to this yet.
Replace <static_IP_address> with the desired static IP address for your machine, <subnet_mask> with the subnet mask for your network, <gateway_IP_address> with the IP address of your network gateway, and <DNS_server_IP_address> with the IP address of your DNS server.
Save the changes and exit the editor.
Apply the new network configuration by typing the following command: sudo netplan apply
Verify that the static IP address has been set by typing the following command: ip addr show
You should see your network interface with the static IP address you set in step 3.
These are the instructions I have found (or gotten from Chat GPT rather). I will have to try this later.
We will not have a display readily accessible, so we will attempt to use SSH (add the SSH file to enable SSH, connect pi directly to robot radio, etc.)
My real concern here is that I have reason to believe with a minor change to the PhotonVision image, this issue could be resolved. Just a complete guess, but maybe the DNS server is not being set even with setting the static IP, and so if not directly connected to the robot radio, it won’t show up on the network?
ChatGPT, as usual, is close but still incorrect. The file location and cli commands are correct but pretty much everything else is wrong.
For FRC the default gateway changes so it is best left to 0.0.0.0 so packets are sent out on that interface as long as the subnet and IP matches. Secondly there are no typical nameservers on a FRC control system network, only mDNS (AKA Bonjour). Thirdly netplan may require a renderer option which will define whether you use systemd-networkd or NetworkManager. Also the given instructions do not even define how to set a static IP in it correctly…