I'm trying to repurpose the existing 3D rendering infrastructure that pyBullet provides. Here's what I'm trying to do so far:
I'm currently looking into the saveBullet() and restoreState() methods to do this (spawning only 1 worker server for simplicity):
Code: Select all
import pybullet_utils.bullet_client as bc
import pybullet as p
import pybullet_data
import time
STATE_FILE = 'state.bullet'
def setupServer(handle):
    handle.setAdditionalSearchPath(pybullet_data.getDataPath())
    handle.setPhysicsEngineParameter(deterministicOverlappingPairs=1)
    startOrientation = handle.getQuaternionFromEuler([0, 0, 0])
    handle.loadURDF("r2d2.urdf", [0, 0, 1], startOrientation)
    handle.loadURDF("plane.urdf")
    handle.setGravity(0, 0, -10)
p1 = bc.BulletClient(connection_mode=p.DIRECT)
setupServer(p1)
pgui = bc.BulletClient(connection_mode=p.GUI)
#setupServer(pgui)
while 1:
    p1.stepSimulation()
    p1.saveBullet(STATE_FILE)
    pgui.restoreState(fileName=STATE_FILE)
    pgui.stepSimulation()
    time.sleep(1. / 240.)
Code: Select all
Traceback (most recent call last):
  File "C:\Users\m84241864\Desktop\projects\bullet\python\multi_server.py", line 43, in <module>
    pgui.restoreState(fileName=STATE_FILE)
pybullet.error: Couldn't restore state.