ambroise

10 years 4 months ago

woua amazing i would like to do that

could you give us a tutorial? for to do 

kwatters

10 years 4 months ago

This video shows using the Yaw and Pitch from the Oculus Rift.  Here is a simple  python script to show how to get that information and map it to an InMoov servo.    Basically, create the OculusRift service.  Then in a loop, I poll the values for the yaw and pitch.  The Yaw maps to the inmoov head.rothead servo , and the Pitch maps to the head.neck servo.    I do some minor scaling of the output values so they are scaled in a reasonable range to send to the servos   (servos rotate from 0 - 180 degrees, so I add 90 to the Yaw value to put the center at 90.)    The pitch, I found I needed to amplify the value a little bit to make the neck move up and down.   The InMoov head only has 2 degrees of freedom,  (up/down  & left/right)  so, I omit the "Roll" from the rift.
 

import time
rift = Runtime.createAndStart("rift", "OculusRift")
lloyd = Runtime.createAndStart("lloyd", "InMoov")
# the mega
leftPort = "COM10"
lloyd.startHead(leftPort)
amp=2
for i in range(0,100000):
  sleep(0.1)
  yaw = rift.getYaw() + 90
  pitch = amp*rift.getPitch() + 45
  lloyd.head.rothead.moveTo(int(yaw))
  lloyd.head.neck.moveTo(int(pitch))