mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-29 02:21:41 +00:00
Reset network tables on camera rename
This commit is contained in:
@@ -91,6 +91,13 @@ public class VisionProcess {
|
|||||||
initNT(newTable);
|
initNT(newTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setCameraName(String newName) {
|
||||||
|
var newTable = NetworkTableInstance.getDefault().getTable("/chameleon-vision/" + newName);
|
||||||
|
resetNT(newTable);
|
||||||
|
pipelineManager.renameCurrentPipeline(newName);
|
||||||
|
pipelineManager.ntIndexEntry = ntPipelineEntry;
|
||||||
|
}
|
||||||
|
|
||||||
private void initNT(NetworkTable newTable) {
|
private void initNT(NetworkTable newTable) {
|
||||||
ntPipelineEntry = newTable.getEntry("pipeline");
|
ntPipelineEntry = newTable.getEntry("pipeline");
|
||||||
ntDriverModeEntry = newTable.getEntry("driver_mode");
|
ntDriverModeEntry = newTable.getEntry("driver_mode");
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.chameleonvision.vision.pipeline.CVPipelineSettings;
|
|||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import edu.wpi.first.networktables.NetworkTable;
|
||||||
import io.javalin.websocket.WsBinaryMessageContext;
|
import io.javalin.websocket.WsBinaryMessageContext;
|
||||||
import io.javalin.websocket.WsCloseContext;
|
import io.javalin.websocket.WsCloseContext;
|
||||||
import io.javalin.websocket.WsConnectContext;
|
import io.javalin.websocket.WsConnectContext;
|
||||||
@@ -71,7 +72,7 @@ public class SocketHandler {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "changePipelineName": {
|
case "changePipelineName": {
|
||||||
currentProcess.pipelineManager.renameCurrentPipeline((String) entry.getValue());
|
currentProcess.setCameraName((String) entry.getValue());
|
||||||
sendFullSettings();
|
sendFullSettings();
|
||||||
VisionManager.saveCurrentCameraPipelines();
|
VisionManager.saveCurrentCameraPipelines();
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user