move pybullet examples to Bullet/examples/pybullet/examples

This commit is contained in:
Erwin Coumans
2017-03-29 09:40:56 -07:00
parent 0750d502a8
commit eb8c31ae82
29 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
#python script with hardcoded values, assumes that you run the vr_kuka_setup.py first
import pybullet as p
p.connect(p.SHARED_MEMORY)
pr2_gripper = 2
pr2_cid = 1
CONTROLLER_ID = 0
POSITION=1
ORIENTATION=2
ANALOG=3
BUTTONS=6
gripper_max_joint = 0.550569
while True:
events = p.getVREvents()
for e in (events):
if e[CONTROLLER_ID] == 3: # To make sure we only get the value for one of the remotes
p.changeConstraint(pr2_cid, e[POSITION], e[ORIENTATION], maxForce=500)
p.setJointMotorControl2(pr2_gripper, 0, controlMode=p.POSITION_CONTROL,targetPosition=gripper_max_joint - e[ANALOG] * gripper_max_joint,force=1.0)
p.setJointMotorControl2(pr2_gripper, 2, controlMode=p.POSITION_CONTROL,targetPosition=gripper_max_joint - e[ANALOG] * gripper_max_joint,force=1.1)