From cad45b9c20b70b6c807380f96426b9264309c1b5 Mon Sep 17 00:00:00 2001 From: Erwin Coumans Date: Sun, 22 Jan 2017 19:48:28 -0800 Subject: [PATCH] add test script to move pr2 controller using pybullet (after initializing the world using vr_kuka_setup.py --- examples/pybullet/vr_kuka_pr2_move.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 examples/pybullet/vr_kuka_pr2_move.py diff --git a/examples/pybullet/vr_kuka_pr2_move.py b/examples/pybullet/vr_kuka_pr2_move.py new file mode 100644 index 000000000..e5a44140c --- /dev/null +++ b/examples/pybullet/vr_kuka_pr2_move.py @@ -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 +BUTTONS=6 + +while True: + events = p.getVREvents() + + for e in (events): + if (e[BUTTONS][33]&p.VR_BUTTON_IS_DOWN): + p.changeConstraint(pr2_cid,e[POSITION],e[ORIENTATION], maxForce=50) + #todo + #p.setJointMotorControl2(pr2_gripper,0) + \ No newline at end of file