WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 06-30-2008, 08:42 AM
GoldenSun GoldenSun is offline
Member
 
Join Date: Feb 2008
Posts: 8
Crashing when I select Tracker option

I have a script that runs fine with HMD, Full screen and stereo selections. But when I also select tracker option. I get the following error.

winviz.exe has encountered a problem and needs to close. We are sorry for the inconvenience.

I have about 10 of the pic files loaded in the environment. so I have 10 sets of follwing:

screen1 = viz.add(viz.TEXQUAD)
screen1.translate(0.8, 1.500, -1)
screen1.setEuler(90, 0.0, 0.0)
screen1.scale(0.8, 0.5, 0.5)
image1 = viz.addTexture( 'pot.jpg' )
screen1.texture(image1)

When I remove all or some of them.. the program works with the Tracker option.

Do you know why? Is there something I can do to fix it? is there another way to post pics in the environment?

Thanks.
Reply With Quote
  #2  
Old 06-30-2008, 02:42 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Can you post the entire script using the [code][/code] tags? Also, is your script connecting to an InterSense device?
Reply With Quote
  #3  
Old 06-30-2008, 05:46 PM
GoldenSun GoldenSun is offline
Member
 
Join Date: Feb 2008
Posts: 8
Here is the entire script. Thanks for your help.

Code:
import viz
import math
#import vizmat
import vizinfo

global data 
global tracking_data

viz.go(viz.PROMPT)
viz.collision(viz.ON) 
viz.clearcolor

# Constants
ROTATION_INC		= 2
TRANSLATE_INC		= 0.1

#TIMERS
ANIMATE             = 0
TRACK				= 1
TRACKJOY			= 2

#in seconds
ANIMATE_RATE        = 0.01
TRACK_RATE			= 0.5


ground = viz.add('tut_ground.wrl')

walltexture = viz.addTexture( 'brick.jpg' )
#walltexture1 = viz.addTexture( 'woodfloor2.jpg' )
#walltexture2 = viz.addTexture( 'ToolBar.jpg' )

#ceiling = viz.add('box.wrl')
#ceiling.translate(-2.200, 3.0, -2.3)
#ceiling.setScale(4.600, 0.1, 5.500)
#ceiling.color(viz.WHITE)

southwall = viz.add('box.wrl')
southwall.appearance(viz.DECAL)
southwall.translate(-2.000, 1.500, +0.450)
southwall.setScale(4.600, 3.000, 0.100)
southwall.texture( walltexture ) 

eastwall = southwall.clone()
eastwall.setPosition(-4.300, 1.500, -2.300 )
eastwall.setScale(0.100, 3.000, 5.500)

northwall = southwall.clone()
northwall.setPosition(-2.430, 1.500, -5.050 )
northwall.setScale(3.658, 3.000, 0.100 )

westwall = southwall.clone()
westwall.setPosition(0.300, 1.500, -2.279  )
westwall.setScale(0.100, 3.000, 3.658 )

nw1 = southwall.clone()
nw1.setPosition(-0.150, 1.500, -4.110   )
nw1.setScale(0.900, 3.000, 0.100  )

nw2 = southwall.clone()
nw2.setPosition(-0.600, 1.500, -4.558  )
nw2.setScale(0.100,3.000, 0.900  )
 
h1 = southwall.clone()
h1.setPosition(-2.429, 1.500, -4.110 )
h1.setScale(1.829, 3.00, 0.100 )

h2 = southwall.clone()
h2.setPosition(-1.529, 1.500, -3.208 )
h2.setScale(1.829, 3.000, 0.100  )

h3 = southwall.clone()
h3.setPosition(-3.358, 1.500, -2.278  )
h3.setScale(1.829, 3.000, 0.100  )
 
h4 = southwall.clone()
h4.setPosition(-1.978, 1.500, -1.350   )
h4.setScale(0.900, 3.000, 0.100 )

h5 = southwall.clone()
h5.setPosition(-0.600, 1.500, -0.450  )
h5.setScale(1.829, 3.000, 0.100  )

v1 = southwall.clone()
v1.setPosition(-1.529, 1.500, -3.658   )
v1.setScale(0.100, 3.000, 0.915 )
 
v2 = southwall.clone()
v2.setPosition(-3.358, 1.500, -3.658 )
v2.setScale(0.100, 3.000, 0.900 )

v3 = southwall.clone()
v3.setPosition(-0.570, 1.500, -2.278  )
v3.setScale(0.100, 3.000, 1.829  )

v4 = southwall.clone()
v4.setPosition(-1.529, 1.500, -1.829  )
v4.setScale(0.100, 3.000, 0.900 )

