Advanced networking settings (#899)

Exposes NetworkManager interface name and more robustly handles device/interface names internally.

---------

Co-authored-by: Sriman Achanta <68172138+srimanachanta@users.noreply.github.com>
This commit is contained in:
Matt
2023-09-01 12:58:35 -07:00
committed by GitHub
parent 08892b9e68
commit 306677e56f
14 changed files with 313 additions and 90 deletions

View File

@@ -80,6 +80,12 @@ public class Main {
"ignore-cameras",
true,
"Ignore cameras that match a regex. Uses camera name as provided by cscore.");
options.addOption("n", "disable-networking", false, "Disables control device network settings");
options.addOption(
"c",
"clear-config",
false,
"Clears PhotonVision pipeline and networking settings. Preserves log files");
CommandLineParser parser = new DefaultParser();
CommandLine cmd = parser.parse(options, args);
@@ -109,6 +115,14 @@ public class Main {
VisionSourceManager.getInstance()
.setIgnoredCamerasRegex(cmd.getOptionValue("ignore-cameras"));
}
if (cmd.hasOption("disable-networking")) {
NetworkManager.getInstance().networkingIsDisabled = true;
}
if (cmd.hasOption("clear-config")) {
ConfigManager.getInstance().clearConfig();
}
}
return true;
}
@@ -117,46 +131,29 @@ public class Main {
ConfigManager.getInstance().load();
try {
var reflective = new ReflectivePipelineSettings();
var shape = new ColoredShapePipelineSettings();
var aprilTag = new AprilTagPipelineSettings();
List<VisionSource> collectedSources =
Files.list(testModeFolder)
.filter(p -> p.toFile().isFile())
.map(
p -> {
try {
// var camConf =
//
// ConfigManager.getInstance()
// .getConfig()
//
// .getCameraConfigurations()
//
// .get(p.getFileName().toString());
CameraConfiguration camConf =
new CameraConfiguration(
p.getFileName().toString(), p.toAbsolutePath().toString());
camConf.FOV = TestUtils.WPI2019Image.FOV; // Good guess?
camConf.addCalibration(TestUtils.get2020LifeCamCoeffs(false));
// if (camConf == null && false) {
CameraConfiguration camConf;
if (true) {
camConf =
new CameraConfiguration(
p.getFileName().toString(), p.toAbsolutePath().toString());
camConf.FOV = TestUtils.WPI2019Image.FOV; // Good guess?
camConf.addCalibration(TestUtils.get2020LifeCamCoeffs(false));
var pipeSettings = new AprilTagPipelineSettings();
pipeSettings.pipelineNickname = p.getFileName().toString();
pipeSettings.outputShowMultipleTargets = true;
pipeSettings.inputShouldShow = true;
pipeSettings.outputShouldShow = false;
pipeSettings.solvePNPEnabled = true;
var pipeSettings = new AprilTagPipelineSettings();
pipeSettings.pipelineNickname = p.getFileName().toString();
pipeSettings.outputShowMultipleTargets = true;
pipeSettings.inputShouldShow = true;
pipeSettings.outputShouldShow = false;
pipeSettings.solvePNPEnabled = true;
var psList = new ArrayList<CVPipelineSettings>();
// psList.add(reflective);
// psList.add(shape);
psList.add(aprilTag);
camConf.pipelineSettings = psList;
}
var aprilTag = new AprilTagPipelineSettings();
var psList = new ArrayList<CVPipelineSettings>();
psList.add(aprilTag);
camConf.pipelineSettings = psList;
return new FileVisionSource(camConf);
} catch (Exception e) {
@@ -313,9 +310,11 @@ public class Main {
}
try {
LibCameraJNI.forceLoad();
if (Platform.isRaspberryPi()) {
LibCameraJNI.forceLoad();
}
} catch (IOException e) {
logger.error("Failed to load native libraries!", e);
logger.error("Failed to load libcamera-JNI!", e);
}
try {