mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-22 01:11:40 +00:00
bug fixes in ui and bug fixes in sever handler
-- updated pom
This commit is contained in:
@@ -214,9 +214,9 @@ public class ServerHandler {
|
||||
broadcastMessage(obj, null);//Broadcasts the message to every user
|
||||
}
|
||||
|
||||
private static HashMap<String, Object> getOrdinalPipeline() throws IllegalAccessException {
|
||||
private static HashMap<String, Object> getOrdinalPipeline(Class cvClass) throws IllegalAccessException {
|
||||
HashMap<String, Object> tmp = new HashMap<>();
|
||||
for (Field field : CVPipelineSettings.class.getFields()) { // iterate over every field in CVPipelineSettings
|
||||
for (Field field :cvClass.getFields()) { // iterate over every field in CVPipelineSettings
|
||||
try {
|
||||
if (!field.getType().isEnum()) { // if the field is not an enum, get it based on the current pipeline
|
||||
tmp.put(field.getName(), field.get(VisionManager.getCurrentUIVisionProcess().getCurrentPipeline().settings));
|
||||
@@ -263,45 +263,6 @@ public class ServerHandler {
|
||||
return tmp;
|
||||
}
|
||||
|
||||
private static Map<String, Object> settingsToMap(GeneralSettings settings) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("team_number", settings.teamNumber);
|
||||
map.put("connection_type", settings.connectionType);
|
||||
map.put("ip", settings.ip);
|
||||
map.put("gateway", settings.gateway);
|
||||
map.put("netmask", settings.netmask);
|
||||
map.put("hostname", settings.hostname);
|
||||
map.put("curr_camera", settings.currentCamera);
|
||||
map.put("curr_pipeline", settings.currentPipeline);
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
private static Map<String, Object> pipelineToMap(CVPipelineSettings s) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("exposure", s.exposure);
|
||||
map.put("brightness", s.brightness);
|
||||
if(s instanceof CVPipeline2dSettings) {
|
||||
var s_ = (CVPipeline2dSettings) s;
|
||||
map.put("orientation", s.flipMode.name());
|
||||
map.put("hue", s_.hue);
|
||||
map.put("saturation", s_.saturation);
|
||||
map.put("value", s_.value);
|
||||
map.put("erode", s_.erode);
|
||||
map.put("dilate", s_.dilate);
|
||||
map.put("area", s_.area);
|
||||
map.put("ratio", s_.ratio);
|
||||
map.put("extent", s_.extent);
|
||||
map.put("is_binary", s_.isBinary);
|
||||
map.put("sort_mode", s_.sortMode.name());
|
||||
map.put("target_group", s_.targetGroup.name());
|
||||
map.put("target_intersection", s_.targetIntersection.name());
|
||||
map.put("M", s_.dualTargetCalibrationM);
|
||||
map.put("B", s_.dualTargetCalibrationB);
|
||||
map.put("is_calibrated", !s_.calibrationMode.equals(CalibrationMode.None));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
public static void sendFullSettings() {
|
||||
//General settings
|
||||
Map<String, Object> fullSettings = new HashMap<>();
|
||||
@@ -311,16 +272,15 @@ public class ServerHandler {
|
||||
CVPipeline currentPipeline = currentProcess.getCurrentPipeline();
|
||||
|
||||
try {
|
||||
fullSettings.putAll(settingsToMap(ConfigManager.settings));
|
||||
fullSettings.putAll(pipelineToMap(currentPipeline.settings));
|
||||
// fullSettings.putAll(settingsToMap(ConfigManager.settings));
|
||||
// fullSettings.putAll(pipelineToMap(currentPipeline.settings));
|
||||
fullSettings.put("settings", getOrdinalSettings());
|
||||
fullSettings.put("cameraSettings", getOrdinalCameraSettings());
|
||||
fullSettings.put("cameraList", VisionManager.getAllCameraNicknames());
|
||||
fullSettings.put("pipeline", getOrdinalPipeline());
|
||||
fullSettings.put("pipeline", getOrdinalPipeline(currentPipeline.settings.getClass()));
|
||||
fullSettings.put("driverMode", getOrdinalDriver());
|
||||
fullSettings.put("pipelineList", VisionManager.getCurrentCameraPipelineNicknames());
|
||||
fullSettings.put("resolutionList", VisionManager.getCurrentCameraResolutionList());
|
||||
fullSettings.put("FOV", currentCamera.getProperties().FOV);
|
||||
fullSettings.put("port", currentProcess.cameraStreamer.getStreamPort());
|
||||
fullSettings.put("currentPipelineIndex", VisionManager.getCurrentUIVisionProcess().getCurrentPipelineIndex());
|
||||
fullSettings.put("currentCameraIndex", VisionManager.getCurrentUIVisionProcessIndex());
|
||||
|
||||
Reference in New Issue
Block a user