Physics simulation for robotics & RL · Bullet SDK in Python · URDF · dynamics · sensors · verified against PyBullet 3.2.x (2026)

PyBullet cheat sheet

PyBullet is the Python binding for the Bullet physics engine — the go-to for robotics prototyping and reinforcement learning. connect() to a physics server, load robots & scenes from URDF/SDF, set gravity, and advance time with stepSimulation(). It does forward/inverse dynamics & kinematics, joint motor control, collision detection, ray casts, and synthetic camera images — all callable as flat p.* functions. Targets PyBullet 3.2.x (stable; low release cadence), Python 3.x.

connect & world loading bodies stepping & control state & sensing rendering, RL & ecosystem gotcha most common

Verified 2026-08-31 against the PyBullet Quickstart Guide & bulletphysics repo (PyBullet 3.2.7 stable; imports as pybullet, usually aliased p). Convention: import pybullet as p + import pybullet_data for the bundled URDFs. Note: releases are infrequent — the API is mature/stable; an pybullet-arm64 fork fixes Apple-Silicon builds.

Outline

Connect, build a world, load bodies, then loop stepSimulation() while you control joints and read state. Cameras & collision feed RL; the debug GUI helps you see it.

Connect & load

  1. 1Install & connect
  2. 2World setup
  3. 3Loading bodies
  4. 4Programmatic shapes

Step & control

  1. 5Stepping the sim
  2. 6Joints & motors
  3. 7Reading state
  4. 8Kinematics & dynamics

Sensing, RL & ecosystem

  1. 9Collision & rays
  2. 10Camera & rendering
  3. 11Debug GUI
  4. 12RL & ecosystem

Connect & Load

Start a physics server, set up the world, and load robots & objects.

1Install & connectGUI vs DIRECT
2World setupgravity & timestep
3Loading bodiesURDF/SDF
4Programmatic shapesno URDF

Step & Control

Advance time, drive joints with motors, and read back the resulting state.

5Stepping the simthe loop
6Joints & motorsactuation
7Reading stateobserve
8Kinematics & dynamicssolvers

Sensing, RL & Ecosystem

Detect contacts, render cameras, debug visually, and connect to RL.

9Collision & rayscontacts
10Camera & renderingsynthetic vision
11Debug GUIsee & tweak
12RL & ecosystemwhere it fits

Worth memorizing

connect(GUI / DIRECT)windowed vs headless
setAdditionalSearchPath(pybullet_data)stock URDFs
setGravity + loadURDF("plane.urdf")world setup
loadURDF -> body idorientations are quaternions
stepSimulation()time only moves when you step
setJointMotorControl2POSITION / VELOCITY / TORQUE
getBasePositionAndOrientationpose = the observation core
getJointState(s)angle / velocity / torque
calculateInverseKinematicstarget pose -> joint angles
getContactPoints / rayTestcollisions / distance sensors
getCameraImagergb + depth + segmentation
reset* / saveStateepisode resets, deterministic