WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 12-07-2009, 01:32 PM
nitao nitao is offline
Member
 
Join Date: Nov 2009
Posts: 3
question about IS-900 wand

Hi,

I am new to Vizard, and our lab is starting using Vizard for a project. I have trouble with getting the IS-900 wand work. I followed the tutorial and wrote a small program. The tracker works, but I cannot retrieve the data from the joystick or buttons on the wand. The script is as follows:

*******************************
import viz

viz.go()

#Add environment
viz.add('gallery.ive')

#Add the intersense plugin
tracker1 = viz.add('intersense.dls')
tracker2 = viz.add('intersense.dls')

# This function will grab the tracker data and update the viewpoint
def UpdateView():

#Get tracker euler rotation
yaw,pitch,roll = tracker2.getEuler()

#Only rotate the yaw of the body orientation
viz.MainView.setEuler([yaw,0,0],viz.BODY_ORI)

#Call UpdateView function every frame
vizact.ontimer(0,UpdateView)

#The current value of the analog joystick of the IS-900 is located at index 8,9.
#Index 8 represents the X-axis of the joystick and ranges between -1 to 1.
#Index 9 represents the Y-axis of the joystick and ranges between -1 to 1.

data = tracker2.getData()
print data[8], data[9]

state = int(tracker2.getData() [7])
if state & 1:
print 'Button 1 is down'


#Rest tracker when 'r' key is pressed
vizact.onkeydown('r',tracker1.reset)
vizact.onkeydown('r',tracker2.reset)
********************************************

tracker1 is the head tracker connected to the station 1, and the wand station 2.

Can anyone tell me what's wrong, either with the code or the hardware setup?

Thanks,
Tao
Reply With Quote
  #2  
Old 12-09-2009, 02:17 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
If you put the code that gets the button and joystick data into a timer function what kind of values are printed out in the input/output window?
Code:
def showData():

	data = tracker2.getData()
	print data[8], data[9]

	state = int(data[7])
	if state & 1:
		print 'Button 1 is down'
		
vizact.ontimer(0, showData)
Reply With Quote
  #3  
Old 12-14-2009, 11:54 AM
nitao nitao is offline
Member
 
Join Date: Nov 2009
Posts: 3
Jeff,

Yes I made changes as you suggested and it now works. Looks like a silly mistake I made :-) Thanks very much for your kind help.
Reply With Quote
Reply


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
CAVE, navigation, tracked wand, coordinate systems JimC Vizard 6 10-09-2009 01:43 PM
General question and question regarding arrays dan12345 Vizard 1 01-15-2008 11:15 AM
question about yaw, pitch, roll TunTun Vizard 2 05-23-2007 01:46 PM
to rephrase my question... shai Vizard 2 10-27-2004 11:55 AM
Lots of Question Karthi Vizard 4 02-20-2004 07:42 PM


All times are GMT -7. The time now is 02:13 AM.


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