From 0905538e70e9a94c48247221ad1c88dd39768c56 Mon Sep 17 00:00:00 2001 From: Langevin Gael Date: Sun, 13 Feb 2022 19:49:01 +0100 Subject: [PATCH] Create InMoov2_LeapMotion.py --- home/hairygael/InMoov2_LeapMotion.py | 34 ++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 home/hairygael/InMoov2_LeapMotion.py diff --git a/home/hairygael/InMoov2_LeapMotion.py b/home/hairygael/InMoov2_LeapMotion.py new file mode 100644 index 00000000..a87e8e93 --- /dev/null +++ b/home/hairygael/InMoov2_LeapMotion.py @@ -0,0 +1,34 @@ +# Leap + InMoov2 hand version MRL Nixie +Platform.setVirtual(False) +i01 = Runtime.createAndStart("i01","InMoov2") +arduino = Runtime.start('arduino', 'Arduino') +arduino.connect("ttyACM0") +i01.startRightHand() +i01.rightHand.startPeers() + +# make sure the pins are set before attaching +i01_rightHand_thumb.setPin("2") +i01_rightHand_index.setPin("3") +i01_rightHand_majeure.setPin("4") +i01_rightHand_ringFinger.setPin("5") +i01_rightHand_pinky.setPin("6") +i01_rightHand_wrist.setPin("7") + +# develop this for each servo mappings +#i01_rightHand_thumb.map(0.0,180.0,0.0,180.0) + +# we set the speed for each servo of the hand +i01.setRightHandSpeed(500,500,500,500,500,500) + +# we attach the the controller +arduino.attach("i01.rightHand.thumb") +arduino.attach("i01.rightHand.index") +arduino.attach("i01.rightHand.majeure") +arduino.attach("i01.rightHand.ringFinger") +arduino.attach("i01.rightHand.pinky") +arduino.attach("i01.rightHand.wrist") +sleep(1) +leap = Runtime.createAndStart("leap","LeapMotion") +leap.startPeers() +leap.addLeapDataListener(i01.rightHand) +leap.startTracking()