> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kinatric.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Low-level control

> Hand over control, publish D2 motor commands, and inspect HAL command receipts.

Publish D2 `LowCmd_` on `rt/lowcmd`. Both `LowCmd_` and `LowState_` contain 20 motor slots. Legs use D2 order, with hip, thigh, and calf within each leg.

| Slots | Actuators |
| - | - |
| `0–2`, `3–5`, `6–8`, `9–11` | Front right, front left, rear right, rear left legs on D2 and D2W. |
| `12–15` | D2W velocity-controlled wheels in front right, front left, rear right, rear left order. Unused on D2. |
| `16–19` | Unused on both models. |

Use the D2 header `0xFE, 0xEF`, level flag `0xFF`, and SDK CRC. Keep unused slots neutral. The pinned D2 sentinels are `PosStopF = 2.146e9f` and `VelStopF = 16000.0f`. D2W wheel slots require `kp = 0`. Read `rt/kinatric/robot_description` before building targets and use the deployed robot's limits and calibrated gains.

1. Call `ReleaseMode()` from the SDK participant that will publish the low-level stream. Poll `CheckMode()` until `name` is empty.
2. Start the valid `LowCmd_` stream from a single writer. Confirm `controller=external`, the matching `authorization.participant`, and a populated `authorization.low_writer` in `control_state`.
3. To return control, keep the stream running during `SelectMode("normal")` and verify `CheckMode()` reports `name="normal"`. Stop publishing when the handover succeeds.

The repository's `d2_client.py hold` example is a 12-leg-axis hold. It uses a fresh CRC-checked `LowState_` sample for position targets, accepts caller-supplied `--kp`, `--kd`, and `--seconds`, and publishes about every 5 ms. For D2W, use the robot description and a wheel-aware publisher when commanding the wheel axes.

### Motor command receipts

`rt/kinatric/lowcmd_receipt` carries `kinatric::LowCmdReceiptV1`. Join it with `rt/kinatric/external_lowcmd_origin` (`kinatric::ExternalLowCmdOriginV1`) on `owner`, `session_id`, and `tick` to trace an external command selected by the HAL. Origin data includes the participant, writer, grant epoch, and relay source timestamp. Use matching Kinatric generated types on the client and board.

| Receipt outcome | Meaning |
| - | - |
| `RECEIPT_APPLIED` | The HAL send path confirmed all requested actuator writes. |
| `RECEIPT_PARTIAL` | The HAL confirmed only part of the requested writes. |
| `RECEIPT_REJECTED` | The HAL rejected the frame before starting actuator writes. |
| `RECEIPT_UNKNOWN` | Writes started, and the HAL could not determine which axes were sent. |

`requested_mask`, `accepted_mask`, and the `applied` array use D2 slot order. Inspect the corresponding `accepted_mask` bit before reading `applied[i]`. Use joint feedback to verify the resulting motion. HAL timestamps such as `completed_ns` use the board's monotonic clock, while the origin's `relay_source_ns` is a board DDS timestamp.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.