mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-23 01:21:40 +00:00
bugfix in delete pipeline in ui, changed pipelines to be a list instead of a hashmap, ui renaming
- changed pipeline delete message to be Can not remove the only pipeline! - duplicate pipeline window will display current pipeline on open - duplicate windows button changed from discard to cancel
This commit is contained in:
@@ -9,6 +9,8 @@ import edu.wpi.cscore.*;
|
||||
import edu.wpi.first.cameraserver.CameraServer;
|
||||
import org.opencv.core.Mat;
|
||||
|
||||
import java.nio.channels.Pipe;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -42,7 +44,7 @@ public class Camera {
|
||||
private CameraValues camVals;
|
||||
private CamVideoMode camVideoMode;
|
||||
private int currentPipelineIndex;
|
||||
private HashMap<Integer, Pipeline> pipelines;
|
||||
private List<Pipeline> pipelines;
|
||||
|
||||
public Camera(String cameraName) {
|
||||
this(cameraName, DEFAULT_FOV);
|
||||
@@ -57,18 +59,16 @@ public class Camera {
|
||||
}
|
||||
|
||||
public Camera(String cameraName, UsbCameraInfo usbCamInfo, double fov, StreamDivisor divisor) {
|
||||
this(cameraName, usbCamInfo, fov, new HashMap<>(), 0, divisor);
|
||||
this(cameraName, usbCamInfo, fov, new ArrayList<>(), 0, divisor);
|
||||
}
|
||||
|
||||
public Camera(String cameraName, double fov, int videoModeIndex, StreamDivisor divisor) {
|
||||
this(cameraName, fov, new HashMap<>(), videoModeIndex, divisor);
|
||||
}
|
||||
|
||||
public Camera(String cameraName, double fov, HashMap<Integer, Pipeline> pipelines, int videoModeIndex, StreamDivisor divisor) {
|
||||
public Camera(String cameraName, double fov, List<Pipeline> pipelines, int videoModeIndex, StreamDivisor divisor) {
|
||||
this(cameraName, CameraManager.AllUsbCameraInfosByName.get(cameraName), fov, pipelines, videoModeIndex, divisor);
|
||||
}
|
||||
|
||||
public Camera(String cameraName, UsbCameraInfo usbCamInfo, double fov, HashMap<Integer, Pipeline> pipelines, int videoModeIndex, StreamDivisor divisor) {
|
||||
public Camera(String cameraName, double fov, int videoModeIndex, StreamDivisor divisor) {
|
||||
this(cameraName, fov, new ArrayList<>(), videoModeIndex, divisor);
|
||||
}
|
||||
public Camera(String cameraName, UsbCameraInfo usbCamInfo, double fov, List<Pipeline> pipelines, int videoModeIndex, StreamDivisor divisor) {
|
||||
FOV = fov;
|
||||
name = cameraName;
|
||||
|
||||
@@ -140,28 +140,20 @@ public class Camera {
|
||||
ServerHandler.sendFullSettings();
|
||||
}
|
||||
}
|
||||
|
||||
public void addPipeline() {
|
||||
addPipeline(pipelines.size());
|
||||
Pipeline p = new Pipeline();
|
||||
p.nickname = "New pipeline " + pipelines.size();
|
||||
addPipeline(p);
|
||||
}
|
||||
public void addPipeline(Pipeline p){
|
||||
this.pipelines.add(p);
|
||||
}
|
||||
|
||||
public void addPipeline(Pipeline pipeline) {
|
||||
int newPipelineIndex = pipelines.size();
|
||||
addPipeline(newPipelineIndex, pipeline);
|
||||
public void deletePipeline(int index) {
|
||||
pipelines.remove(index);
|
||||
}
|
||||
|
||||
private void addPipeline(int pipelineNumber) {
|
||||
if (pipelines.containsKey(pipelineNumber)) return;
|
||||
pipelines.put(pipelineNumber, new Pipeline());
|
||||
}
|
||||
|
||||
private void addPipeline(int pipelineIndex, Pipeline pipeline) {
|
||||
if (pipelines.containsKey(pipelineIndex)) return;
|
||||
pipelines.put(pipelineIndex, pipeline);
|
||||
}
|
||||
|
||||
public void deleteCurrentPipeline() {
|
||||
pipelines.remove(getCurrentPipelineIndex());
|
||||
public void deletePipeline() {
|
||||
deletePipeline(getCurrentPipelineIndex());
|
||||
}
|
||||
|
||||
public Pipeline getCurrentPipeline() {
|
||||
@@ -189,12 +181,12 @@ public class Camera {
|
||||
streamDivisor = StreamDivisor.values()[divisor];
|
||||
}
|
||||
|
||||
public HashMap<Integer, Pipeline> getPipelines() {
|
||||
public List<Pipeline> getPipelines() {
|
||||
return pipelines;
|
||||
}
|
||||
public List<String> getPipelinesNickname(){
|
||||
var pipelines = getPipelines();
|
||||
return pipelines.values().stream().map(pipeline -> pipeline.nickname).collect(Collectors.toList());
|
||||
return pipelines.stream().map(pipeline -> pipeline.nickname).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public CamVideoMode getVideoMode() {
|
||||
|
||||
@@ -2,13 +2,17 @@ package com.chameleonvision.vision.camera;
|
||||
|
||||
import com.chameleonvision.vision.Pipeline;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.JavaType;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.type.MapType;
|
||||
import com.fasterxml.jackson.databind.type.ArrayType;
|
||||
import com.fasterxml.jackson.databind.type.TypeFactory;
|
||||
import com.google.gson.*;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class CameraDeserializer implements JsonDeserializer<Camera> {
|
||||
@Override
|
||||
@@ -21,12 +25,12 @@ public class CameraDeserializer implements JsonDeserializer<Camera> {
|
||||
var divisor = StreamDivisor.values()[jsonObj.get("streamDivisor").getAsInt()];
|
||||
|
||||
var pipelines = jsonObj.get("pipelines");
|
||||
HashMap<Integer, Pipeline> actualPipelines = new HashMap<>();
|
||||
List<Pipeline> actualPipelines = new ArrayList<>();
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
TypeFactory typeFactory = mapper.getTypeFactory();
|
||||
MapType mapType = typeFactory.constructMapType(HashMap.class, Integer.class, Pipeline.class);
|
||||
JavaType arrayType = typeFactory.constructCollectionType(List.class, Pipeline.class);
|
||||
try {
|
||||
actualPipelines = mapper.readValue(pipelines.toString(), mapType);
|
||||
actualPipelines = mapper.readValue(pipelines.toString(), arrayType);
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -116,8 +116,9 @@ public class CameraManager {
|
||||
}
|
||||
|
||||
public static void setCurrentPipeline(int pipelineNumber) throws CameraException {
|
||||
if (!getCurrentCamera().getPipelines().containsKey(pipelineNumber))
|
||||
if (pipelineNumber >= getCurrentCamera().getPipelines().size()){
|
||||
throw new CameraException(CameraException.CameraExceptionType.BAD_PIPELINE);
|
||||
}
|
||||
getCurrentCamera().setCurrentPipelineIndex(pipelineNumber);
|
||||
SettingsManager.updatePipelineSetting(pipelineNumber);
|
||||
}
|
||||
|
||||
@@ -78,8 +78,9 @@ public class VisionProcess implements Runnable {
|
||||
|
||||
private void pipelineListener(EntryNotification entryNotification) {
|
||||
var ntPipelineIndex = (int) entryNotification.value.getDouble();
|
||||
if (camera.getPipelines().containsKey(ntPipelineIndex)) {
|
||||
// camera.setEntryNotification.value.getString());
|
||||
if (ntPipelineIndex >= camera.getPipelines().size()){
|
||||
ntPipelineEntry.setNumber(camera.getCurrentPipelineIndex());
|
||||
} else{
|
||||
var pipeline = camera.getCurrentPipeline();
|
||||
camera.setCurrentPipelineIndex(ntPipelineIndex);
|
||||
try {
|
||||
@@ -96,8 +97,6 @@ public class VisionProcess implements Runnable {
|
||||
ServerHandler.sendFullSettings();
|
||||
|
||||
}
|
||||
} else {
|
||||
ntPipelineEntry.setNumber(camera.getCurrentPipelineIndex());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -94,8 +94,15 @@ public class ServerHandler {
|
||||
sendFullSettings();
|
||||
break;
|
||||
case "deleteCurrentPipeline":
|
||||
cam.deleteCurrentPipeline();
|
||||
cam.setCurrentPipelineIndex(cam.getCurrentPipelineIndex() - 1);
|
||||
int currentIndex = cam.getCurrentPipelineIndex();
|
||||
int nextIndex = 0;
|
||||
if (currentIndex == cam.getPipelines().size() - 1){
|
||||
nextIndex = currentIndex - 1;
|
||||
} else {
|
||||
nextIndex = currentIndex;
|
||||
}
|
||||
cam.deletePipeline();
|
||||
cam.setCurrentPipelineIndex(nextIndex);
|
||||
sendFullSettings();
|
||||
break;
|
||||
}
|
||||
@@ -107,17 +114,24 @@ public class ServerHandler {
|
||||
var cam = CameraManager.getCurrentCamera();
|
||||
HashMap<String, Object> tmp = new HashMap<>();
|
||||
tmp.put("pipeline", cam.getCurrentPipeline());
|
||||
tmp.put("pipelineList", cam.getPipelines().keySet());
|
||||
tmp.put("pipelineList", cam.getPipelinesNickname());
|
||||
tmp.put("port", cam.getStreamPort());
|
||||
tmp.put("resolutionList", cam.getResolutionList());
|
||||
broadcastMessage(tmp);
|
||||
break;
|
||||
}
|
||||
case "currentPipeline": {
|
||||
CameraManager.getCurrentCamera().setCurrentPipelineIndex((Integer) entry.getValue());
|
||||
var cam = CameraManager.getCurrentCamera();
|
||||
cam.setCurrentPipelineIndex((Integer) entry.getValue());
|
||||
HashMap<String, Object> tmp = new HashMap<>();
|
||||
tmp.put("pipeline", getOrdinalPipeline());
|
||||
broadcastMessage(tmp);
|
||||
try {
|
||||
cam.setBrightness(cam.getCurrentPipeline().brightness);
|
||||
cam.setExposure(cam.getCurrentPipeline().exposure);
|
||||
}catch (Exception e){
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=/favicon.png><title>Chameleon Vision</title><link rel=stylesheet href=/Roboto.css><link href=/css/chunk-234aed0c.62cd23bf.css rel=prefetch><link href=/css/chunk-402ab08c.d47fe89d.css rel=prefetch><link href=/css/chunk-716fb61c.ab43288b.css rel=prefetch><link href=/css/chunk-79b72a3d.52ef46aa.css rel=prefetch><link href=/css/chunk-7a810817.e757f52a.css rel=prefetch><link href=/css/chunk-7cf477eb.a93b3047.css rel=prefetch><link href=/css/chunk-9cd0ff3c.bd74e87e.css rel=prefetch><link href=/css/chunk-c11abc1e.550a8275.css rel=prefetch><link href=/css/chunk-c44c6306.3e507f7b.css rel=prefetch><link href=/js/chunk-234aed0c.fbf7ad5e.js rel=prefetch><link href=/js/chunk-3ae1c3ad.6979650a.js rel=prefetch><link href=/js/chunk-402ab08c.dd7b432d.js rel=prefetch><link href=/js/chunk-716fb61c.84a36d26.js rel=prefetch><link href=/js/chunk-79b72a3d.aeb36768.js rel=prefetch><link href=/js/chunk-7a810817.bca05c28.js rel=prefetch><link href=/js/chunk-7cf477eb.de18472d.js rel=prefetch><link href=/js/chunk-98e0c8cc.240c79a9.js rel=prefetch><link href=/js/chunk-9cd0ff3c.29be4c57.js rel=prefetch><link href=/js/chunk-c11abc1e.fa113e7a.js rel=prefetch><link href=/js/chunk-c44c6306.d9c69fb0.js rel=prefetch><link href=/css/app.eb572613.css rel=preload as=style><link href=/css/chunk-vendors.97f47167.css rel=preload as=style><link href=/js/app.0989a0d2.js rel=preload as=script><link href=/js/chunk-vendors.6cb32058.js rel=preload as=script><link href=/css/chunk-vendors.97f47167.css rel=stylesheet><link href=/css/app.eb572613.css rel=stylesheet></head><body><noscript><strong>We're sorry but Chameleon Vision doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=/js/chunk-vendors.6cb32058.js></script><script src=/js/app.0989a0d2.js></script></body></html>
|
||||
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=/favicon.png><title>Chameleon Vision</title><link rel=stylesheet href=/Roboto.css><link href=/css/chunk-234aed0c.62cd23bf.css rel=prefetch><link href=/css/chunk-402ab08c.d47fe89d.css rel=prefetch><link href=/css/chunk-58ba3dae.65211bf4.css rel=prefetch><link href=/css/chunk-716fb61c.ab43288b.css rel=prefetch><link href=/css/chunk-79b72a3d.52ef46aa.css rel=prefetch><link href=/css/chunk-7a810817.e757f52a.css rel=prefetch><link href=/css/chunk-7cf477eb.a93b3047.css rel=prefetch><link href=/css/chunk-9cd0ff3c.bd74e87e.css rel=prefetch><link href=/css/chunk-c44c6306.3e507f7b.css rel=prefetch><link href=/js/chunk-234aed0c.fbf7ad5e.js rel=prefetch><link href=/js/chunk-3ae1c3ad.6979650a.js rel=prefetch><link href=/js/chunk-402ab08c.dd7b432d.js rel=prefetch><link href=/js/chunk-58ba3dae.81c89e61.js rel=prefetch><link href=/js/chunk-716fb61c.84a36d26.js rel=prefetch><link href=/js/chunk-79b72a3d.aeb36768.js rel=prefetch><link href=/js/chunk-7a810817.bca05c28.js rel=prefetch><link href=/js/chunk-7cf477eb.de18472d.js rel=prefetch><link href=/js/chunk-98e0c8cc.240c79a9.js rel=prefetch><link href=/js/chunk-9cd0ff3c.29be4c57.js rel=prefetch><link href=/js/chunk-c44c6306.d9c69fb0.js rel=prefetch><link href=/css/app.eb572613.css rel=preload as=style><link href=/css/chunk-vendors.97f47167.css rel=preload as=style><link href=/js/app.deaf0ffb.js rel=preload as=script><link href=/js/chunk-vendors.6cb32058.js rel=preload as=script><link href=/css/chunk-vendors.97f47167.css rel=stylesheet><link href=/css/app.eb572613.css rel=stylesheet></head><body><noscript><strong>We're sorry but Chameleon Vision doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=/js/chunk-vendors.6cb32058.js></script><script src=/js/app.deaf0ffb.js></script></body></html>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=/favicon.png><title>Chameleon Vision</title><link rel=stylesheet href=/Roboto.css><link href=/css/chunk-234aed0c.62cd23bf.css rel=prefetch><link href=/css/chunk-402ab08c.d47fe89d.css rel=prefetch><link href=/css/chunk-716fb61c.ab43288b.css rel=prefetch><link href=/css/chunk-79b72a3d.52ef46aa.css rel=prefetch><link href=/css/chunk-7a810817.e757f52a.css rel=prefetch><link href=/css/chunk-7cf477eb.a93b3047.css rel=prefetch><link href=/css/chunk-9cd0ff3c.bd74e87e.css rel=prefetch><link href=/css/chunk-c11abc1e.550a8275.css rel=prefetch><link href=/css/chunk-c44c6306.3e507f7b.css rel=prefetch><link href=/js/chunk-234aed0c.fbf7ad5e.js rel=prefetch><link href=/js/chunk-3ae1c3ad.6979650a.js rel=prefetch><link href=/js/chunk-402ab08c.dd7b432d.js rel=prefetch><link href=/js/chunk-716fb61c.84a36d26.js rel=prefetch><link href=/js/chunk-79b72a3d.aeb36768.js rel=prefetch><link href=/js/chunk-7a810817.bca05c28.js rel=prefetch><link href=/js/chunk-7cf477eb.de18472d.js rel=prefetch><link href=/js/chunk-98e0c8cc.240c79a9.js rel=prefetch><link href=/js/chunk-9cd0ff3c.29be4c57.js rel=prefetch><link href=/js/chunk-c11abc1e.fa113e7a.js rel=prefetch><link href=/js/chunk-c44c6306.d9c69fb0.js rel=prefetch><link href=/css/app.eb572613.css rel=preload as=style><link href=/css/chunk-vendors.97f47167.css rel=preload as=style><link href=/js/app.0989a0d2.js rel=preload as=script><link href=/js/chunk-vendors.6cb32058.js rel=preload as=script><link href=/css/chunk-vendors.97f47167.css rel=stylesheet><link href=/css/app.eb572613.css rel=stylesheet></head><body><noscript><strong>We're sorry but Chameleon Vision doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=/js/chunk-vendors.6cb32058.js></script><script src=/js/app.0989a0d2.js></script></body></html>
|
||||
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=/favicon.png><title>Chameleon Vision</title><link rel=stylesheet href=/Roboto.css><link href=/css/chunk-234aed0c.62cd23bf.css rel=prefetch><link href=/css/chunk-402ab08c.d47fe89d.css rel=prefetch><link href=/css/chunk-58ba3dae.65211bf4.css rel=prefetch><link href=/css/chunk-716fb61c.ab43288b.css rel=prefetch><link href=/css/chunk-79b72a3d.52ef46aa.css rel=prefetch><link href=/css/chunk-7a810817.e757f52a.css rel=prefetch><link href=/css/chunk-7cf477eb.a93b3047.css rel=prefetch><link href=/css/chunk-9cd0ff3c.bd74e87e.css rel=prefetch><link href=/css/chunk-c44c6306.3e507f7b.css rel=prefetch><link href=/js/chunk-234aed0c.fbf7ad5e.js rel=prefetch><link href=/js/chunk-3ae1c3ad.6979650a.js rel=prefetch><link href=/js/chunk-402ab08c.dd7b432d.js rel=prefetch><link href=/js/chunk-58ba3dae.81c89e61.js rel=prefetch><link href=/js/chunk-716fb61c.84a36d26.js rel=prefetch><link href=/js/chunk-79b72a3d.aeb36768.js rel=prefetch><link href=/js/chunk-7a810817.bca05c28.js rel=prefetch><link href=/js/chunk-7cf477eb.de18472d.js rel=prefetch><link href=/js/chunk-98e0c8cc.240c79a9.js rel=prefetch><link href=/js/chunk-9cd0ff3c.29be4c57.js rel=prefetch><link href=/js/chunk-c44c6306.d9c69fb0.js rel=prefetch><link href=/css/app.eb572613.css rel=preload as=style><link href=/css/chunk-vendors.97f47167.css rel=preload as=style><link href=/js/app.deaf0ffb.js rel=preload as=script><link href=/js/chunk-vendors.6cb32058.js rel=preload as=script><link href=/css/chunk-vendors.97f47167.css rel=stylesheet><link href=/css/app.eb572613.css rel=stylesheet></head><body><noscript><strong>We're sorry but Chameleon Vision doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=/js/chunk-vendors.6cb32058.js></script><script src=/js/app.deaf0ffb.js></script></body></html>
|
||||
@@ -40,7 +40,7 @@
|
||||
<CVicon color="red darken-2" :right="true" text="delete" tooltip="Delete pipeline"></CVicon>
|
||||
</v-list-item-title>
|
||||
</v-list-item>
|
||||
<v-list-item @click="duplicateDialog = true">
|
||||
<v-list-item @click="openDuplicateDialog">
|
||||
<v-list-item-title>
|
||||
<CVicon color="#c5c5c5" :right="true" text="mdi-content-copy" tooltip="Duplicate pipeline"></CVicon>
|
||||
</v-list-item-title>
|
||||
@@ -99,13 +99,13 @@
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="#4baf62" text @click="duplicatePipeline">Duplicate</v-btn>
|
||||
<v-btn color="error" text @click="closeDuplicateDialog">Discard</v-btn>
|
||||
<v-btn color="error" text @click="closeDuplicateDialog">Cancels</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
<!-- snack bar -->
|
||||
<v-snackbar :timeout="3000" v-model="snackbar" top color="error">
|
||||
<span style="color:#000">Only one pipeline left</span>
|
||||
<span style="color:#000">Can not remove the only pipeline!</span>
|
||||
<v-btn color="black" text @click="snackbar = false">Close</v-btn>
|
||||
</v-snackbar>
|
||||
</div>
|
||||
@@ -167,6 +167,13 @@ import CVinput from '../components/cv-input'
|
||||
this.handleInput("duplicatePipeline",this.pipelineDuplicate);
|
||||
this.closeDuplicateDialog();
|
||||
},
|
||||
openDuplicateDialog(){
|
||||
this.pipelineDuplicate = {
|
||||
pipeline:this.currentPipelineIndex,
|
||||
camera:-1
|
||||
}
|
||||
this.duplicateDialog = true;
|
||||
},
|
||||
closeDuplicateDialog(){
|
||||
this.duplicateDialog = false;
|
||||
this.pipelineDuplicate = {
|
||||
@@ -176,7 +183,7 @@ import CVinput from '../components/cv-input'
|
||||
},
|
||||
deleteCurrentPipeline(){
|
||||
if (this.pipelineList.length > 1) {
|
||||
this.andleInput('command','deleteCurrentPipeline');
|
||||
this.handleInput('command','deleteCurrentPipeline');
|
||||
} else {
|
||||
this.snackbar = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user