Other Formats
nex-ros
A ROS 2 hexapod over the shared state space
Abstract
nex-ros is the app that puts an eighteen-joint hexapod on the shared state space. A Field is declared, an Observation turns it into a posture, and the posture becomes a Fact on the same record as everything else the deployment keeps. The platform is the SpiderPi Pro on Raspberry Pi 5: a vendor controller below, a Raspberry Pi above it, and no ROS 2 in the shipped image, so the ROS 2 tier is the one that makes the projection ours.
What it is
nex-ros is one app of the shared state space, and the robot is the first surface where the projection is visible as motion. Six legs of three joints each make an eighteen-axis coordinate, so a posture is a point and a gait is a path. Every surface of the deployment reads the same record, so a field a person sets, a command a model emits, and a controller’s own answer are the same kind of thing.
The axis the app adds is the machine: a Field that bounds the work, an Observation that turns it into a posture, and a Projection that the legs carry out.
The state space on a robot
| Primitive | On this machine |
|---|---|
| Segment | one joint’s coordinate, six legs by three, so eighteen axes in three families |
| Scheme | a gait pattern with its own coordination rules, such as tripod, wave, or ripple |
| Scheme template | the pattern as a document: a URDF and the gait generator that follows it |
| Field | a mutable predicate over the dynamic terms, payload, slope, speed priority, obstacle proximity |
| Field composition | two Fields intersected, stability and speed, so the gait is emergent rather than averaged |
| Observation | the sensor reading and the person’s input, resolved at one coordinate |
| Projection | the resulting posture, body height, and travelled path |
| Structural isolation | joints do not mutate independently: the Field changes, and the posture is recomputed |
The flow
The lower half is the tier that replaces the vendor’s own stack, and the record is what makes the tier observable: a Field that was declared and a posture that was read are both Facts, so a run is a path through the record rather than a log beside it.
The platform as shipped
The SpiderPi Pro is a Raspberry Pi 5 on Hiwonder’s Debian image, with an STM32 controller board between the Pi and the servos. That middle board decides the hardware interface.
| Layer | What it is |
|---|---|
| Servos | bus servos, driven by the controller rather than by the Pi |
| Controller | answers 0xAA 0x55 Length Function ID Data Checksum packets on /dev/ttyAMA0 at 1 Mbaud |
| Pi | runs the vendor’s Python program: no ROS 2, no URDF, and a compiled gait library |
| Camera | a USB camera read through OpenCV |
| Network | the image raises an access point at 192.168.149.1 and falls back to it when the room’s network drops |
So the hardware interface of the ROS 2 tier speaks the controller’s packet protocol and not the servo bus, which is also why an isolation adapter between the Pi and the bus is not needed here: the controller already is that boundary.
Hiwonder’s own ROS 2 hexapod carries the same board support, 26,022 bytes of it against the 26,094 this platform ships, with the same call names and a different device path. The interface therefore ports rather than being written from nothing.
What the platform does not carry is the gait engine. The projection from a Field to a posture is a compiled extension, and the ROS 2 tier is what replaces it with a generator whose rules are in the tree.
| Item | Specification |
|---|---|
| Degrees of freedom | eighteen, six legs of three, plus a five-joint arm |
| Servos | serial bus servos in the twenty kilogram centimetre class |
| Computer | Raspberry Pi 5, eight gigabytes, with active cooling |
| Sensors | nine-axis IMU, ultrasonic distance, USB camera, and a LiDAR for the navigation tier |
| Power | two-cell pack with a step-up for the servo rail |
Two tiers
The deployment reaches this machine today through two surfaces, and both are part of the app’s shape rather than a way around it.
The controller serves JSON-RPC on 9030 for every method it has, with no token. A gated surface sits in front of it on 8082, takes the same token the camera takes, and forwards to loopback. The command line is pointed at the gated one, so a device has one writer and the vendor’s open port is never the path a command travels.
The record is the second tier’s reason to exist. A Fact is written with a name the writer chooses and the origin it came from, read back by that name, and read by time window scoped to an origin. An observation therefore has three questions answered by the record itself: what was seen, who wrote it, and when it was written in the order it was written.
Demonstrations
Three capabilities show the app, and each is a line rather than a screen.
A Field that is declared and observed. Payload changes, the posture follows, and the axes that did not move are the evidence that the Field moved and the coordinates did not.
A composition of two Fields. Stability and speed are intersected on a slope, and the gait that emerges is not the average of the two, so the composition is structural rather than weighted.
Language as a constraint. A sentence becomes a bound on the navigation Field, the costmap is adjusted, and the path is replanned. The recorded Fact is the path that was walked and not the sentence that asked for it.
What the platform already decides
These are properties of the machine and the vendor’s server, and an app that plans around them saves the discovery.
| Property | Consequence |
|---|---|
GetBusServosPulse answers servos one to six |
arrival is claimable over six axes of twenty-three, and never over the arm |
GetRunningFunc answers a constant |
the controller cannot be asked what it is running |
Move answers when it dispatches |
a success flag is not a completion |
Move of fewer than two cycles is a stop |
a one-cycle step is silently nothing |
RunAction takes a repeat count and ignores it |
a repeated group runs once |
| Speed zero divides by zero inside the controller | the guard belongs above the controller |
| The gait engine is compiled | a projection derived from segments is not claimable until the generator is ours |
The five lines above the last one are why the command surface answers in four outcomes rather than two: a command can be accepted, refused, timed out, or done, and the four are not interchangeable. Accepted is the honest answer for a gait, because a gait has no terminal posture and the read-back covers six servos of twenty-three.