Repository navigation
Add RobotHelper, a beginner-friendly utility for robot control in pybullet - #4802
Closed
Meinianda-L wants to merge 2 commits into
Closed
Meinianda-L wants to merge 2 commits into
Meinianda-L wants to merge 2 commits into
Conversation
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.
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.
Hi! This adds a small helper to
pybullet_utilsthat I kept rewriting in my own scripts, and that I think would lower the barrier for beginners: aRobotHelperclass that lets you work with joints by their URDF names instead of indices.What is in it:
Joint:move()(position control),set_velocity(),get_position()/get_velocity()/get_torque(),reset(), plus limits / max force / max velocity read fromgetJointInfo.RobotHelper: builds ajointsdict keyed by joint name (fixed joints are skipped), and offersget_joint_position(),get_joint_state(),get_joint_positions(),set_joint_positions({...}).physicsClientIdor aBulletClientinstance, 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):
The demo (
pybullet_utils/examples/robotHelperDemo.py) drives an R2D2 in the GUI and falls back to the repodata/directory whenpybullet_datais not installed.Happy to rename things or move the files if you prefer a different layout.