Keep each PyBullet world's body ids on its own Objects - #202
Open
yichao-liang wants to merge 1 commit into
Open
yichao-liang wants to merge 1 commit into
yichao-liang wants to merge 1 commit into
Conversation
This was referenced Oct 3, 2026
Both oracle approaches failed on Coffee with "Failed to get pose for object cup0 (id=12)". Body ids live on Object instances, and the planner's world (the option model's env) simulates states whose Objects belong to the executing env, so PyBulletEnv.simulate and _set_state moved bodies through the executing world's ids. That works only while both worlds number their bodies alike, which holds for bodies built at start-up. Coffee recreates its cups for every state, so the planner moved cup0 by an id its own world did not have, and each world wrote its new cup ids onto the other world's Objects. simulate and _set_state now swap a state's Objects for this world's own Objects of the same name and type, as they already did for public recordings, so each world reads and writes only its own bodies. A test simulates one Coffee world's task in a second world and checks the task's cup ids and cup poses. Coffee now runs with both oracles but does not solve the test task, as the envs README now says.
yichao-liang
force-pushed
the
fix-coffee-own-object-ids
branch
from
October 3, 2026 08:00
ea2d63a to
000eda9
Compare
8 tasks done
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.
Summary
The bug.
Both oracle approaches failed on
pybullet_coffeewithRuntimeError: Failed to get pose for object cup0 (id=12).Body ids live on
Objectinstances.The planner's world (the option model's env) simulates states whose Objects belong to the executing env, so
PyBulletEnv.simulateand_set_statemoved bodies through the executing world's ids.That works only while both worlds number their bodies alike, which holds for bodies built at start-up.
Coffee recreates its cups for every state: in the executing world they ended up as bodies 12 and 11, and the planner moved
cup0by id 12, a body its own world did not have.Coffee also wrote each world's new cup ids onto whichever Objects the state carried, so the worlds overwrote each other's ids.
The fix.
simulateand_set_statenow swap a state's Objects for this world's own Objects of the same name and type (PyBulletEnv._keyed_by_own_objects), which they already did for public recordings.Each world now reads and writes only its own bodies, including the held object's id that
_set_statebuilds the grasp constraint from.The states a world returns are keyed by its own Objects, which compare equal to the caller's.
tests/envs/test_pybullet_coffee.pysimulates one Coffee world's task in a second world, as the planner does, and checks the task's cup ids, the cup poses, and that the first world still resets and steps.Coffee now runs with both oracles but does not solve the test task, as the envs README now says.
Test plan
pybullet_coffeewith both oracle approaches: both run to completion (0/1 solved); both crashed before.GetBasePositionAndOrientation failed.) and passes here.oracle, Grow withoracle_process_planning) and none crashes.Stacked on #201.
🤖 Generated with Claude Code