Can't see any values change on watch...

Official forum for open source FreePIE discussion and development.
Post Reply
wilee98
One Eyed Hopeful
Posts: 13
Joined: Sat Jul 19, 2014 2:11 pm

Can't see any values change on watch...

Post by wilee98 »

Ok I used https://github.com/mdjarv/arduinoheadtracker and used the freepie script, but it never shows any values. Any help would be nice script looks ok to me, plus any help would be greatfull


# Watch input and output values
DEBUG = True

# Output mode### CONFIGURATION ###

OUTPUT_FREETRACK = False
OUTPUT_TRACKIR = True

# Keybindings
KEY_CENTER = Key.Pause # Center orientation to current position


# Calibration multipliers
TRACKIR_MULTIPLIER = 10
FREETRACK_MULTIPLIER = 0.001

### THE CODE ###

def update():
global yaw
yaw = freeImu.yaw
global pitch
pitch = freeImu.pitch
global roll
roll = freeImu.roll

def updateTrackIR():
trackIR.yaw = (yaw - centerYaw) * TRACKIR_MULTIPLIER
trackIR.pitch = (pitch - centerPitch) * TRACKIR_MULTIPLIER
trackIR.roll = (roll - centerRoll) * TRACKIR_MULTIPLIER

if DEBUG:
diagnostics.watch(trackIR.yaw)
diagnostics.watch(trackIR.pitch)
diagnostics.watch(trackIR.roll)

def updateFreeTrack():
freeTrack.yaw = (yaw - centerYaw) * -FREETRACK_MULTIPLIER # Inverted
freeTrack.pitch = (pitch - centerPitch) * FREETRACK_MULTIPLIER
freeTrack.roll = (roll - centerRoll) * FREETRACK_MULTIPLIER

if DEBUG:
diagnostics.watch(freeTrack.yaw)
diagnostics.watch(freeTrack.pitch)
diagnostics.watch(freeTrack.roll)

def center():
global centerYaw
centerYaw = yaw
global centerPitch
centerPitch = pitch
global centerRoll
centerRoll = roll

if starting:
enabled = True
centerYaw = freeImu.yaw
centerPitch = freeImu.pitch
centerRoll = freeImu.roll

global yaw
yaw = 0.0
global pitch
pitch = 0.0
global roll
roll = 0.0
freeImu.update += update

def do_update():
if OUTPUT_FREETRACK:
updateFreeTrack()

if OUTPUT_TRACKIR:
updateTrackIR()

if DEBUG:
diagnostics.watch(yaw)
diagnostics.watch(pitch)
diagnostics.watch(roll)

if enabled:
do_update()
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: Can't see any values change on watch...

Post by CyberVillain »

This will confuse FreePIE, it wont understand if you want to emulate freeTrack or read from it

Code: Select all

def updateTrackIR():
   trackIR.yaw = (yaw - centerYaw) * TRACKIR_MULTIPLIER
   trackIR.pitch = (pitch - centerPitch) * TRACKIR_MULTIPLIER
trackIR.roll = (roll - centerRoll) * TRACKIR_MULTIPLIER

if DEBUG:
   diagnostics.watch(trackIR.yaw)
   diagnostics.watch(trackIR.pitch)
   diagnostics.watch(trackIR.roll)
Its never good to troubleshoot with a fat script like this, try one thing at a time. You say you cant read from the freeImu plugin. try this script

Code: Select all

diagnostics.watch(freeImu.yaw)
Exclude one problem at the time.
Post Reply

Return to “FreePIE”