WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 12-19-2008, 02:48 AM
Saz Saz is offline
Member
 
Join Date: Nov 2008
Posts: 36
output data to screen

Hi,

I'm writing the position of the joystick data to a file and I want the same information to appear on the top left of the vizard screen so that the user can see it. However I'm moving down an infinite road which is constantly updating and therefore my joystick information has to also move along with that, so I guess that I have to assign the text as a child of the road (or ground). This is what I've come up with so far
Code:
file = open( 'speed_.txt' + str(subject),'w' )
def mytimer (num):
	joy_pos = str(joy.getPosition())
	out = str(joy_pos + '\n')
	file.write(out)
	file.flush()
	print out
	#Add text as child of road

	speed = viz.add(viz.TEXT3D,joy_pos, road)
	speed.alignment(viz.TEXT_LEFT_TOP)

#Text translation will be relative to road local coordinate system
	speed.translate(-1,1,-1)
	speed.color(0,0,0)
	speed.scale(.2, .2, 2)
viz.callback( viz.TIMER_EVENT, mytimer )
viz.starttimer( 0, 0.25, viz.FOREVER )
But the data is being constantly written over rather than updating, which I'm guessing will have something to do with the write function, plus it doesn't move as I'm travelling down the road (its also in the wrong position but that's just working out the co-ordinates)

Any help would be great!
Reply With Quote
  #2  
Old 12-19-2008, 04:59 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
if you use viz.SCREEN the text will be fixed on the screen

Code:
import viz
viz.go()

#Add text to the screen.
text_2D = viz.addText( 'on the screen', viz.SCREEN )
text_2D.setPosition(.05, .9 ) #2D text only needs x and y.
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
writing joystick position to a data file Saz Vizard 3 12-17-2008 05:18 AM
position of html-file on screen active_world Vizard 1 05-16-2008 07:24 PM
Flagging the Data Elittdogg Vizard 5 04-11-2008 11:40 AM
text output jaclyn.bill Vizard 2 10-24-2007 06:37 AM
tracking using quaternarion data jfreeman Vizard 2 06-01-2005 08:48 AM


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


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