@horizon36596/zenith-core 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/NOTICE +18 -0
- package/README.md +16 -0
- package/dist/canonicalize.d.ts +25 -0
- package/dist/canonicalize.d.ts.map +1 -0
- package/dist/canonicalize.js +199 -0
- package/dist/canonicalize.js.map +1 -0
- package/dist/check.d.ts +26 -0
- package/dist/check.d.ts.map +1 -0
- package/dist/check.js +231 -0
- package/dist/check.js.map +1 -0
- package/dist/checks/heading.d.ts +17 -0
- package/dist/checks/heading.d.ts.map +1 -0
- package/dist/checks/heading.js +78 -0
- package/dist/checks/heading.js.map +1 -0
- package/dist/checks/intake.d.ts +28 -0
- package/dist/checks/intake.d.ts.map +1 -0
- package/dist/checks/intake.js +131 -0
- package/dist/checks/intake.js.map +1 -0
- package/dist/checks/motion.d.ts +28 -0
- package/dist/checks/motion.d.ts.map +1 -0
- package/dist/checks/motion.js +252 -0
- package/dist/checks/motion.js.map +1 -0
- package/dist/checks/schedule.d.ts +29 -0
- package/dist/checks/schedule.d.ts.map +1 -0
- package/dist/checks/schedule.js +166 -0
- package/dist/checks/schedule.js.map +1 -0
- package/dist/checks/season.d.ts +6 -0
- package/dist/checks/season.d.ts.map +1 -0
- package/dist/checks/season.js +126 -0
- package/dist/checks/season.js.map +1 -0
- package/dist/continuity.d.ts +38 -0
- package/dist/continuity.d.ts.map +1 -0
- package/dist/continuity.js +69 -0
- package/dist/continuity.js.map +1 -0
- package/dist/diff.d.ts +37 -0
- package/dist/diff.d.ts.map +1 -0
- package/dist/diff.js +258 -0
- package/dist/diff.js.map +1 -0
- package/dist/edit/command.d.ts +4 -0
- package/dist/edit/command.d.ts.map +1 -0
- package/dist/edit/command.js +16 -0
- package/dist/edit/command.js.map +1 -0
- package/dist/edit/errors.d.ts +9 -0
- package/dist/edit/errors.d.ts.map +1 -0
- package/dist/edit/errors.js +12 -0
- package/dist/edit/errors.js.map +1 -0
- package/dist/edit/fields.d.ts +40 -0
- package/dist/edit/fields.d.ts.map +1 -0
- package/dist/edit/fields.js +150 -0
- package/dist/edit/fields.js.map +1 -0
- package/dist/edit/finish.d.ts +15 -0
- package/dist/edit/finish.d.ts.map +1 -0
- package/dist/edit/finish.js +36 -0
- package/dist/edit/finish.js.map +1 -0
- package/dist/edit/groups.d.ts +66 -0
- package/dist/edit/groups.d.ts.map +1 -0
- package/dist/edit/groups.js +277 -0
- package/dist/edit/groups.js.map +1 -0
- package/dist/edit/ids.d.ts +39 -0
- package/dist/edit/ids.d.ts.map +1 -0
- package/dist/edit/ids.js +76 -0
- package/dist/edit/ids.js.map +1 -0
- package/dist/edit/index.d.ts +22 -0
- package/dist/edit/index.d.ts.map +1 -0
- package/dist/edit/index.js +22 -0
- package/dist/edit/index.js.map +1 -0
- package/dist/edit/meta.d.ts +15 -0
- package/dist/edit/meta.d.ts.map +1 -0
- package/dist/edit/meta.js +13 -0
- package/dist/edit/meta.js.map +1 -0
- package/dist/edit/path.d.ts +36 -0
- package/dist/edit/path.d.ts.map +1 -0
- package/dist/edit/path.js +135 -0
- package/dist/edit/path.js.map +1 -0
- package/dist/edit/steps.d.ts +53 -0
- package/dist/edit/steps.d.ts.map +1 -0
- package/dist/edit/steps.js +0 -0
- package/dist/edit/steps.js.map +1 -0
- package/dist/edit/template.d.ts +18 -0
- package/dist/edit/template.d.ts.map +1 -0
- package/dist/edit/template.js +30 -0
- package/dist/edit/template.js.map +1 -0
- package/dist/edit/timing.d.ts +11 -0
- package/dist/edit/timing.d.ts.map +1 -0
- package/dist/edit/timing.js +23 -0
- package/dist/edit/timing.js.map +1 -0
- package/dist/edit/tree.d.ts +32 -0
- package/dist/edit/tree.d.ts.map +1 -0
- package/dist/edit/tree.js +90 -0
- package/dist/edit/tree.js.map +1 -0
- package/dist/estimate.d.ts +48 -0
- package/dist/estimate.d.ts.map +1 -0
- package/dist/estimate.js +443 -0
- package/dist/estimate.js.map +1 -0
- package/dist/findingHelp.d.ts +18 -0
- package/dist/findingHelp.d.ts.map +1 -0
- package/dist/findingHelp.js +114 -0
- package/dist/findingHelp.js.map +1 -0
- package/dist/fix.d.ts +21 -0
- package/dist/fix.d.ts.map +1 -0
- package/dist/fix.js +180 -0
- package/dist/fix.js.map +1 -0
- package/dist/footprint.d.ts +33 -0
- package/dist/footprint.d.ts.map +1 -0
- package/dist/footprint.js +71 -0
- package/dist/footprint.js.map +1 -0
- package/dist/geometry/angle.d.ts +13 -0
- package/dist/geometry/angle.d.ts.map +1 -0
- package/dist/geometry/angle.js +21 -0
- package/dist/geometry/angle.js.map +1 -0
- package/dist/geometry/curve.d.ts +24 -0
- package/dist/geometry/curve.d.ts.map +1 -0
- package/dist/geometry/curve.js +78 -0
- package/dist/geometry/curve.js.map +1 -0
- package/dist/geometry/path.d.ts +29 -0
- package/dist/geometry/path.d.ts.map +1 -0
- package/dist/geometry/path.js +61 -0
- package/dist/geometry/path.js.map +1 -0
- package/dist/geometry/quadrature.d.ts +13 -0
- package/dist/geometry/quadrature.d.ts.map +1 -0
- package/dist/geometry/quadrature.js +57 -0
- package/dist/geometry/quadrature.js.map +1 -0
- package/dist/geometry/sat.d.ts +40 -0
- package/dist/geometry/sat.d.ts.map +1 -0
- package/dist/geometry/sat.js +86 -0
- package/dist/geometry/sat.js.map +1 -0
- package/dist/geometry/vec.d.ts +27 -0
- package/dist/geometry/vec.d.ts.map +1 -0
- package/dist/geometry/vec.js +30 -0
- package/dist/geometry/vec.js.map +1 -0
- package/dist/heading.d.ts +77 -0
- package/dist/heading.d.ts.map +1 -0
- package/dist/heading.js +164 -0
- package/dist/heading.js.map +1 -0
- package/dist/headingRanges.d.ts +48 -0
- package/dist/headingRanges.d.ts.map +1 -0
- package/dist/headingRanges.js +132 -0
- package/dist/headingRanges.js.map +1 -0
- package/dist/index.d.ts +41 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +41 -0
- package/dist/index.js.map +1 -0
- package/dist/kinematics.d.ts +63 -0
- package/dist/kinematics.d.ts.map +1 -0
- package/dist/kinematics.js +71 -0
- package/dist/kinematics.js.map +1 -0
- package/dist/ledger.d.ts +49 -0
- package/dist/ledger.d.ts.map +1 -0
- package/dist/ledger.js +136 -0
- package/dist/ledger.js.map +1 -0
- package/dist/load.d.ts +12 -0
- package/dist/load.d.ts.map +1 -0
- package/dist/load.js +12 -0
- package/dist/load.js.map +1 -0
- package/dist/mirror.d.ts +81 -0
- package/dist/mirror.d.ts.map +1 -0
- package/dist/mirror.js +282 -0
- package/dist/mirror.js.map +1 -0
- package/dist/plan.d.ts +29 -0
- package/dist/plan.d.ts.map +1 -0
- package/dist/plan.js +159 -0
- package/dist/plan.js.map +1 -0
- package/dist/prBody.d.ts +24 -0
- package/dist/prBody.d.ts.map +1 -0
- package/dist/prBody.js +112 -0
- package/dist/prBody.js.map +1 -0
- package/dist/provenance.d.ts +21 -0
- package/dist/provenance.d.ts.map +1 -0
- package/dist/provenance.js +46 -0
- package/dist/provenance.js.map +1 -0
- package/dist/render.d.ts +18 -0
- package/dist/render.d.ts.map +1 -0
- package/dist/render.js +464 -0
- package/dist/render.js.map +1 -0
- package/dist/resolve.d.ts +39 -0
- package/dist/resolve.d.ts.map +1 -0
- package/dist/resolve.js +172 -0
- package/dist/resolve.js.map +1 -0
- package/dist/season.d.ts +65 -0
- package/dist/season.d.ts.map +1 -0
- package/dist/season.js +16 -0
- package/dist/season.js.map +1 -0
- package/dist/sim/commands.d.ts +97 -0
- package/dist/sim/commands.d.ts.map +1 -0
- package/dist/sim/commands.js +185 -0
- package/dist/sim/commands.js.map +1 -0
- package/dist/sim/curves.d.ts +37 -0
- package/dist/sim/curves.d.ts.map +1 -0
- package/dist/sim/curves.js +187 -0
- package/dist/sim/curves.js.map +1 -0
- package/dist/sim/follower.d.ts +124 -0
- package/dist/sim/follower.d.ts.map +1 -0
- package/dist/sim/follower.js +472 -0
- package/dist/sim/follower.js.map +1 -0
- package/dist/sim/ideal.d.ts +103 -0
- package/dist/sim/ideal.d.ts.map +1 -0
- package/dist/sim/ideal.js +393 -0
- package/dist/sim/ideal.js.map +1 -0
- package/dist/sim/index.d.ts +11 -0
- package/dist/sim/index.d.ts.map +1 -0
- package/dist/sim/index.js +10 -0
- package/dist/sim/index.js.map +1 -0
- package/dist/sim/params.d.ts +91 -0
- package/dist/sim/params.d.ts.map +1 -0
- package/dist/sim/params.js +195 -0
- package/dist/sim/params.js.map +1 -0
- package/dist/sim/pedroPath.d.ts +41 -0
- package/dist/sim/pedroPath.d.ts.map +1 -0
- package/dist/sim/pedroPath.js +191 -0
- package/dist/sim/pedroPath.js.map +1 -0
- package/dist/sim/plant.d.ts +59 -0
- package/dist/sim/plant.d.ts.map +1 -0
- package/dist/sim/plant.js +128 -0
- package/dist/sim/plant.js.map +1 -0
- package/dist/sim/residuals.d.ts +36 -0
- package/dist/sim/residuals.d.ts.map +1 -0
- package/dist/sim/residuals.js +86 -0
- package/dist/sim/residuals.js.map +1 -0
- package/dist/sim/simulate.d.ts +27 -0
- package/dist/sim/simulate.d.ts.map +1 -0
- package/dist/sim/simulate.js +924 -0
- package/dist/sim/simulate.js.map +1 -0
- package/dist/sim/types.d.ts +209 -0
- package/dist/sim/types.d.ts.map +1 -0
- package/dist/sim/types.js +2 -0
- package/dist/sim/types.js.map +1 -0
- package/dist/tokens.d.ts +93 -0
- package/dist/tokens.d.ts.map +1 -0
- package/dist/tokens.js +93 -0
- package/dist/tokens.js.map +1 -0
- package/dist/trace.d.ts +89 -0
- package/dist/trace.d.ts.map +1 -0
- package/dist/trace.js +187 -0
- package/dist/trace.js.map +1 -0
- package/dist/types.d.ts +219 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/unimplemented.d.ts +8 -0
- package/dist/unimplemented.d.ts.map +1 -0
- package/dist/unimplemented.js +11 -0
- package/dist/unimplemented.js.map +1 -0
- package/package.json +59 -0
package/dist/trace.js
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The trace file the robot repository's headless sim writes
|
|
3
|
+
* (site/docs/simulation.md), and what can be read off it without knowing
|
|
4
|
+
* anything about a season.
|
|
5
|
+
*
|
|
6
|
+
* It is not one of the five file kinds `@horizon36596/zenith-schema` owns, so the parsing is here and it is
|
|
7
|
+
* deliberately forgiving in one direction only: a key the sim build does not fill yet is absent
|
|
8
|
+
* rather than wrong, and every absent key reads as empty. A key that is present but the wrong
|
|
9
|
+
* shape throws, naming the key, because a trace that is silently half-read would show up as a
|
|
10
|
+
* confident wrong number in the overlay.
|
|
11
|
+
*
|
|
12
|
+
* Pure, like the rest of core: nothing here runs a sim or reads a file.
|
|
13
|
+
*/
|
|
14
|
+
export class TraceError extends Error {
|
|
15
|
+
constructor(message) {
|
|
16
|
+
super(message);
|
|
17
|
+
this.name = "TraceError";
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
21
|
+
const numberAt = (source, key, fallback) => {
|
|
22
|
+
const value = source[key];
|
|
23
|
+
if (value === undefined)
|
|
24
|
+
return fallback;
|
|
25
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
26
|
+
throw new TraceError(`${key} is not a finite number.`);
|
|
27
|
+
}
|
|
28
|
+
return value;
|
|
29
|
+
};
|
|
30
|
+
function poseRow(row, key, at) {
|
|
31
|
+
if (!Array.isArray(row) || row.length < 4) {
|
|
32
|
+
throw new TraceError(`${key}[${String(at)}] is not a [timeS, xIn, yIn, headingRad] row.`);
|
|
33
|
+
}
|
|
34
|
+
const numbers = row.slice(0, 4).map((value) => {
|
|
35
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
36
|
+
throw new TraceError(`${key}[${String(at)}] holds a value that is not a finite number.`);
|
|
37
|
+
}
|
|
38
|
+
return value;
|
|
39
|
+
});
|
|
40
|
+
return [
|
|
41
|
+
numbers[0],
|
|
42
|
+
numbers[1],
|
|
43
|
+
numbers[2],
|
|
44
|
+
numbers[3],
|
|
45
|
+
];
|
|
46
|
+
}
|
|
47
|
+
function poseRows(value, key) {
|
|
48
|
+
if (value === undefined)
|
|
49
|
+
return [];
|
|
50
|
+
if (!Array.isArray(value))
|
|
51
|
+
throw new TraceError(`${key} is not an array.`);
|
|
52
|
+
return value.map((row, at) => poseRow(row, key, at));
|
|
53
|
+
}
|
|
54
|
+
function steps(value) {
|
|
55
|
+
if (value === undefined)
|
|
56
|
+
return [];
|
|
57
|
+
if (!Array.isArray(value))
|
|
58
|
+
throw new TraceError("steps is not an array.");
|
|
59
|
+
return value.map((entry, at) => {
|
|
60
|
+
if (!isRecord(entry))
|
|
61
|
+
throw new TraceError(`steps[${String(at)}] is not an object.`);
|
|
62
|
+
const { id, startS, endS } = entry;
|
|
63
|
+
if (typeof id !== "string" || typeof startS !== "number" || typeof endS !== "number") {
|
|
64
|
+
throw new TraceError(`steps[${String(at)}] needs id, startS and endS.`);
|
|
65
|
+
}
|
|
66
|
+
return { id, startS, endS, interrupted: entry["interrupted"] === true };
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
function contacts(value) {
|
|
70
|
+
if (value === undefined)
|
|
71
|
+
return [];
|
|
72
|
+
if (!Array.isArray(value))
|
|
73
|
+
throw new TraceError("structureContacts is not an array.");
|
|
74
|
+
return value.map((entry, at) => {
|
|
75
|
+
if (!isRecord(entry))
|
|
76
|
+
throw new TraceError(`structureContacts[${String(at)}] is not an object.`);
|
|
77
|
+
const obstacle = entry["obstacle"];
|
|
78
|
+
if (typeof obstacle !== "string") {
|
|
79
|
+
throw new TraceError(`structureContacts[${String(at)}] needs an obstacle name.`);
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
timeS: numberAt(entry, "timeS", 0),
|
|
83
|
+
obstacle,
|
|
84
|
+
penetrationIn: numberAt(entry, "penetrationIn", 0),
|
|
85
|
+
};
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
function ledgerRows(value) {
|
|
89
|
+
if (value === undefined)
|
|
90
|
+
return [];
|
|
91
|
+
if (!Array.isArray(value))
|
|
92
|
+
throw new TraceError("ledger is not an array.");
|
|
93
|
+
return value.map((entry, at) => {
|
|
94
|
+
if (!isRecord(entry))
|
|
95
|
+
throw new TraceError(`ledger[${String(at)}] is not an object.`);
|
|
96
|
+
const tips = entry["tips"];
|
|
97
|
+
const row = { timeS: numberAt(entry, "timeS", 0) };
|
|
98
|
+
if (entry["held"] !== undefined)
|
|
99
|
+
row.held = numberAt(entry, "held", 0);
|
|
100
|
+
if (entry["launches"] !== undefined)
|
|
101
|
+
row.launches = numberAt(entry, "launches", 0);
|
|
102
|
+
if (isRecord(tips)) {
|
|
103
|
+
const counts = {};
|
|
104
|
+
for (const [alliance, count] of Object.entries(tips)) {
|
|
105
|
+
if (typeof count === "number")
|
|
106
|
+
counts[alliance] = count;
|
|
107
|
+
}
|
|
108
|
+
row.tips = counts;
|
|
109
|
+
}
|
|
110
|
+
return row;
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
function events(value) {
|
|
114
|
+
if (value === undefined)
|
|
115
|
+
return [];
|
|
116
|
+
if (!Array.isArray(value))
|
|
117
|
+
throw new TraceError("events is not an array.");
|
|
118
|
+
return value.map((entry, at) => {
|
|
119
|
+
if (!isRecord(entry))
|
|
120
|
+
throw new TraceError(`events[${String(at)}] is not an object.`);
|
|
121
|
+
const kind = entry["kind"];
|
|
122
|
+
if (typeof kind !== "string")
|
|
123
|
+
throw new TraceError(`events[${String(at)}] needs a kind.`);
|
|
124
|
+
const alliance = entry["alliance"];
|
|
125
|
+
return {
|
|
126
|
+
timeS: numberAt(entry, "timeS", 0),
|
|
127
|
+
kind,
|
|
128
|
+
...(typeof alliance === "string" ? { alliance } : {}),
|
|
129
|
+
};
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
/** Parses a trace, naming the first key that is wrong rather than failing silently. */
|
|
133
|
+
export function parseTrace(json) {
|
|
134
|
+
if (!isRecord(json))
|
|
135
|
+
throw new TraceError("A trace file must be a JSON object.");
|
|
136
|
+
if (json["poses"] === undefined)
|
|
137
|
+
throw new TraceError("A trace file needs a poses array.");
|
|
138
|
+
const sha = json["sha"];
|
|
139
|
+
const capabilities = json["capabilities"];
|
|
140
|
+
return {
|
|
141
|
+
formatVersion: numberAt(json, "formatVersion", 1),
|
|
142
|
+
auto: typeof json["auto"] === "string" ? json["auto"] : "",
|
|
143
|
+
sha: typeof sha === "string" ? sha : null,
|
|
144
|
+
simTimeS: numberAt(json, "simTimeS", 0),
|
|
145
|
+
tickS: numberAt(json, "tickS", 0.02),
|
|
146
|
+
capabilities: Array.isArray(capabilities) ? capabilities.map(String) : [],
|
|
147
|
+
steps: steps(json["steps"]),
|
|
148
|
+
poses: poseRows(json["poses"], "poses"),
|
|
149
|
+
truthPoses: poseRows(json["truthPoses"], "truthPoses"),
|
|
150
|
+
structureContacts: contacts(json["structureContacts"]),
|
|
151
|
+
ledger: ledgerRows(json["ledger"]),
|
|
152
|
+
events: events(json["events"]),
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
/** The last recorded time, which is how far a playback scrubber can run on recorded time. */
|
|
156
|
+
export function traceDurationS(trace) {
|
|
157
|
+
const lastPose = trace.poses[trace.poses.length - 1];
|
|
158
|
+
const lastStep = trace.steps[trace.steps.length - 1];
|
|
159
|
+
return Math.max(lastPose?.[0] ?? 0, lastStep?.endS ?? 0);
|
|
160
|
+
}
|
|
161
|
+
/** How long each step actually took, by step id. */
|
|
162
|
+
export function traceStepDurations(trace) {
|
|
163
|
+
const durations = new Map();
|
|
164
|
+
for (const step of trace.steps)
|
|
165
|
+
durations.set(step.id, step.endS - step.startS);
|
|
166
|
+
return durations;
|
|
167
|
+
}
|
|
168
|
+
const MEASURABLE = ["structureContacts", "ledger"];
|
|
169
|
+
export function traceSummary(trace) {
|
|
170
|
+
const tips = {};
|
|
171
|
+
for (const row of trace.ledger) {
|
|
172
|
+
for (const [alliance, count] of Object.entries(row.tips ?? {}))
|
|
173
|
+
tips[alliance] = count;
|
|
174
|
+
}
|
|
175
|
+
const last = trace.ledger[trace.ledger.length - 1];
|
|
176
|
+
return {
|
|
177
|
+
totalS: traceDurationS(trace),
|
|
178
|
+
structureContacts: trace.structureContacts.length,
|
|
179
|
+
launches: trace.ledger.reduce((sum, row) => sum + (row.launches ?? 0), 0),
|
|
180
|
+
tips,
|
|
181
|
+
heldAtEnd: last?.held ?? null,
|
|
182
|
+
inert: trace.capabilities.length === 0
|
|
183
|
+
? []
|
|
184
|
+
: MEASURABLE.filter((capability) => !trace.capabilities.includes(capability)),
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
//# sourceMappingURL=trace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trace.js","sourceRoot":"","sources":["../src/trace.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AA4DH,MAAM,OAAO,UAAW,SAAQ,KAAK;IACnC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;IAC3B,CAAC;CACF;AAED,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAoC,EAAE,CACpE,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAEvE,MAAM,QAAQ,GAAG,CAAC,MAA+B,EAAE,GAAW,EAAE,QAAgB,EAAU,EAAE;IAC1F,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IAC1B,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,QAAQ,CAAC;IACzC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACzD,MAAM,IAAI,UAAU,CAAC,GAAG,GAAG,0BAA0B,CAAC,CAAC;I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,CAAC,CAAC;IACnD,OAAO;QACL,MAAM,EAAE,cAAc,CAAC,KAAK,CAAC;QAC7B,iBAAiB,EAAE,KAAK,CAAC,iBAAiB,CAAC,MAAM;QACjD,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,QAAQ,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC;QACzE,IAAI;QACJ,SAAS,EAAE,IAAI,EAAE,IAAI,IAAI,IAAI;QAC7B,KAAK,EACH,KAAK,CAAC,YAAY,CAAC,MAAM,KAAK,CAAC;YAC7B,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;KAClF,CAAC;AACJ,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import type { Auto, Field, Robot, Step, Waypoints } from "@horizon36596/zenith-schema";
|
|
2
|
+
import type { PathGeometry } from "./geometry/path.js";
|
|
3
|
+
import type { Pose, Vec2 } from "./geometry/vec.js";
|
|
4
|
+
import type { ResolvedSegment } from "./resolve.js";
|
|
5
|
+
/** Every check code of site/docs/checks-and-findings.md. M0 raises a subset. */
|
|
6
|
+
export type FindingCode = "SCHEMA" | "CONTINUITY" | "HEADING_MISSING" | "HEADING" | "HEADING_RANGES" | "PERIMETER" | "STRUCTURE" | "KEEPOUT" | "START_ILLEGAL" | "LEGAL_APPROACH" | "TURRET_RANGE" | "CAPACITY" | "EMPTY_SHOT" | "STRAFE_FRACTION" | "MOUTH_LEADING" | "SWEEP_SPEED" | "TIME_BUDGET" | "TIMEOUT_TIGHT" | "STATIONARY_MARKER" | "MOVES_ROBOT" | "PROVENANCE";
|
|
7
|
+
export type Severity = "error" | "warning" | "info";
|
|
8
|
+
/** What a finding points at on the field, when it points at anything. */
|
|
9
|
+
export interface FindingGeometry {
|
|
10
|
+
pointIn?: Vec2;
|
|
11
|
+
polygonIn?: Vec2[];
|
|
12
|
+
obstacleId?: string;
|
|
13
|
+
zoneId?: string;
|
|
14
|
+
penetrationIn?: number;
|
|
15
|
+
}
|
|
16
|
+
/** The finding shape of site/docs/checks-and-findings.md. */
|
|
17
|
+
export interface Finding {
|
|
18
|
+
severity: Severity;
|
|
19
|
+
stepId: string;
|
|
20
|
+
t?: number;
|
|
21
|
+
code: FindingCode;
|
|
22
|
+
message: string;
|
|
23
|
+
geometry?: FindingGeometry;
|
|
24
|
+
/**
|
|
25
|
+
* The one-click fixes the editor offers on this finding (site/docs/editor.md). Each one is
|
|
26
|
+
* structured, so `applyFix` can carry it out on the document without the editor knowing anything
|
|
27
|
+
* about the check that raised it.
|
|
28
|
+
*/
|
|
29
|
+
fixes?: Fix[];
|
|
30
|
+
}
|
|
31
|
+
/** The five one-click fixes of `05` section 3, as data the editor can apply. */
|
|
32
|
+
export type FixKind = "makeTangent" | "turnAtPreviousStop" | "slowSweep" | "moveToLegalApproach" | "splitSegment";
|
|
33
|
+
interface FixBase {
|
|
34
|
+
/** The step the fix rewrites, which is not always the step the finding points at. */
|
|
35
|
+
stepId: string;
|
|
36
|
+
/** What the button says, in the words a person would use. */
|
|
37
|
+
label: string;
|
|
38
|
+
}
|
|
39
|
+
export type Fix = (FixBase & {
|
|
40
|
+
kind: "makeTangent";
|
|
41
|
+
params: {
|
|
42
|
+
reversed?: boolean;
|
|
43
|
+
};
|
|
44
|
+
}) | (FixBase & {
|
|
45
|
+
kind: "turnAtPreviousStop";
|
|
46
|
+
params: {
|
|
47
|
+
headingRad: number;
|
|
48
|
+
fromRad?: number;
|
|
49
|
+
turnInStepId?: string;
|
|
50
|
+
};
|
|
51
|
+
}) | (FixBase & {
|
|
52
|
+
kind: "slowSweep";
|
|
53
|
+
params: {
|
|
54
|
+
speedFraction: number;
|
|
55
|
+
};
|
|
56
|
+
}) | (FixBase & {
|
|
57
|
+
kind: "moveToLegalApproach";
|
|
58
|
+
params: {
|
|
59
|
+
xIn: number;
|
|
60
|
+
yIn: number;
|
|
61
|
+
headingRad?: number;
|
|
62
|
+
};
|
|
63
|
+
}) | (FixBase & {
|
|
64
|
+
kind: "splitSegment";
|
|
65
|
+
params: {
|
|
66
|
+
segmentIndex: number;
|
|
67
|
+
u?: number;
|
|
68
|
+
};
|
|
69
|
+
});
|
|
70
|
+
/** One place along a path step where the robot's pose and footprint were worked out. */
|
|
71
|
+
export interface PlanSample {
|
|
72
|
+
/** Arc length along this step, in inches. */
|
|
73
|
+
sIn: number;
|
|
74
|
+
/** Arc length normalised over the whole step, in [0, 1]; the same t markers use. */
|
|
75
|
+
t: number;
|
|
76
|
+
pose: Pose;
|
|
77
|
+
/** The expanded footprint, four corners counter-clockwise. */
|
|
78
|
+
footprintIn: Vec2[];
|
|
79
|
+
/** One polygon per mouth in `robot.json`. */
|
|
80
|
+
mouthsIn: Vec2[][];
|
|
81
|
+
}
|
|
82
|
+
export interface PlanStep {
|
|
83
|
+
id: string;
|
|
84
|
+
kind: Step["kind"];
|
|
85
|
+
step: Step;
|
|
86
|
+
startPose: Pose;
|
|
87
|
+
/** Null when the step is a `movesRobot` command, whose end pose nobody can predict. */
|
|
88
|
+
endPose: Pose | null;
|
|
89
|
+
lengthIn: number;
|
|
90
|
+
samples: PlanSample[];
|
|
91
|
+
geometry?: PathGeometry;
|
|
92
|
+
/** The resolved segments of a path step, for the continuity check and the inspector. */
|
|
93
|
+
segments?: ResolvedSegment[];
|
|
94
|
+
/** Parallel and branch steps carry their children here. */
|
|
95
|
+
children?: PlanStep[];
|
|
96
|
+
}
|
|
97
|
+
export interface Plan {
|
|
98
|
+
auto: Auto;
|
|
99
|
+
robot: Robot;
|
|
100
|
+
field: Field;
|
|
101
|
+
startPose: Pose;
|
|
102
|
+
steps: PlanStep[];
|
|
103
|
+
/** Findings raised while resolving and planning: SCHEMA, CONTINUITY, HEADING_MISSING. */
|
|
104
|
+
findings: Finding[];
|
|
105
|
+
}
|
|
106
|
+
/** Per-step timing from the estimate's time model (`estimate.ts`). */
|
|
107
|
+
export interface StepEstimate {
|
|
108
|
+
stepId: string;
|
|
109
|
+
kind: Step["kind"];
|
|
110
|
+
/** Seconds, or null when the step's duration cannot be predicted. */
|
|
111
|
+
nominalS: number | null;
|
|
112
|
+
lowS: number | null;
|
|
113
|
+
highS: number | null;
|
|
114
|
+
/** The share of a path step's arc length driven more sideways than forwards, in [0, 1]. */
|
|
115
|
+
strafeFraction: number | null;
|
|
116
|
+
/** What that sideways driving costs against the same path driven nose-first, in seconds. */
|
|
117
|
+
strafeCostS: number | null;
|
|
118
|
+
/**
|
|
119
|
+
* True when the seconds are not a prediction: either the step has no predictable duration at all
|
|
120
|
+
* (`nominalS` is null and it counts as zero in the total, making the total a lower bound), or it
|
|
121
|
+
* ends on a sensor and `nominalS` is the upper bound of driving the whole path.
|
|
122
|
+
*/
|
|
123
|
+
unknown: boolean;
|
|
124
|
+
/** How fast the robot is still moving as the step ends; the next step accelerates from it. */
|
|
125
|
+
exitVelocityInPerS: number;
|
|
126
|
+
/**
|
|
127
|
+
* For a path step, the cumulative seconds at each of the plan's samples, so a caller can turn a
|
|
128
|
+
* time into a place on the path: the renderer's footprint ghosts and the editor's playback
|
|
129
|
+
* scrubbing both need it, and both would otherwise have to redo the profile.
|
|
130
|
+
*/
|
|
131
|
+
timeAtSampleS?: readonly number[];
|
|
132
|
+
/** Parallel and branch children, in the order they appear in the file. */
|
|
133
|
+
children?: StepEstimate[];
|
|
134
|
+
}
|
|
135
|
+
export interface Estimate {
|
|
136
|
+
steps: StepEstimate[];
|
|
137
|
+
/** Every step including parallel and branch children, by id, for the editor and the checks. */
|
|
138
|
+
byStepId: Readonly<Record<string, StepEstimate>>;
|
|
139
|
+
nominalS: number | null;
|
|
140
|
+
lowS: number | null;
|
|
141
|
+
highS: number | null;
|
|
142
|
+
/** True when at least one step's estimate is `unknown`, so the total is a bound, not a number. */
|
|
143
|
+
hasUnknown: boolean;
|
|
144
|
+
/** The half-width of the band as a fraction of nominal: 0.2 until `07` fits a recorded run. */
|
|
145
|
+
bandFraction: number;
|
|
146
|
+
/** The assumptions behind the numbers, for `zenith estimate --explain`. */
|
|
147
|
+
assumptions: string[];
|
|
148
|
+
/** The same sentences as `assumptions`, under the name `zenith estimate --explain` prints. */
|
|
149
|
+
explain: string[];
|
|
150
|
+
}
|
|
151
|
+
/** One row of the ledger panel and of the pull-request body (site/docs/seasons.md). */
|
|
152
|
+
export interface LedgerRow {
|
|
153
|
+
stepId: string;
|
|
154
|
+
label: string;
|
|
155
|
+
detail?: string;
|
|
156
|
+
holds?: Record<string, number>;
|
|
157
|
+
}
|
|
158
|
+
export interface RenderOptions {
|
|
159
|
+
/** The field's own width in pixels; the picture is wider than this when the ledger is shown. */
|
|
160
|
+
widthPx?: number;
|
|
161
|
+
heightPx?: number;
|
|
162
|
+
/** Draw the routine for this alliance, mirroring it when it is not the one the file is in. */
|
|
163
|
+
alliance?: "RED" | "BLUE";
|
|
164
|
+
showFindings?: boolean;
|
|
165
|
+
showLedger?: boolean;
|
|
166
|
+
/** Seconds of estimated time between footprint ghosts; the default is 0.5. */
|
|
167
|
+
ghostEveryS?: number;
|
|
168
|
+
/** Inches between footprint ghosts when there is no estimate; the default is 12. */
|
|
169
|
+
ghostEveryIn?: number;
|
|
170
|
+
/** A second plan to ghost underneath, for reviewing a change (`06` section 4). */
|
|
171
|
+
base?: Plan;
|
|
172
|
+
/** The named poses to pin, when the caller has them. */
|
|
173
|
+
waypoints?: Waypoints;
|
|
174
|
+
/** Overrides the title in the picture's header. */
|
|
175
|
+
title?: string;
|
|
176
|
+
/**
|
|
177
|
+
* The picture `field.image` names, already read by the caller (core reads no files): an `href`
|
|
178
|
+
* such as a `data:` URI, and the stored image's size in pixels, which a `pxBoundsIn` crop needs.
|
|
179
|
+
* When it is absent, or the field has no image, or a crop is asked for without the size, the
|
|
180
|
+
* field is drawn as vector alone.
|
|
181
|
+
*/
|
|
182
|
+
fieldImage?: {
|
|
183
|
+
href: string;
|
|
184
|
+
widthPx?: number;
|
|
185
|
+
heightPx?: number;
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
export type AutoDiffChangeKind = "added" | "removed" | "changed" | "moved";
|
|
189
|
+
/** How far one pose moved between two versions of a step. */
|
|
190
|
+
export interface PoseDelta {
|
|
191
|
+
/** Where the pose sits in the step, such as `segments[0].to` or `segments[1].control[0]`. */
|
|
192
|
+
where: string;
|
|
193
|
+
dxIn: number;
|
|
194
|
+
dyIn: number;
|
|
195
|
+
/** The short-way heading change, or null when neither version names a heading. */
|
|
196
|
+
dHeadingRad: number | null;
|
|
197
|
+
distanceIn: number;
|
|
198
|
+
}
|
|
199
|
+
export interface AutoDiffChange {
|
|
200
|
+
kind: AutoDiffChangeKind;
|
|
201
|
+
stepId: string;
|
|
202
|
+
/** One sentence naming what happened to this step. */
|
|
203
|
+
summary: string;
|
|
204
|
+
/** For a changed step, the keys that differ, in the schema's own order. */
|
|
205
|
+
fields?: string[];
|
|
206
|
+
/** For a changed path step, how far each pose moved. */
|
|
207
|
+
poseDeltas?: PoseDelta[];
|
|
208
|
+
/** Where the step sat in each version, for a move. */
|
|
209
|
+
fromIndex?: number;
|
|
210
|
+
toIndex?: number;
|
|
211
|
+
}
|
|
212
|
+
export interface AutoDiff {
|
|
213
|
+
changes: AutoDiffChange[];
|
|
214
|
+
/** Keys of the document itself that differ: name, title, description, alliance, start. */
|
|
215
|
+
header: string[];
|
|
216
|
+
identical: boolean;
|
|
217
|
+
}
|
|
218
|
+
export {};
|
|
219
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,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,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACpE;AAED,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AAE3E,6DAA6D;AAC7D,MAAM,WAAW,SAAS;IACxB,6FAA6F;IAC7F,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,kFAAkF;IAClF,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,kBAAkB,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,sDAAsD;IACtD,OAAO,EAAE,MAAM,CAAC;IAChB,2EAA2E;IAC3E,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,wDAAwD;IACxD,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;IACzB,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,QAAQ;IACvB,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,0FAA0F;IAC1F,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;CACpB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thrown by the parts of the core API a later milestone fills in. The signature is exported now so
|
|
3
|
+
* the editor, the CLI and the MCP server can be built against the final shape.
|
|
4
|
+
*/
|
|
5
|
+
export declare class NotImplementedError extends Error {
|
|
6
|
+
constructor(what: string, milestone: string, where: string);
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=unimplemented.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unimplemented.d.ts","sourceRoot":"","sources":["../src/unimplemented.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;gBAChC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;CAI3D"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thrown by the parts of the core API a later milestone fills in. The signature is exported now so
|
|
3
|
+
* the editor, the CLI and the MCP server can be built against the final shape.
|
|
4
|
+
*/
|
|
5
|
+
export class NotImplementedError extends Error {
|
|
6
|
+
constructor(what, milestone, where) {
|
|
7
|
+
super(`${what} is not implemented yet: ${milestone} builds it (${where}).`);
|
|
8
|
+
this.name = "NotImplementedError";
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=unimplemented.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unimplemented.js","sourceRoot":"","sources":["../src/unimplemented.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAC5C,YAAY,IAAY,EAAE,SAAiB,EAAE,KAAa;QACxD,KAAK,CAAC,GAAG,IAAI,4BAA4B,SAAS,eAAe,KAAK,IAAI,CAAC,CAAC;QAC5E,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF"}
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@horizon36596/zenith-core",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "The pure planning core of Zenith: path geometry, heading modes, feasibility checks, time estimates, structural edits, canonical form and SVG render.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"ftc",
|
|
7
|
+
"first-tech-challenge",
|
|
8
|
+
"robotics",
|
|
9
|
+
"autonomous",
|
|
10
|
+
"zenith",
|
|
11
|
+
"path-planning",
|
|
12
|
+
"feasibility",
|
|
13
|
+
"trajectory"
|
|
14
|
+
],
|
|
15
|
+
"homepage": "https://libraries.horizon36596.org/zenith/",
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/Horizon-36596/zenith/issues"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/Horizon-36596/zenith.git",
|
|
22
|
+
"directory": "packages/core"
|
|
23
|
+
},
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"author": "Horizon (FTC 36596)",
|
|
26
|
+
"type": "module",
|
|
27
|
+
"main": "./dist/index.js",
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"types": "./dist/index.d.ts",
|
|
32
|
+
"default": "./dist/index.js"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"files": [
|
|
36
|
+
"dist",
|
|
37
|
+
"!dist/**/*.test.*",
|
|
38
|
+
"!dist/**/*.qa.test.*",
|
|
39
|
+
"!dist/**/testSupport.*",
|
|
40
|
+
"!dist/**/*.tsbuildinfo",
|
|
41
|
+
"!dist/testing",
|
|
42
|
+
"!dist/**/testing.*",
|
|
43
|
+
"README.md",
|
|
44
|
+
"LICENSE",
|
|
45
|
+
"NOTICE"
|
|
46
|
+
],
|
|
47
|
+
"engines": {
|
|
48
|
+
"node": ">=22"
|
|
49
|
+
},
|
|
50
|
+
"publishConfig": {
|
|
51
|
+
"access": "public",
|
|
52
|
+
"provenance": true
|
|
53
|
+
},
|
|
54
|
+
"dependencies": {
|
|
55
|
+
"zod": "^3.25.76",
|
|
56
|
+
"@horizon36596/zenith-schema": "0.1.1"
|
|
57
|
+
},
|
|
58
|
+
"scripts": {}
|
|
59
|
+
}
|