Skip to content

Pack an arm's state once, for every arm that states the same things - #721

Open
DarksaCY wants to merge 3 commits into
Positronic-Robotics:mainfrom
DarksaCY:packed-state
Open

Pack an arm's state once, for every arm that states the same things#721
DarksaCY wants to merge 3 commits into
Positronic-Robotics:mainfrom
DarksaCY:packed-state

Conversation

@DarksaCY

@DarksaCY DarksaCY commented Sep 8, 2026

Copy link
Copy Markdown

YamState becomes PackedState(n_joints) in positronic/drivers/roboarm/state.py: the joints, their velocities, the end effector pose and the arm's status, in one float32 array.

Five of the six state classes in the repository are that layout with a different joint count -- Kinova 7, SO-101 5, the MuJoCo sim 7, YAM 6, Trossen 6. Only FrankaState differs: it carries a wrench.

The offsets are the instance's, computed from the joint count, and instantiation_params returns that count. Shared memory rebuilds the payload on the far side with data_type(*instantiation_params), so a state that did not name its joint count would come back the wrong size and read another arm's numbers; test_state.py pins that, along with the round trip and the fact that a reading is a copy rather than a view of the buffer that is rewritten every tick.

The YAM is the only driver this changes, and there the change is a rename: python -m positronic.drivers.roboarm.yam --fake passes. Kinova, SO-101 and the sim can adopt it later -- happy to open an issue for that if you want it tracked.

This is one of the changes the Trossen stack recommendations ask for; #683 drops TrossenState for it once this lands.

`YamState` is `PackedState(n_joints)` in `state.py`: the joints, their
velocities, the end effector pose and the status, in one float32 array. Five of
the six state classes in the repository are that layout with a different joint
count, and only the Franka's differs -- it carries a wrench.

The offsets are the instance's, computed from the joint count, and
`instantiation_params` names that count: shared memory rebuilds the payload on
the far side from it, and a state that did not name it would come back the
wrong size. The YAM reads it; `python -m positronic.drivers.roboarm.yam --fake`
passes. Kinova, SO-101 and the MuJoCo sim can follow.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: eb3614d2fc

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread positronic/drivers/roboarm/state.py Outdated
Comment thread positronic/drivers/roboarm/state.py Outdated
`n_joints` was a second copy of what the slices already say, and
`instantiation_params` reads it: one that disagreed with the layout would
rebuild a receiver of another size. It is a property of the layout now.

`_q`, `_dq`, `_ee` and `_status` held slices and an index rather than the
values they name; they say which.
A test that assigns `n_joints` to prove it cannot be assigned needs a
suppression to type-check, which says the same thing twice.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant