mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-20 00:51:41 +00:00
Wait for NetworkManager on first call to getAllInterfaces (#2240)
## Description On the RubikPi3, PhotonVision starts before NetworkManager has fully initialized. This causes it to fail to identify the network interfaces available on the board, which leads to problems with configuring and controling networking from the UI. The failure can be detected by the call to `nmcli` returning an [exit status of 8](https://networkmanager.dev/docs/api/latest/nmcli.html#exit_status), which means "NetworkManager is not running." This PR retries the call to nmcli every 0.5 seconds until the exit status does not equal 8, or a maximum of 10 attempts have been made. The retry only occurs the first time `getAllInterfaces()` is called. Subsequent calls to this method will only make one attempt to avoid locking up the program if networking isn't responding as expected. In my testing on the RubikPi3, the code has to retry for less than 2 seconds in order to get a valid response from NetworkManager. The need for this is greatly reduced by https://github.com/PhotonVision/photon-image-modifier/pull/114, but this code adds an additional layer of robustness against slow network startup. Closes #2212 ## Meta Merge checklist: - [x] Pull Request title is [short, imperative summary](https://cbea.ms/git-commit/) of proposed changes - [x] The description documents the _what_ and _why_ - [ ] If this PR changes behavior or adds a feature, user documentation is updated - [ ] If this PR touches photon-serde, all messages have been regenerated and hashes have not changed unexpectedly - [ ] If this PR touches configuration, this is backwards compatible with settings back to v2025.3.2 - [ ] If this PR touches pipeline settings or anything related to data exchange, the frontend typing is updated - [ ] If this PR addresses a bug, a regression test for it is added --------- Co-authored-by: samfreund <samf.236@proton.me>
This commit is contained in:
@@ -276,10 +276,6 @@ public class Main {
|
||||
ConfigManager.getInstance().load(); // init config manager
|
||||
ConfigManager.getInstance().requestSave();
|
||||
|
||||
logger.debug("Loading HardwareManager...");
|
||||
// Force load the hardware manager
|
||||
HardwareManager.getInstance();
|
||||
|
||||
logger.info("Loading ML models...");
|
||||
var modelManager = NeuralNetworkModelManager.getInstance();
|
||||
modelManager.extractModels();
|
||||
@@ -293,6 +289,10 @@ public class Main {
|
||||
.setConfig(ConfigManager.getInstance().getConfig().getNetworkConfig());
|
||||
NetworkTablesManager.getInstance().registerTimedTasks();
|
||||
|
||||
logger.debug("Loading HardwareManager...");
|
||||
// Force load the hardware manager
|
||||
HardwareManager.getInstance();
|
||||
|
||||
if (isSmoketest) {
|
||||
logger.info("PhotonVision base functionality loaded -- smoketest complete");
|
||||
System.exit(0);
|
||||
|
||||
Reference in New Issue
Block a user