Skip to content

Instantly share code, notes, and snippets.

@PierreExeter
Last active October 11, 2019 09:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PierreExeter/e92a2fce094928529b75964b781c0b14 to your computer and use it in GitHub Desktop.
Save PierreExeter/e92a2fce094928529b75964b781c0b14 to your computer and use it in GitHub Desktop.
import pybullet as p
import time
import pybullet_data
# Start pybullet simulation
p.connect(p.GUI)
# p.connect(p.DIRECT) # don't render
# load urdf file path
p.setAdditionalSearchPath(pybullet_data.getDataPath())
# load urdf and set gravity
p.setGravity(0,0,-10)
planeId = p.loadURDF("plane.urdf")
cubeStartPos = [0,0,1]
cubeStartOrientation = p.getQuaternionFromEuler([0,0,0])
boxId = p.loadURDF("r2d2.urdf", cubeStartPos, cubeStartOrientation)
# step through the simluation
for i in range (10000):
p.stepSimulation()
time.sleep(1./240.)
p.disconnect()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment