Page 1 of 1

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

Posted: Thu Nov 06, 2014 10:31 pm
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()

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

Posted: Fri Nov 07, 2014 1:47 pm
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.