Valence
The protocol for motion machines. The machine describes its own controls, and any app can draw them.
Spec v1.0-draft.
Compared to the web
On the web, a server sends a page and any browser can draw it. Valence works the same way for a machine.
- Website
- The machineIts firmware runs a hub that holds the machine's state.
- Browser
- The appPhosphor, a script, a plugin or a hardware remote. Any number can connect at once and stay in sync.
- HTTP and HTML
- ValenceThe wire format, plus the catalog the machine sends to describe itself.
- Server-side checks
- Machine-side limitsThe machine checks every request, whatever the app thinks.
The catalog
A Valence machine sends a catalog: what each setting is, its unit, its range and who may change it. It sends no layout, colors or widget hints.
desc Speed ceiling for manual jogs
unit mm/s
range 1 to 2000
default 50
group Jog limits
A setting added in the firmware shows up in every app the next time it connects, with no app update.
Safety
The machine checks every request, because any client can be wrong: an old version, a buggy plugin or a script with a bad number in it.
- One source of truth
The machine holds the only real state. Apps send requests. The machine clamps each one to its limits and tells every app what it actually did.
- One path to the motor
One component on the machine drives the motor. Every request goes through it.
- 600msDeadman timeout
An app that goes quiet for 600 ms, the default, loses control of motion.
- Anyone can stop it
Even an app that is only watching can stop the machine. Starting it takes control access. The spec puts it this way: "you may always stop the machine; you may not always start it."
- Hardware e-stop
The protocol's stop does not replace a hardware e-stop, which always has the last word.
Access tiers
- Watch
Sees everything and can stop the machine. Needs no pairing.
- Control
Everything Watch can do, and it can move the machine. Needs pairing.
- Configure
Everything Control can do, plus setup and deciding who else gets in. Needs pairing.
The pairing diagram shows how you get each one.
What's in the repo
- The spec
The protocol, in one document, plus the registry that assigns every wire number. CC BY 4.0.
- The library
A C++20 reference implementation. Header-only, no hardware, no dependencies. MIT.
- Clients
A JavaScript client and Valence Connect, a plugin for MultiFunPlayer.
- Valence Bench
A reference hub that runs with no hardware, for testing a client.
- Tools
A wire-level conformance probe, a tracer, a soak tester.
Status: pre-release. The spec is v1.0-draft and changes through RFCs. Wire numbers are not frozen yet. The name "Valence" is reserved for implementations that pass conformance.
Developer docs
Quickstart
Talk to a hub in a few lines.
docsBuild a hub
Make your own machine work with Valence.
docsPlugins
Draw your own controls. Also see Phosphor's plugin contract.
docsThe spec
Rendered, with the source on GitHub.
CC BY 4.0Contributing
How changes land, and the RFC process.
docs
Repo · Docs · Diagrams · All components