Skip to content

Fix pybullet block tipping freeze; add GUI entry points to blocks and cover#31

Merged
yichao-liang merged 1 commit into
masterfrom
worktree-pybullet-env-entrypoints
May 8, 2026
Merged

Fix pybullet block tipping freeze; add GUI entry points to blocks and cover#31
yichao-liang merged 1 commit into
masterfrom
worktree-pybullet-env-entrypoints

Conversation

@yichao-liang
Copy link
Copy Markdown
Collaborator

@yichao-liang yichao-liang commented May 8, 2026

Summary

  • Bugfix: boxes created via create_pybullet_block froze on an edge or corner instead of settling onto a flat face. The helper was applying the env's friction value to lateralFriction, spinningFriction, and rollingFriction. With _obj_friction = 1.2, the spinning/rolling channels supplied a contact torque equal and opposite to gravity's tipping torque, so cubes never tipped over. The helper now applies friction only to lateral; new optional spinning_friction and rolling_friction kwargs default to 0.0 (PyBullet's own defaults).
  • The pybullet_fan ball and pybullet_domino ball do want spinning resistance, so they now pass spinning_friction=... explicitly to preserve prior behavior. Static bodies (mass=0) are unaffected because PyBullet ignores friction torques on zero-mass bodies.
  • Added if __name__ == "__main__": GUI entry points to pybullet_blocks.py and pybullet_cover.py, the only concrete pybullet envs that didn't already have one. Pattern matches pybullet_fan.py / pybullet_balance.py.

Boxes created via `create_pybullet_block` were applying the same
friction coefficient to lateral, spinning, and rolling channels. With
`_obj_friction = 1.2`, a cube that landed on an edge or corner stayed
frozen there: spinning/rolling friction supplied a contact torque equal
and opposite to gravity's tipping torque, so the cube never settled
onto a flat face.

`create_pybullet_block` and `create_pybullet_sphere` now apply
`friction` only to `lateralFriction`. Spinning and rolling friction are
new optional kwargs, defaulting to 0.0 (PyBullet's own defaults). The
fan ball and the domino ball — which actually want resistance to
spinning around the contact normal — now pass `spinning_friction`
explicitly to preserve their prior behavior. Other dynamic bodies
benefit from the fix; static bodies are unaffected because PyBullet
ignores friction torques on zero-mass bodies.

Also add `if __name__ == "__main__":` GUI entry points to
`pybullet_blocks.py` and `pybullet_cover.py` (the only concrete pybullet
envs that lacked one) so they can be launched as scripts the same way
as `pybullet_fan.py`.
@yichao-liang yichao-liang enabled auto-merge (squash) May 8, 2026 13:15
@yichao-liang yichao-liang merged commit 727d3b3 into master May 8, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant