Make human_low_level_control approach work across all pybullet envs#32
Merged
Conversation
The approach previously assumed (a) simulator_state is always the dict PyBulletEnv builds, (b) the robot type exposes x/y/z + tilt/wrist features, and (c) only fan/blocks/coffee/circuit exist. This crashed on pybullet_blocks (list-shaped simulator_state, pose_x/pose_y/pose_z features) and silently fell back to fan's robot for any other env, so IK ran against the wrong base pose. - Tolerate raw-list simulator_state; defer physics_client_id/robot_id lookup into the mobile-base branch where they are actually used. - Read the current EE pose via shadow_robot.forward_kinematics() so the policy is independent of env state-feature names (fixes blocks and cover, the latter being a 2D env with no y feature). Tilt/wrist deltas now apply on top of the FK orientation, preserving roll. - Look up the active PyBulletEnv subclass via the registry and build the shadow robot from a fresh DIRECT client + plane + the env's own _create_pybullet_robot, skipping each subclass's body-loading override (tables/blocks/fans/etc. are not needed for IK). Smoke-tested across all 14 pybullet envs (ants, balance, barrier, blocks, boil, circuit, coffee, cover, fan, float, grow, laser, magic_bin, switch).
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
simulator_stateis always the dict thatPyBulletEnvbuilds, (b) the robot type exposesx/y/z(+ optionallytilt/wrist), and (c) only fan/blocks/coffee/circuit exist. Result: it crashed onpybullet_blocks(list-shapedsimulator_state,pose_x/pose_y/pose_zfeatures) and silently ran IK against fan's base pose for every other env.simulator_state; defer thephysics_client_id/robot_idlookup into the mobile-base branch where they're the only consumer.shadow_robot.forward_kinematics(joint_positions)so the policy is independent of env-specific state feature names. Tilt/wrist deltas now apply on top of the FK orientation, preserving roll. (Fixes blocks and cover — the latter being a 2D env with noyfeature at all.)PyBulletEnvsubclass via theBaseEnvregistry and build the shadow robot from a freshconnect(DIRECT)+ plane + the env's own_create_pybullet_robot. Skips each subclass'sinitialize_pybulletoverride (no need to load tables/blocks/fans/etc. for IK), and avoids the previous fan-only fallback that gave wrong base poses.