🎨 Cleans up gait handling code

This commit is contained in:
Rune Harlyk
2025-09-01 22:23:02 +02:00
committed by Rune Harlyk
parent d7a6bffe0a
commit 54a0419770
12 changed files with 246 additions and 363 deletions
+6 -10
View File
@@ -22,7 +22,10 @@
servoAngles,
mpu,
jointNames,
currentKinematic
currentKinematic,
walkGait,
walkGaits,
walkGaitToMode
} from '$lib/stores'
import {
extractFootColor,
@@ -34,14 +37,7 @@
import { lerp, degToRad } from 'three/src/math/MathUtils'
import { GUI } from 'three/addons/libs/lil-gui.module.min.js'
import { type body_state_t } from '$lib/kinematic'
import {
BezierState,
CalibrationState,
EightPhaseWalkState,
IdleState,
RestState,
StandState
} from '$lib/gait'
import { BezierState, CalibrationState, IdleState, RestState, StandState } from '$lib/gait'
import { radToDeg } from 'three/src/math/MathUtils.js'
import type { URDFRobot } from 'urdf-loader'
import { get } from 'svelte/store'
@@ -78,7 +74,6 @@
[ModesEnum.Calibration]: new CalibrationState(),
[ModesEnum.Rest]: new RestState(),
[ModesEnum.Stand]: new StandState(),
[ModesEnum.Crawl]: new EightPhaseWalkState(),
[ModesEnum.Walk]: new BezierState()
}
let lastTick = performance.now()
@@ -117,6 +112,7 @@
await populateModelCache()
await createScene()
servoAngles.subscribe(updateAnglesFromStore)
walkGait.subscribe(gait => planners[ModesEnum.Walk].set_mode(walkGaitToMode(gait)))
if (panel) createPanel()
})