v5 = southwall.clone()
v5.setPosition(-3.358, 1.500, -1.350   )
v5.setScale(0.100, 3.000, 1.829  )

v6 = southwall.clone()
v6.setPosition(-2.429, 1.500, -0.450   )
v6.setScale(0.100, 3.000, 1.829  )

avatar = viz.add('vcc_male.cfg', pos=(-3.800, 0, -2.2), euler=(0,0,0) )
avatar.setScale(0.800, 0.800, 0.300  )
avatar.state(4)

textT = viz.add(viz.TEXT3D, str("T"))
textT.setScale(0.3,0.3,0.3)
textT.translate(-3.800, 1.2, -2.1)
textT.setEuler(180, 0, 0.0)

#aduck = viz.add('duck.wrl')
#aduck.setPosition(-3.800, 1.000, -2.2   )
#aduck.setScale(0.500, 0.500, 0.500  )
#aduck.setEuler(90, 0.0, 0.0) 

screene = viz.add(viz.TEXQUAD)
screene.translate(-4.24, 1.500, -4.59)
screene.setEuler(-90, 0.0, 0.0) 
screene.scale(0.6, 0.5, 0.5)

imagene = viz.addTexture( 'maze1\woodenWell.jpg' )
screene.texture(imagene)

screenn = viz.add(viz.TEXQUAD)
screenn.translate(-3.8, 1.500, -4.99)
screenn.scale(0.5, 0.5, 0.5)
screenn.setEuler(180, 0.0, 0.0) 
imagenn = viz.addTexture( 'maze1\clock.jpg' )
screenn.texture(imagenn)

screenw = viz.add(viz.TEXQUAD)
screenw.translate(0.24, 1.500, -3.7)
screenw.setEuler(90, 0.0, 0.0) 
screenw.scale(0.5, 0.5, 0.5)

imagew = viz.addTexture( 'maze1\CandlePlate.jpg' )
screenw.texture(imagew)

screenw1 = viz.add(viz.TEXQUAD)
screenw1.translate(0, 1.500, -4.05)
screenw1.scale(0.3, 0.5, 0.5)
screenw1.setEuler(180, 0.0, 0.0) 

imagenw1 = viz.addTexture( 'maze1\OrangeChair.jpg' )
screenw1.texture(imagenw1)


screenh2 = viz.add(viz.TEXQUAD)
screenh2.translate(-0.85, 1.500, -3.15)
screenh2.scale(0.3, 0.5, 0.5)

imageh2 = viz.addTexture( 'maze1\plant1.jpg' )
screenh2.texture(imageh2)

screenh4 = viz.add(viz.TEXQUAD)
screenh4.translate(-1.97, 1.500, -1.42)
screenh4.scale(0.5, 0.4, 0.5)

imageh4 = viz.addTexture( 'maze1\curvydesk.jpg' )
screenh4.texture(imageh4)

screenv1 = viz.add(viz.TEXQUAD)
screenv1.translate(-1.58, 1.500, -3.658)
screenv1.setEuler(90, 0.0, 0.0) 
screenv1.scale(0.6, 0.5, 0.5)

imagev1 = viz.addTexture( 'maze1\RedWine.jpg' )
screenv1.texture(imagev1)

screenv3 = viz.add(viz.TEXQUAD)
screenv3.translate(-0.623, 1.500, -2.7)
screenv3.setEuler(90, 0.0, 0.0) 
screenv3.scale(0.6, 0.5, 0.5)

imagev3 = viz.addTexture( 'maze1\limens.jpg' )
screenv3.texture(imagev3)

screenv4 = viz.add(viz.TEXQUAD)
screenv4.translate(-1.59, 1.500, -1.8)
screenv4.setEuler(90, 0.0, 0.0) 
screenv4.scale(0.5, 0.4, 0.5)

imagev4 = viz.addTexture( 'maze1\Glasses.jpg' )
screenv4.texture(imagev4)

screenexit = viz.add(viz.TEXQUAD)
screenexit.translate(-2.36, 1.500, -0.45)
screenexit.setEuler(90, 0.0, 0.0) 
screenexit.scale(0.3, 0.5, 0.5)

imageexit = viz.addTexture( 'maze1\cnotes.jpg' )
screenexit.texture(imageexit)

text = viz.add(viz.TEXT3D, str("STOP"))
text.setScale(0.3,0.3,0.3)
text.translate(0.5, 1.5, .4)
text.setEuler(90, 0, 0.0)

text1 = viz.add(viz.TEXT3D, str("1"))
text1.setScale(0.3,0.3,0.3)
text1.translate(0.25, 1.5, -3.95)
text1.setEuler(135, 0, 0.0)

