This commit is contained in:
legop3
2026-09-28 23:22:15 -04:00
parent a395656056
commit ba71106544
13 changed files with 300 additions and 204 deletions
@@ -1,5 +1,6 @@
// Match actuator configuration, not a rover's display name or changing telemetry.
const { isDeepStrictEqual } = require('node:util');
const POLICY_VERSION = 3;
function controlProfile(meta = {}) {
return Object.fromEntries(['cameraServo', 'peripherals', 'headlight', 'laser', 'roomba', 'platform']
@@ -7,9 +8,9 @@ function controlProfile(meta = {}) {
}
function compatible(model, record) {
if (model?.specification?.version !== 2 || !record) return false;
if (model?.specification?.version !== POLICY_VERSION || !record) return false;
const profile = controlProfile(record.meta);
return Array.isArray(model.controlProfiles) && model.controlProfiles.some((saved) => isDeepStrictEqual(saved, profile));
}
module.exports = { controlProfile, compatible };
module.exports = { POLICY_VERSION, controlProfile, compatible };