Reset network tables on camera rename

This commit is contained in:
Matt
2019-11-30 11:02:10 -08:00
parent 806c8d6968
commit 60721cac36
2 changed files with 9 additions and 1 deletions

View File

@@ -91,6 +91,13 @@ public class VisionProcess {
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) {
ntPipelineEntry = newTable.getEntry("pipeline");
ntDriverModeEntry = newTable.getEntry("driver_mode");