IMU to Hydra Sticks
Posted: Tue Apr 19, 2016 7:32 pm
I am trying to use an IMU to emulate hydra analog sticks but it does not seem to work. When I try using the script it looks like it is spinning the stick around for some reason. Also the Y- axis will not work.
Code might be sloppy, but I am new at this.
Thanks for any help!
Code: Select all
def update():
global yaw
yaw = freeImu.yaw
global pitch
pitch = freeImu.pitch
global roll
roll = freeImu.roll
if starting:
centerYaw = 0
centerPitch = 0
centerRoll = 0
yaw = (freeImu.yaw - centerYaw)
pitch = (freeImu.pitch - centerPitch)
roll = (freeImu.roll - centerRoll)
freeImu.update += update
diagnostics.watch(yaw)
diagnostics.watch(pitch)
diagnostics.watch(roll)
hydra[0].joyx = yaw
hydra[0].joyy = roll
if xbox360[0].a:
hydra[0].trigger = 1
if xbox360[0].b:
hydra[1].trigger = 1
Thanks for any help!