View Single Post
  #3  
Old 07-26-2010, 10:32 PM
znchb znchb is offline
Member
 
Join Date: Sep 2008
Posts: 21
thank you for your reply, I copy the file to here.

import viz
viz.go()
viz.add('tut_ground.wrl')
viz.clearcolor(viz.GRAY)

view = viz.MainView
PORT_INTERSENSE = 1
sensor = viz.add('intersense.dls')
viz.tracker()
link = viz.link( sensor, view )#this link the Sensor's Orientation with View

#vrpn = viz.add('vrpn7.dle')
#tracker1 = vrpn.addTracker('Tracker0@localhost')
#tracker2 = vrpn.addTracker('Tracker0@localhost',1)

def onTimer(num):# try to control the MainView's position, by getPosition #from sensor, however, it doesn't work
pos = sensor.getPosition()
euler = sensor.getEuler()
print pos
print euler
view.setPosition(pos)
view.setEuler(euler)

viz.callback(viz.TIMER_EVENT,mytimer)
viz.starttimer(0,0.01,viz.FOREVER)
Reply With Quote