mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-20 00:51:41 +00:00
bug fixes and added nt pipline change
This commit is contained in:
@@ -14,7 +14,7 @@ public class Main {
|
||||
new Thread(new VisionProcess(camSet.getValue())).start();
|
||||
}
|
||||
NetworkTableInstance.getDefault().startClientTeam(SettingsManager.GeneralSettings.team_number);
|
||||
//NetworkTableInstance.getDefault().startClient("localhost");
|
||||
// NetworkTableInstance.getDefault().startClient("localhost");
|
||||
Server.main(8888);
|
||||
} else {
|
||||
System.err.println("No cameras connected!");
|
||||
|
||||
@@ -140,7 +140,7 @@ public class Camera {
|
||||
return currentPipelineIndex;
|
||||
}
|
||||
|
||||
void setCurrentPipelineIndex(int pipelineNumber) {
|
||||
public void setCurrentPipelineIndex(int pipelineNumber) {
|
||||
if (pipelineNumber - 1 > pipelines.size()) return;
|
||||
currentPipelineIndex = pipelineNumber;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,9 @@ package com.chameleonvision.vision.process;
|
||||
import com.chameleonvision.settings.SettingsManager;
|
||||
import com.chameleonvision.vision.Pipeline;
|
||||
import com.chameleonvision.vision.camera.Camera;
|
||||
import com.chameleonvision.web.Server;
|
||||
import com.chameleonvision.web.ServerHandler;
|
||||
import edu.wpi.cscore.VideoException;
|
||||
import edu.wpi.first.networktables.*;
|
||||
import org.opencv.core.*;
|
||||
import org.opencv.imgproc.Imgproc;
|
||||
@@ -77,12 +79,18 @@ public class VisionProcess implements Runnable {
|
||||
if (camera.getPipelines().containsKey(ntPipelineIndex)) {
|
||||
// camera.setEntryNotification.value.getString());
|
||||
var pipeline = camera.getCurrentPipeline();
|
||||
|
||||
camera.setExposure(pipeline.exposure);
|
||||
camera.setCurrentPipelineIndex(ntPipelineIndex);
|
||||
try{
|
||||
camera.setExposure(pipeline.exposure);
|
||||
}
|
||||
catch (VideoException e){
|
||||
System.err.println(e.toString());
|
||||
}
|
||||
camera.setBrightness(pipeline.brightness);
|
||||
HashMap<String, Object> pipeChange = new HashMap<>();
|
||||
pipeChange.put("curr_pipeline", ntPipelineIndex);
|
||||
ServerHandler.broadcastMessage(pipeChange);
|
||||
ServerHandler.sendFullSettings();
|
||||
|
||||
} else {
|
||||
ntPipelineEntry.setString("pipeline" + camera.getCurrentPipelineIndex());
|
||||
|
||||
@@ -99,12 +99,13 @@ public class ServerHandler {
|
||||
sendFullSettings();
|
||||
break;
|
||||
case "curr_pipeline":
|
||||
String newPipeline = (String) value;
|
||||
String newPipeline = value.toString();
|
||||
var pipelineNumber = Integer.parseInt(newPipeline.replace("pipeline", ""));
|
||||
System.out.printf("Changing pipeline to %s\n", newPipeline);
|
||||
CameraManager.setCurrentPipeline(pipelineNumber);
|
||||
// broadcastMessage(allFieldsToMap(CameraManager.getCurrentPipeline()));
|
||||
broadcastMessage(allFieldsToMap(CameraManager.getCurrentPipeline()));
|
||||
|
||||
break;
|
||||
case "resolution":
|
||||
int newVideoMode = (int) value;
|
||||
|
||||
Reference in New Issue
Block a user