<reponame>junlileeds/pybullet_tutorial
import pybullet as p
import time
import pybullet_data as pd

physicsClient = p.connect(p.GUI)

p.setAdditionalSearchPath(pd.getDataPath())

p.setGravity(0, 0, -9.81)
planeId = p.loadURDF("plane.urdf")
cubeStartPos = [0, 0, 1]
cubeStartOrientation = p.getQuaternionFromEuler([0, 0, 0])
boxId = p.loadURDF("r2d2.urdf", cubeStartPos, cubeStartOrientation)
cubePos, cubeOrn = p.getBasePositionAndOrientation(boxId)

useRealTimeSimulation = 0

if(useRealTimeSimulation):
    p.setRealTimeSimulation(1)

while 1:
    if(useRealTimeSimulation):
        p.setGravity(0, 0, -9.81)
        time.sleep(0.01)  # Time in seconds
    else:
        p.stepSimulation()
import pybullet as p
import time
import pybullet_data as pd

physicsClient = p.connect(p.GUI)

p.setAdditionalSearchPath(pd.getDataPath())

p.setGravity(0, 0, -9.81)
planeId = p.loadURDF("plane.urdf")
cubeStartPos = [0, 0, 1]
cubeStartOrientation = p.getQuaternionFromEuler([0, 0, 0])
boxId = p.loadURDF("r2d2.urdf", cubeStartPos, cubeStartOrientation)
cubePos, cubeOrn = p.getBasePositionAndOrientation(boxId)

useRealTimeSimulation = 0

if(useRealTimeSimulation):
    p.setRealTimeSimulation(1)

while 1:
    if(useRealTimeSimulation):
        p.setGravity(0, 0, -9.81)
        time.sleep(0.01)  # Time in seconds
    else:
        p.stepSimulation()
# Time in seconds