mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-20 00:51:41 +00:00
Updated Maven Deps to the new WPILib Artifactory, added AARCH64-Bionic support (Jetson)
This commit is contained in:
@@ -4,15 +4,29 @@ import com.chameleonvision.settings.SettingsManager;
|
||||
import com.chameleonvision.vision.camera.CameraManager;
|
||||
import com.chameleonvision.vision.process.VisionProcess;
|
||||
import com.chameleonvision.web.Server;
|
||||
import edu.wpi.cscore.CameraServerCvJNI;
|
||||
import edu.wpi.cscore.CameraServerJNI;
|
||||
import edu.wpi.first.networktables.NetworkTableInstance;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
// Attempt to load the JNI Libraries
|
||||
try {
|
||||
CameraServerJNI.forceLoad();
|
||||
CameraServerCvJNI.forceLoad();
|
||||
} catch (IOException e) {
|
||||
var errorStr = SettingsManager.getCurrentPlatform().equals(SettingsManager.Platform.UNSUPPORTED) ? "Unsupported platform!" : "Failed to load JNI Libraries!";
|
||||
throw new RuntimeException(errorStr);
|
||||
}
|
||||
|
||||
if (CameraManager.initializeCameras()) {
|
||||
SettingsManager.initialize();
|
||||
for (var camSet : CameraManager.getAllCamerasByName().entrySet()) {
|
||||
new Thread(new VisionProcess(camSet.getValue())).start();
|
||||
}
|
||||
|
||||
NetworkTableInstance.getDefault().startClientTeam(SettingsManager.GeneralSettings.team_number);
|
||||
// NetworkTableInstance.getDefault().startClient("localhost");
|
||||
Server.main(8888);
|
||||
|
||||
@@ -36,8 +36,6 @@ public class Camera {
|
||||
private CamVideoMode camVideoMode;
|
||||
private int currentPipelineIndex;
|
||||
private HashMap<Integer, Pipeline> pipelines;
|
||||
private long initTimeout;
|
||||
|
||||
|
||||
public Camera(String cameraName) {
|
||||
this(cameraName, DEFAULT_FOV);
|
||||
@@ -71,7 +69,7 @@ public class Camera {
|
||||
// set up video modes according to minimums
|
||||
if (SettingsManager.getCurrentPlatform() == SettingsManager.Platform.WINDOWS_64 && !UsbCam.isConnected()) {
|
||||
System.out.print("Waiting on camera... ");
|
||||
initTimeout = System.nanoTime();
|
||||
long initTimeout = System.nanoTime();
|
||||
while(!UsbCam.isConnected())
|
||||
{
|
||||
//TODO add a time sleep, can wait only so long before giving up
|
||||
@@ -96,8 +94,6 @@ public class Camera {
|
||||
|
||||
cvSink = cs.getVideo(UsbCam);
|
||||
cvSource = cs.putVideo(name, camVals.ImageWidth, camVals.ImageHeight);
|
||||
var s = (MjpegServer) cs.getServer("serve_" + name);
|
||||
CameraManager.CameraPorts.put(name, s.getPort());
|
||||
}
|
||||
|
||||
VideoMode[] getAvailableVideoModes() {
|
||||
|
||||
@@ -20,7 +20,6 @@ import java.util.List;
|
||||
public class CameraManager {
|
||||
|
||||
private static final Path CamConfigPath = Paths.get(SettingsManager.SettingsPath.toString(), "Cams");
|
||||
public static HashMap<String, Integer> CameraPorts = new HashMap<>();
|
||||
|
||||
private static HashMap<String, Camera> AllCamerasByName = new HashMap<>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user