Wiimote gyro to mouse.delta

Official forum for open source FreePIE discussion and development.
Post Reply
MeteorFalling2
One Eyed Hopeful
Posts: 42
Joined: Thu Dec 08, 2016 10:23 pm

Wiimote gyro to mouse.delta

Post by MeteorFalling2 »

Hi, could someone help me on this problem that I cannot solve?

I am trying to make it so that mouse.deltaX only adds information when I press the wiimote button. It works, but Freepie continues to track the gyroscope data and link it to the mouse.delta movements the entire time the script is running. This causes the cursor to jump into existence wherever I am pointing the wiimote and pressing the button. Instead, I want the cursor to track from it's resting spot when the wiimote button was last pressed.

I'm essentially trying to make my wiimote act like a mouse where releasing "A" is similar to lifting a mouse into the air.

Here is the code that I have been working with: :woot

Code: Select all

	
if wiimote[0].buttons.button_down(WiimoteButtons.A):
     mouse.deltaX = filters.deadband(filters.delta(wiimote[0].ahrs.yaw), 0.1) * 25
     mouse.deltaY = filters.deadband(filters.delta(wiimote[0].ahrs.pitch), 0.1) * 25
MeteorFalling2
One Eyed Hopeful
Posts: 42
Joined: Thu Dec 08, 2016 10:23 pm

Re: Wiimote gyro to mouse.delta

Post by MeteorFalling2 »

I think I found the solution. I don't know why this script works better. It appears to me to be saying the exact same thing. but.... it no longer registers shadow movement written this way. Multiply is written as 20 in if started argument.

Code: Select all

def update():
    yaw = wiimote[0].ahrs.yaw
    pitch = wiimote[0].ahrs.pitch

    deltaYaw = -filters.deadband((filters.delta(yaw)), 0.1)
    deltaPitch = -filters.deadband((filters.delta(pitch)), 0.1)   
     
    if wiimote[0].buttons.button_down(WiimoteButtons.A): 
        mouse.deltaX = deltaYaw*multiply
        mouse.deltaY = -deltaPitch*multiply
MeteorFalling2
One Eyed Hopeful
Posts: 42
Joined: Thu Dec 08, 2016 10:23 pm

Re: Wiimote gyro to mouse.delta

Post by MeteorFalling2 »

The solution does not work well. I ended up using wiimote motionplus data instead which had slightly better results. Unfortunately, they both don't work well in high speed. I have yet to figure out how to get GlovePIE level of smoothness for the mouse movements.
Post Reply

Return to “FreePIE”