Repository navigation
feat(sim-control): expose sim.get_joint_state so callers can read back the pose - #8
Merged
Merged
Conversation
…k the pose The endpoint only offered `get_robot_info` (static descriptor) and `reset`. A caller that aborts a motion, or that wants to verify where the arm actually is, had no way to read the measured joint state -- the simulator publishes `JointState` on `mujoco/proprio_state`, but nothing in this node subscribed to it, so failures were only diagnosable by inferring from the next motion. * new `joint_state` dora input caches the newest `JointState` (`state.py`, `JointStateCache`) with its arrival timestamp; * new `sim.control/get_joint_state` **query** operation returns `name`, `position`, `velocity`, `effort` and `age_ms`; * the query fails with `NO_FRESH_ROBOT_STATE` when no sample arrived or the newest is older than `joint_state_timeout_ms` (new config key, default 200 ms, matching the 50 Hz publish rate), so a stale pose is never reported as current; * `TOOL_CONTRACTS.md` / `README.md` document the new operation and dora port. Tests: cache freshness (fresh, stale, empty), the query through the endpoint, the same query through the dora binding, the `joint_state` input path, and config parsing. 74 tests pass for the package.
This was referenced Nov 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
sim.controlexposedget_robot_info(static descriptor) andresetonly. Nothing in the node subscribed tomujoco/proprio_state, so there was no way to read back the measured joint state through the Tool API: after an aborted motion, a timeout, or a reset, a caller could not tell where the arm actually is, and had to infer the pose from the next motion or from simulator logs.Change
joint_state(mujoco/proprio_state), cached with arrival timestamp instate.py(JointStateCache)sim.control/get_joint_state(query)name,position,velocity,effort,age_msNO_FRESH_ROBOT_STATEwhen no sample arrived or the newest is older thanjoint_state_timeout_msjoint_state_timeout_ms(default 200 ms, matching the 50 Hz publish rate)TOOL_CONTRACTS.mdoperations table + operation section,README.mddora wiringDesign notes:
age_msplus a stale error) instead of returning whatever was last seen, because a stale pose read as current is worse than no pose;Tests
packages/.../tests— 74 passed:test_joint_state_query_returns_the_cached_sample(fresh sample +age_ms);test_joint_state_query_rejects_a_stale_sample→NO_FRESH_ROBOT_STATE;test_joint_state_query_without_any_sample_is_not_fresh;test_joint_state_query_flows_through_binding(full envelope round-trip);test_joint_state_input_updates_the_cache(dora input dispatch);test_joint_state_timeout_defaults_and_validation(config parsing, rejects0/-1/True/"200");Compatibility
joint_stateinput wired: the query then answersNO_FRESH_ROBOT_STATEinstead of failing at startup;forge_msgs.