IMU to Hydra Sticks

Official forum for open source FreePIE discussion and development.
Post Reply
Cftech
One Eyed Hopeful
Posts: 1
Joined: Tue Apr 19, 2016 7:21 pm

IMU to Hydra Sticks

Post by Cftech »

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: 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
Code might be sloppy, but I am new at this.

Thanks for any help!
Post Reply

Return to “FreePIE”