Update XYZBC web simulation evidence
This commit is contained in:
@@ -811,7 +811,8 @@ function resampleAxisPreviewSegments(segments, samplePeriodMs, tool) {
|
||||
const samples = [];
|
||||
let timeMs = 0;
|
||||
let sampleIndex = 0;
|
||||
for (const segment of segments) {
|
||||
for (let segmentIndex = 0; segmentIndex < segments.length; segmentIndex += 1) {
|
||||
const segment = segments[segmentIndex];
|
||||
const durationMs = Math.max(samplePeriodMs, Math.ceil(axisPreviewSegmentDurationMs(segment)));
|
||||
const stepCount = Math.max(1, Math.ceil(durationMs / samplePeriodMs));
|
||||
for (let step = 0; step < stepCount; step += 1) {
|
||||
@@ -819,7 +820,10 @@ function resampleAxisPreviewSegments(segments, samplePeriodMs, tool) {
|
||||
samples.push(pathSampleFromAxisPreviewPose({
|
||||
sampleIndex,
|
||||
timeMs,
|
||||
sourceFile: segment.sourceFile,
|
||||
line: segment.line,
|
||||
statement: segment.statement,
|
||||
segmentIndex,
|
||||
motionType: segment.motionType,
|
||||
activeKinematics: segment.activeKinematics,
|
||||
pose: poseOnAxisPreviewSegment(segment, ratio),
|
||||
@@ -835,7 +839,10 @@ function resampleAxisPreviewSegments(segments, samplePeriodMs, tool) {
|
||||
samples.push(pathSampleFromAxisPreviewPose({
|
||||
sampleIndex,
|
||||
timeMs,
|
||||
sourceFile: last.sourceFile,
|
||||
line: last.line,
|
||||
statement: last.statement,
|
||||
segmentIndex: segments.length - 1,
|
||||
motionType: last.motionType,
|
||||
activeKinematics: last.activeKinematics,
|
||||
pose: poseOnAxisPreviewSegment(last, 1),
|
||||
@@ -876,7 +883,10 @@ function poseOnAxisPreviewSegment(segment, ratio) {
|
||||
function pathSampleFromAxisPreviewPose({
|
||||
sampleIndex,
|
||||
timeMs,
|
||||
sourceFile,
|
||||
line,
|
||||
statement,
|
||||
segmentIndex,
|
||||
motionType,
|
||||
activeKinematics,
|
||||
pose,
|
||||
@@ -893,7 +903,10 @@ function pathSampleFromAxisPreviewPose({
|
||||
return {
|
||||
sampleIndex,
|
||||
timeMs,
|
||||
sourceFile: sourceFile || null,
|
||||
line: Number(line) || 0,
|
||||
statement: statement || "",
|
||||
segmentIndex: Number.isFinite(Number(segmentIndex)) ? Number(segmentIndex) : null,
|
||||
motionType,
|
||||
activeKinematics,
|
||||
tool,
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
const DEFAULT_SDK_MODULE_URL = "../../../../wasm-port/runtime/sdk/src/sim-config-staging.js";
|
||||
const DEFAULT_SDK_MODULE_URLS = [
|
||||
new URL("../../wasm-port/runtime/sdk/src/sim-config-staging.js", import.meta.url).href,
|
||||
new URL("../../../../wasm-port/runtime/sdk/src/sim-config-staging.js", import.meta.url).href,
|
||||
];
|
||||
const DEFAULT_MANIFEST_URLS = [
|
||||
new URL("../../../../wasm-port/tools/source-manifest.txt", import.meta.url).href,
|
||||
new URL("../../wasm-port/tools/source-manifest.txt", import.meta.url).href,
|
||||
@@ -27,14 +30,16 @@ export async function createMachineFileStagingPlan({
|
||||
profile,
|
||||
iniText = null,
|
||||
manifestText = null,
|
||||
sdkModuleUrl = DEFAULT_SDK_MODULE_URL,
|
||||
sdkModuleUrl = null,
|
||||
manifestUrl = null,
|
||||
wasmDir = null,
|
||||
} = {}) {
|
||||
if (!profile?.iniPath) {
|
||||
throw new Error("machine file staging requires a profile with iniPath");
|
||||
}
|
||||
const { planSimConfigStaging } = await import(sdkModuleUrl);
|
||||
const { planSimConfigStaging } = await importFirstAvailableModule(
|
||||
sdkModuleUrl ? [sdkModuleUrl] : DEFAULT_SDK_MODULE_URLS,
|
||||
);
|
||||
const resolvedManifestText = manifestText ?? await readTextFromCandidateUrls(
|
||||
manifestUrl ? [manifestUrl] : DEFAULT_MANIFEST_URLS,
|
||||
);
|
||||
@@ -543,6 +548,18 @@ function sourceOverrideUrlsFor(sourceRel) {
|
||||
return [];
|
||||
}
|
||||
|
||||
async function importFirstAvailableModule(urls) {
|
||||
const errors = [];
|
||||
for (const url of urls) {
|
||||
try {
|
||||
return await import(url);
|
||||
} catch (error) {
|
||||
errors.push(`${url}: ${error instanceof Error ? error.message : String(error)}`);
|
||||
}
|
||||
}
|
||||
throw new Error(`Unable to import machine file staging SDK: ${errors.join(" | ")}`);
|
||||
}
|
||||
|
||||
function basename(path) {
|
||||
return String(path).split("/").filter(Boolean).at(-1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user