text2 = viz.add(viz.TEXT3D, str("2"))
text2.setScale(0.3,0.3,0.3)
text2.translate(-4.12, 1.5, -5.)
text2.setEuler(-135, 0, 0.0)

text3 = viz.add(viz.TEXT3D, str("3"))
text3.setScale(0.3,0.3,0.3)
text3.translate(-1.58, 1.03, -3.6)
text3.setEuler(90, 0, 0.0)

text4 = viz.add(viz.TEXT3D, str("4"))
text4.setScale(0.3,0.3,0.3)
text4.translate(-0.6, 1.5, -3.05)
text4.setEuler(135, 0, 0.0)

text5 = viz.add(viz.TEXT3D, str("5"))
text5.setScale(0.3,0.3,0.3)
text5.translate(-1.69, 1.5, -1.42)
text5.setEuler(45, 0, 0.0)

viz.translate(viz.HEAD_POS,0.5,0,0)
viz.MainView.setEuler(-90,20,0)

subject = viz.get(viz.INITMESG) #use it to enter subject number
#tracking_data = open('tracking_'+str(subject)+'.txt', 'w') #create a tracking data file
data = viz.get(viz.HEAD_POS)

if viz.get(viz.TRACKER):
	intersense = viz.add('intersense.dls')
	viz.tracker()  #?
	intersense.reset()  #reset intersense tracking data to 0 initial 
	viz.eyeheight(1.0)
	#viz.link(intersense,viz.MainView)
	tracking = 1
else:
	tracking = 0
	#viz.collision(viz.ON)

if viz.get(viz.OPTION1):
	import vizjoy
	#import viztracker
	joy = vizjoy.add()
	#tracker = viztracker.add()
	#viz.link(tracker,viz.MainView)
	if not joy.valid():
		joy = None
else:
	joy = None

# Callback function to handle expiration timers
def mytimer(num):
	
	if num == ANIMATE:
		
		if joy:
			#Use joystick to move and turn
			pos = joy.getPosition()
			
			x = pos[0]
			y = pos[1]
			if math.fabs(y) > 0.2:
				viz.move(0,0,-y*0.01)
			if math.fabs(x) > 0.2:
				viz.rotate(viz.BODY_ORI,x*1,0,0)
	
	if num == TRACK:
		#global data 
		data = intersense.getData()  # Access the raw data from the sensor
		#data = v.getPosition()
		tracking_data.write(str(viz.tick())+','+str(data)+'\n')
		#print data  # Print the array of data 
	if num == TRACKJOY:
		#global data 
		data = viz.get(viz.HEAD_POS)
		tracking_data.write(str(viz.tick())+','+str(data)+'\n')
		#print data  # Print the array of data 


def mykeyboard(key):
	
	if key == 'j':
		print "writing to file for joy"
		viz.starttimer(TRACKJOY,TRACK_RATE, viz.FOREVER)
		vizinfo.add('Joystick Tracking...')
	if key == 'i':
		print "writing to file for intersense"
		viz.starttimer(TRACK,TRACK_RATE, viz.FOREVER)
		vizinfo.add('Intersense Tracking...')
	if key == 'p':
		print viz.get(viz.HEAD_POS)

viz.callback(viz.KEYBOARD_EVENT, mykeyboard)
viz.callback(viz.TIMER_EVENT, mytimer)

if joy:
	viz.starttimer(ANIMATE,ANIMATE_RATE,viz.FOREVER)
	tracking_data = open('joytracking_'+ str(subject)+'.txt', 'w') #create a tracking data file
if tracking:
	tracking_data = open('is900tracking_'+ str(subject)+'.txt', 'w') #create a tracking data file
Reply With Quote
  #4  
Old 06-30-2008, 06:55 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
The crash is probably related to the InterSense. The drivers provided by InterSense will crash sometimes when searching for a connected device. The solution is to explicitly define which port the InterSense is connected to. For example, if the device is connected on COM port 1, add the following line of code to your script:
Code:
PORT_INTERSENSE = 1
Reply With Quote
  #5  
Old 07-01-2008, 11:06 AM
GoldenSun GoldenSun is offline
Member
 
Join Date: Feb 2008
Posts: 8
Thanks! It works great now.
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
tracker commands frequency over the JimB Vizard 3 03-07-2008 09:33 AM
Interface with Tobii Eye Tracker Uttama_vizard Precision Position Tracker (PPT) 1 12-12-2007 11:31 AM
Can Vizard interact with the Arrington eye tracker? Deltcho Vizard 1 09-18-2007 02:38 PM


All times are GMT -7. The time now is 04:25 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Copyright 2002-2018 WorldViz LLC