From 1a0f91d98d42079befb7a212dda1ec4abc7f7a3a Mon Sep 17 00:00:00 2001
From: Matt Lui <92664603+superyuuki@users.noreply.github.com>
Date: Sun, 28 Jan 2024 16:00:56 -0700
Subject: [PATCH] new override files
---
mattlib2-api/pom.xml | 2 +-
.../xyz/auriium/mattlib2/MattlibSettings.java | 6 ++++
mattlib2-auto-wpi/pom.xml | 4 +--
mattlib2-auto/pom.xml | 6 ++--
mattlib2-foxe-ext/package-lock.json | 28 ++++++++---------
mattlib2-hardware/pom.xml | 4 +--
mattlib2-log-foxe/pom.xml | 4 +--
mattlib2-log-nt/pom.xml | 4 +--
.../xyz/auriium/mattlib2/nt/NTMattLog.java | 30 ++++++++++++++-----
mattlib2-rev/pom.xml | 6 ++--
mattlib2-sim/pom.xml | 4 +--
pom.xml | 2 +-
12 files changed, 60 insertions(+), 40 deletions(-)
diff --git a/mattlib2-api/pom.xml b/mattlib2-api/pom.xml
index f843c36..e163d4e 100644
--- a/mattlib2-api/pom.xml
+++ b/mattlib2-api/pom.xml
@@ -5,7 +5,7 @@
mattlib2
xyz.auriium
- 1.3.12-SNAPSHOT
+ 1.3.13-SNAPSHOT
4.0.0
diff --git a/mattlib2-api/src/main/java/xyz/auriium/mattlib2/MattlibSettings.java b/mattlib2-api/src/main/java/xyz/auriium/mattlib2/MattlibSettings.java
index 8091e5b..548e7e7 100644
--- a/mattlib2-api/src/main/java/xyz/auriium/mattlib2/MattlibSettings.java
+++ b/mattlib2-api/src/main/java/xyz/auriium/mattlib2/MattlibSettings.java
@@ -2,10 +2,16 @@
public class MattlibSettings {
+ public enum Robot {
+ MCR,
+ CARY
+ }
+
/**
* Set this to false to kill logging
*/
public static boolean USE_LOGGING = true;
+ public static Robot ROBOT = Robot.CARY;
}
diff --git a/mattlib2-auto-wpi/pom.xml b/mattlib2-auto-wpi/pom.xml
index 9d2a8bc..0c595eb 100644
--- a/mattlib2-auto-wpi/pom.xml
+++ b/mattlib2-auto-wpi/pom.xml
@@ -5,7 +5,7 @@
mattlib2
xyz.auriium
- 1.3.12-SNAPSHOT
+ 1.3.13-SNAPSHOT
4.0.0
@@ -21,7 +21,7 @@
xyz.auriium
mattlib2-auto
- 1.3.12-SNAPSHOT
+ 1.3.13-SNAPSHOT
edu.wpi.first.wpilibNewCommands
diff --git a/mattlib2-auto/pom.xml b/mattlib2-auto/pom.xml
index 609819e..4050255 100644
--- a/mattlib2-auto/pom.xml
+++ b/mattlib2-auto/pom.xml
@@ -5,7 +5,7 @@
mattlib2
xyz.auriium
- 1.3.12-SNAPSHOT
+ 1.3.13-SNAPSHOT
4.0.0
@@ -26,12 +26,12 @@
xyz.auriium
mattlib2-api
- 1.3.12-SNAPSHOT
+ 1.3.13-SNAPSHOT
xyz.auriium
mattlib2-hardware
- 1.3.12-SNAPSHOT
+ 1.3.13-SNAPSHOT
diff --git a/mattlib2-foxe-ext/package-lock.json b/mattlib2-foxe-ext/package-lock.json
index e8215d4..df517af 100644
--- a/mattlib2-foxe-ext/package-lock.json
+++ b/mattlib2-foxe-ext/package-lock.json
@@ -339,7 +339,7 @@
"@nodelib/fs.stat": "^2.0.2",
"@nodelib/fs.walk": "^1.2.3",
"glob-parent": "^5.1.2",
- "merge2": "^1.3.12-SNAPSHOT",
+ "merge2": "^1.3.13-SNAPSHOT",
"micromatch": "^4.0.4"
},
"engines": {
@@ -691,7 +691,7 @@
"@nodelib/fs.stat": "^2.0.2",
"@nodelib/fs.walk": "^1.2.3",
"glob-parent": "^5.1.2",
- "merge2": "^1.3.12-SNAPSHOT",
+ "merge2": "^1.3.13-SNAPSHOT",
"micromatch": "^4.0.4"
},
"engines": {
@@ -1136,7 +1136,7 @@
"@nodelib/fs.stat": "^2.0.2",
"@nodelib/fs.walk": "^1.2.3",
"glob-parent": "^5.1.2",
- "merge2": "^1.3.12-SNAPSHOT",
+ "merge2": "^1.3.13-SNAPSHOT",
"micromatch": "^4.0.4"
},
"engines": {
@@ -1558,7 +1558,7 @@
"@nodelib/fs.stat": "^2.0.2",
"@nodelib/fs.walk": "^1.2.3",
"glob-parent": "^5.1.2",
- "merge2": "^1.3.12-SNAPSHOT",
+ "merge2": "^1.3.13-SNAPSHOT",
"micromatch": "^4.0.4"
},
"engines": {
@@ -4391,7 +4391,7 @@
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^3.1.1",
- "once": "^1.3.12-SNAPSHOT",
+ "once": "^1.3.13-SNAPSHOT",
"path-is-absolute": "^1.0.0"
},
"engines": {
@@ -4432,7 +4432,7 @@
"integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==",
"dev": true,
"dependencies": {
- "once": "^1.3.12-SNAPSHOT",
+ "once": "^1.3.13-SNAPSHOT",
"wrappy": "1"
}
},
@@ -5729,8 +5729,8 @@
}
},
"node_modules/eslint-plugin-es/node_modules/eslint-visitor-keys": {
- "version": "1.3.12-SNAPSHOT",
- "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.12-SNAPSHOT.tgz",
+ "version": "1.3.13-SNAPSHOT",
+ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.13-SNAPSHOT.tgz",
"integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==",
"dev": true,
"engines": {
@@ -7162,7 +7162,7 @@
"@nodelib/fs.stat": "^2.0.2",
"@nodelib/fs.walk": "^1.2.3",
"glob-parent": "^5.1.2",
- "merge2": "^1.3.12-SNAPSHOT",
+ "merge2": "^1.3.13-SNAPSHOT",
"micromatch": "^4.0.4"
},
"engines": {
@@ -7585,8 +7585,8 @@
}
},
"node_modules/eslint-plugin-prettier/node_modules/fast-diff": {
- "version": "1.3.12-SNAPSHOT",
- "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.3.12-SNAPSHOT.tgz",
+ "version": "1.3.13-SNAPSHOT",
+ "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.3.13-SNAPSHOT.tgz",
"integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==",
"dev": true
},
@@ -7599,7 +7599,7 @@
"@nodelib/fs.stat": "^2.0.2",
"@nodelib/fs.walk": "^1.2.3",
"glob-parent": "^5.1.2",
- "merge2": "^1.3.12-SNAPSHOT",
+ "merge2": "^1.3.13-SNAPSHOT",
"micromatch": "^4.0.4"
},
"engines": {
@@ -8739,7 +8739,7 @@
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^3.1.1",
- "once": "^1.3.12-SNAPSHOT",
+ "once": "^1.3.13-SNAPSHOT",
"path-is-absolute": "^1.0.0"
},
"engines": {
@@ -8816,7 +8816,7 @@
"integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==",
"dev": true,
"dependencies": {
- "once": "^1.3.12-SNAPSHOT",
+ "once": "^1.3.13-SNAPSHOT",
"wrappy": "1"
}
},
diff --git a/mattlib2-hardware/pom.xml b/mattlib2-hardware/pom.xml
index 16a6733..7a519cf 100644
--- a/mattlib2-hardware/pom.xml
+++ b/mattlib2-hardware/pom.xml
@@ -5,7 +5,7 @@
mattlib2
xyz.auriium
- 1.3.12-SNAPSHOT
+ 1.3.13-SNAPSHOT
4.0.0
@@ -21,7 +21,7 @@
xyz.auriium
mattlib2-api
- 1.3.12-SNAPSHOT
+ 1.3.13-SNAPSHOT
xyz.auriium
diff --git a/mattlib2-log-foxe/pom.xml b/mattlib2-log-foxe/pom.xml
index 41bbccd..9cdecef 100644
--- a/mattlib2-log-foxe/pom.xml
+++ b/mattlib2-log-foxe/pom.xml
@@ -5,7 +5,7 @@
mattlib2
xyz.auriium
- 1.3.12-SNAPSHOT
+ 1.3.13-SNAPSHOT
4.0.0
@@ -41,7 +41,7 @@
xyz.auriium
mattlib2-api
- 1.3.12-SNAPSHOT
+ 1.3.13-SNAPSHOT
diff --git a/mattlib2-log-nt/pom.xml b/mattlib2-log-nt/pom.xml
index 20a7e43..b1c3dc4 100644
--- a/mattlib2-log-nt/pom.xml
+++ b/mattlib2-log-nt/pom.xml
@@ -5,7 +5,7 @@
mattlib2
xyz.auriium
- 1.3.12-SNAPSHOT
+ 1.3.13-SNAPSHOT
4.0.0
@@ -21,7 +21,7 @@
xyz.auriium
mattlib2-api
- 1.3.12-SNAPSHOT
+ 1.3.13-SNAPSHOT
edu.wpi.first.ntcore
diff --git a/mattlib2-log-nt/src/main/java/xyz/auriium/mattlib2/nt/NTMattLog.java b/mattlib2-log-nt/src/main/java/xyz/auriium/mattlib2/nt/NTMattLog.java
index 9a56dfb..3bf6bbb 100644
--- a/mattlib2-log-nt/src/main/java/xyz/auriium/mattlib2/nt/NTMattLog.java
+++ b/mattlib2-log-nt/src/main/java/xyz/auriium/mattlib2/nt/NTMattLog.java
@@ -5,7 +5,6 @@
import edu.wpi.first.wpilibj.RobotBase;
import net.bytebuddy.ByteBuddy;
import net.bytebuddy.description.ByteCodeElement;
-import net.bytebuddy.description.type.TypeDefinition;
import net.bytebuddy.description.type.TypeDescription;
import net.bytebuddy.dynamic.DynamicType;
import net.bytebuddy.dynamic.loading.ClassLoadingStrategy;
@@ -13,10 +12,7 @@
import net.bytebuddy.jar.asm.Opcodes;
import net.bytebuddy.matcher.ElementMatcher;
import net.bytebuddy.matcher.ElementMatchers;
-import xyz.auriium.mattlib2.Exceptions;
-import xyz.auriium.mattlib2.IMattLog;
-import xyz.auriium.mattlib2.IPeriodicLooped;
-import xyz.auriium.mattlib2.Mattlib2Exception;
+import xyz.auriium.mattlib2.*;
import xyz.auriium.mattlib2.log.INetworkedComponent;
import xyz.auriium.mattlib2.log.ProcessMap;
import xyz.auriium.mattlib2.log.ProcessPath;
@@ -26,7 +22,6 @@
import yuukonfig.core.YuuKonfig;
import yuukonfig.core.impl.safe.HandlesPrimitiveManipulator;
import yuukonfig.core.impl.safe.HandlesSafeManipulator;
-import yuukonfig.core.impl.safe.ManipulatorSafe;
import java.io.File;
import java.io.IOException;
@@ -34,7 +29,6 @@
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CompletableFuture;
-import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
@@ -71,10 +65,15 @@ public void preInit() {
String load = "config.toml";
String sim = "sim.toml";
+ String cary = "cary.toml";
+ String mcr = "mcr.toml";
var conf_dir = new File(Filesystem.getDeployDirectory(), "mattlib");
var conf_file = new File(conf_dir, load);
var sim_file = new File(conf_dir, sim);
+ var cary_file = new File(conf_dir, cary);
+ var mcr_file = new File(conf_dir, mcr);
+
boolean isSim = RobotBase.isSimulation();
boolean shouldDoFunnyOverwriteOfFile = false;
@@ -91,6 +90,8 @@ public void preInit() {
if (!sim_file.exists()) {
throw Exceptions.MATTLIB_FILE_EXCEPTION(sim);
}
+ if (!cary_file.exists()) throw Exceptions.MATTLIB_FILE_EXCEPTION(cary);
+ if (!mcr_file.exists()) throw Exceptions.MATTLIB_FILE_EXCEPTION(mcr);
//System.out.println("has read: " + traj_file.canRead() + " has write: " + traj_file.canWrite());
@@ -126,7 +127,20 @@ public void preInit() {
.overrideMainConfigFromFile(sim_file.toPath())
.loadToMemoryConfig();
} else {
- map = loader.loadOnlyUser().loadToMemoryConfig();
+ var contentBridge = loader.loadOnlyUser();
+
+ if (MattlibSettings.ROBOT == MattlibSettings.Robot.CARY) {
+ map = contentBridge
+ .overrideMainConfigFromFile(cary_file.toPath())
+ .loadToMemoryConfig();
+ } else if (MattlibSettings.ROBOT == MattlibSettings.Robot.MCR) {
+ map = contentBridge
+ .overrideMainConfigFromFile(mcr_file.toPath())
+ .loadToMemoryConfig();
+ } else {
+ map = contentBridge.loadToMemoryConfig();
+ }
+
}
for (LoadStruct> struct : structs) {
diff --git a/mattlib2-rev/pom.xml b/mattlib2-rev/pom.xml
index 46129ca..764ec1d 100644
--- a/mattlib2-rev/pom.xml
+++ b/mattlib2-rev/pom.xml
@@ -5,7 +5,7 @@
mattlib2
xyz.auriium
- 1.3.12-SNAPSHOT
+ 1.3.13-SNAPSHOT
4.0.0
@@ -28,12 +28,12 @@
xyz.auriium
mattlib2-api
- 1.3.12-SNAPSHOT
+ 1.3.13-SNAPSHOT
xyz.auriium
mattlib2-hardware
- 1.3.12-SNAPSHOT
+ 1.3.13-SNAPSHOT
com.revrobotics.frc
diff --git a/mattlib2-sim/pom.xml b/mattlib2-sim/pom.xml
index 0f2025d..0fab91e 100644
--- a/mattlib2-sim/pom.xml
+++ b/mattlib2-sim/pom.xml
@@ -5,7 +5,7 @@
mattlib2
xyz.auriium
- 1.3.12-SNAPSHOT
+ 1.3.13-SNAPSHOT
4.0.0
@@ -21,7 +21,7 @@
xyz.auriium
mattlib2-hardware
- 1.3.12-SNAPSHOT
+ 1.3.13-SNAPSHOT
edu.wpi.first.wpilibj
diff --git a/pom.xml b/pom.xml
index 43f7ee7..736192e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,7 +7,7 @@
xyz.auriium
mattlib2
pom
- 1.3.12-SNAPSHOT
+ 1.3.13-SNAPSHOT
mattlib2-api
mattlib2-rev