vrhand.py first try to connect to SHARED_MEMORY if that fails use GUI fallback

This commit is contained in:
Erwin Coumans
2017-03-01 13:01:02 -08:00
parent 2eb019cdc3
commit ac28f50fa5

View File

@@ -11,6 +11,8 @@ import pybullet as p
#first try to connect to shared memory (VR), if it fails use local GUI #first try to connect to shared memory (VR), if it fails use local GUI
c = p.connect(p.SHARED_MEMORY) c = p.connect(p.SHARED_MEMORY)
if (c<0):
c = p.connect(p.GUI)
#p.resetSimulation() #p.resetSimulation()
p.setGravity(0,0,-10) p.setGravity(0,0,-10)
print(c) print(c)
@@ -51,7 +53,7 @@ def convertSensor(x):
b = (v-minV)/float(maxV-minV) b = (v-minV)/float(maxV-minV)
return (1.0-b) return (1.0-b)
ser = serial.Serial(port='COM3',baudrate=115200,parity=serial.PARITY_ODD,stopbits=serial.STOPBITS_TWO,bytesize=serial.SEVENBITS) ser = serial.Serial(port='COM9',baudrate=115200,parity=serial.PARITY_ODD,stopbits=serial.STOPBITS_TWO,bytesize=serial.SEVENBITS)
if (ser.isOpen()): if (ser.isOpen()):
while True: while True:
events = p.getVREvents() events = p.getVREvents()