Check params shapes when chaining options, and fix Coffee's Twist chain - #206
Open
yichao-liang wants to merge 2 commits into
Open
yichao-liang wants to merge 2 commits into
yichao-liang wants to merge 2 commits into
Conversation
LinearChainParameterizedOption checked that its children share a params space with np.allclose on the bounds, which broadcasts: a child with an empty (0,) space and a child with a (1,) space passed, and so did (1,) and (4,) children with equal scalar bounds. The chain then silently took the first child's space, and the other children received params of the wrong shape. The check now compares the shapes before the bounds and names the mismatched children. A parametrized test covers the broadcast cases and a bounds mismatch.
With coffee_combined_move_and_twist_policy, Twist chains MoveToTwistJug, which takes no params, with TwistJug, which takes a twist amount when coffee_twist_sampler is on (the default). The chain passed its check only because np.allclose broadcast the (0,) and (1,) bounds. Twist took MoveToTwistJug's empty space, its NSRT and process sampled no params, and TwistJug's policy fell back to turning the jug to jug_pickable_rot. The chain now gets a TwistJug with an empty params space, which keeps that behaviour and makes the children agree. A twist amount could not replace it: the PyBullet policy reads the amount as the target angle, bounded to [-1, 1], and jug_pickable_rot is -pi/2. A test runs the Twist process's option on a rotated jug in the reset control mode and checks that JugPickable holds afterwards.
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.
LinearChainParameterizedOptionchecked that its children share a params space withnp.allcloseon the bounds, andnp.allclosebroadcasts.A child with an empty
(0,)space and a child with a(1,)space passed, and so did(1,)and(4,)children with equal scalar bounds.The chain then took the first child's space, and the other children received params of the wrong shape.
The check now compares the shapes before the bounds, and its message names the chain and both children.
The only chain that relied on it is Coffee's combined
Twist, which is built whencoffee_combined_move_and_twist_policyis on andcoffee_use_pixelated_jugis off.It chained
MoveToTwistJug, which takes no params, withTwistJug, which takes a twist amount whencoffee_twist_sampleris on (the default).Twisttook the empty space, its NSRT and its process sampled nothing withnull_sampler, andTwistJug's policy fell back to turning the jug tojug_pickable_rot.The chain now gets a
TwistJugwith an empty params space, which keeps that behaviour and makes the children agree.A
Twistthat took the twist amount could not reach that rotation: the PyBullet policy reads the amount as the target angle, bounded to [-1, 1], whilejug_pickable_rotis -π/2 andJugPickableallows 0.1.The ExoPredicator configs that set
coffee_combined_move_and_twist_policy: Truealso setcoffee_use_pixelated_jug: True, which skips the twist options, so none of them built this chain.Pre-existing problems seen along the way (unchanged here)
positioncontrol mode,MoveToTwistJugdescends onto a rotated jug and knocks it aside, soTwistnever reaches the twisting pose.In
resetmode, the mode the Coffee module docstring uses for twisting runs,Twistturns the jug from 0.52 to -1.67 rad in 36 steps.oracle_process_planningon Coffee with the combinedTwistfails the same way on master and here, first withFailed to get pose for object cup0(Keep each PyBullet world's body ids on its own Objects #202 fixes that).With Keep each PyBullet world's body ids on its own Objects #202's
pybullet_env.pyoverlaid,positionmode runs out of skeletons, andresetmode crashes during the planner's simulation inPyBulletCoffeeEnv._handle_twisting, whereset_jointsgets a joint vector of the wrong length.tests/agent_sdk/test_bilevel_sketch_samplers.py::test_refine_and_validate_report_returns_planfails when its file runs first in a process, on master too; the CFG defaults fixture in Reject wrongly shaped params in ParameterizedOption.ground #205's conftest fixes it.Test plan
(0,)/(1,),(1,)/(0,)and(1,)/(4,)children build without error.The new
test_LinearChainParameterizedOption_params_space_mismatchfails there (three "DID NOT RAISE", and the bounds case raises with no message) and passes here.Twistfails withTwist: child TwistJug has params space Box(-1.0, 1.0, (1,), float32), but MoveToTwistJug has Box([], [], (0,), float32).tests/ground_truth_models/test_coffee_twist.pyruns theTwistprocess's option on a rotated jug and checksJugPickable: it passes on master and here, and fails with the check alone.positionmode, theTwistprocess's option follows the same trajectory on master and here (jug angle 1.0137 after 400 steps on both).On master only Coffee's
Twisthas mismatched children, in the 8 combinations withcoffee_use_pixelated_jug=False,coffee_combined_move_and_twist_policy=Trueandcoffee_twist_sampler=True; here all 97 build.No other chain tripped the check.
least_duration, as the workflow runs them) at 5776c72 in the same container: 2542 passed, none failed.🤖 Generated with Claude Code