Validate simulator motor targets before updating controls - #41
Open
qilinxiaoxiang wants to merge 1 commit into
Open
qilinxiaoxiang wants to merge 1 commit into
qilinxiaoxiang wants to merge 1 commit into
Conversation
Reject malformed and non-finite target frames atomically, including the unmapped mouth slot. Exercise invalid frames, wire mapping, and recovery on a live local TCP connection. Assisted-by: OpenAI Codex
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.
Body.set_targets()writes one actuator at a time. If conversion fails in a later slot, the handler returns an error but earlier motor targets have already changed. NaN and infinity are also accepted; even a valid JSON number such as1e400decodes to infinity in Python.This validates all 15 wire targets before updating
data.ctrl, including the mouth slot that the current model does not actuate. Targets must be a JSON array of finite numbers. Strings, booleans, nulls, nested values, and overflowing numbers are rejected. Valid targets keep the existing name-based wire mapping.The new tests use the actual MuJoCo body model. They check unchanged controls after invalid frames, valid mapping, and a local TCP connection that receives an error and then successfully writes a valid frame. Before the fix, 31 of the first 38 cases failed.
Validation on macOS, Python 3.12, CPU:
uv run --with pytest pytest tests/test_body_server_targets.py -q: 39 passed.uv run --with pytest pytest tests/ -q: 238 passed, 1 skipped.git diff --check: passed.No GPU, policy weights, robot hardware, or credentials are required for these tests. This does not change the protocol, joint limits, actuator physics, or training configuration.