Motion language
Skill ferret-motion · download all skills · SKILL.md
When to use#
Anything that has to happen over time without a hand-written state machine: a stroke (force for 0.4 s while another thing waits), a door cycle, a patrol pause, a gust pattern.
Steps#
new MotionRuntime({ seed, budget }); add words withdefine(name, fn)(instant) andaction(name, { start })(a hold: its arguments are read every step).- Write programs as text (
(seq (wait 0.4s) (emit "done"))) or as the JSON tree (symbols are strings, literals{ "s": "..." });rt.load(text, file)checks them. rt.run(mod, form, params)andrt.tick(dt)every fixed step; feed withp.set,p.trigger,rt.deliver.- Time forms:
wait,wait-until,wait-event; structure:seq par race for while guard repeat loop on states; units30rpm 90deg 0.4sfold at read.
Check afterwards#
p.state() shows what each thread waits for; motion:error carries file, line and form; p.snapshot() then rt.restore(...) continues the same run.
What usually goes wrong#
- A loop without
waithits the budget: add a wait or an event. - A
defnor lambda cannot wait or hold: usedefmotionfor anything that lasts. - An action inside a calculation (
(+ 1 (force …))) is an error: actions are statements. stateswith:untilstays until the condition; without it the state ends when its body does.(param x)takes the name, not a value; an unbound symbol is just a name.
Files#
reference/motion.md— physics/motion.mdreference/api-motion.md— every export of@ferret/motionwith signature and doc comment