Skip to content

Add RobotHelper, a beginner-friendly utility for robot control in pybullet - #4802

Closed
Meinianda-L wants to merge 2 commits into
bulletphysics:masterfrom
Meinianda-L:add-robot-helper
Closed

Meinianda-L wants to merge 2 commits into
bulletphysics:masterfrom
Meinianda-L:add-robot-helper

Conversation

@Meinianda-L

Copy link
Copy Markdown

Hi! This adds a small helper to pybullet_utils that I kept rewriting in my own scripts, and that I think would lower the barrier for beginners: a RobotHelper class that lets you work with joints by their URDF names instead of indices.

from pybullet_utils.robot_helper import RobotHelper

robot = RobotHelper(robot_id)
robot.joints["head_swivel"].move(1.0)
position = robot.get_joint_position("head_swivel")

What is in it:

  • Joint: move() (position control), set_velocity(), get_position() / get_velocity() / get_torque(), reset(), plus limits / max force / max velocity read from getJointInfo.
  • RobotHelper: builds a joints dict keyed by joint name (fixed joints are skipped), and offers get_joint_position(), get_joint_state(), get_joint_positions(), set_joint_positions({...}).
  • Works with a plain physicsClientId or a BulletClient instance, so multiple parallel simulations are supported.

The change is purely additive: one new module, one unit test file and one demo. No existing code or API is touched.

Testing (pybullet built from this repo with CMake on macOS arm64):

python3 examples/pybullet/unittests/robotHelperTest.py --verbose
# Ran 12 tests ... OK

The demo (pybullet_utils/examples/robotHelperDemo.py) drives an R2D2 in the GUI and falls back to the repo data/ directory when pybullet_data is not installed.

Happy to rename things or move the files if you prefer a different layout.

Adds pybullet_utils.robot_helper with a RobotHelper class that exposes
robot joints by URDF name:

  robot = RobotHelper(robot_id)
  robot.joints["head_swivel"].move(1.0)
  position = robot.get_joint_position("head_swivel")

Includes unit tests (examples/pybullet/unittests/robotHelperTest.py) and
a demo (pybullet_utils/examples/robotHelperDemo.py). Additive change only,
no existing API is modified.
@Meinianda-L Meinianda-L closed this by deleting the head repository Sep 8, 2026
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