WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 03-14-2013, 04:26 PM
westbyb westbyb is offline
Member
 
Join Date: Mar 2013
Posts: 5
Temporal delay on movement

I was wondering if there was a way to delay the input sent for movement. I'm using vizcam.addWalkNavigate() to control my movement currently, and I was wondering if there was a way to have my movement be slightly delayed from my actual input, so that I can, for example, press the key to move forward and then a second or two later, the movement would actually occur.

Thanks in advance!
Reply With Quote
  #2  
Old 03-15-2013, 06:49 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
You could try something like the following:
Code:
import viz
import vizact
import vizcam

viz.go()

DELAY = 2
dojo = viz.add('dojo.osgb')
walkNav = vizcam.addWalkNavigate()

recordedData = []
def RecordTrackingData():
	recordedData.append( (walkNav.getPosition(), walkNav.getQuat()) )
vizact.onupdate(0,RecordTrackingData)

def ApplyTrackingData():
	pos,ori = recordedData.pop(0)
	viz.MainView.setPosition([pos[0],1.8,pos[2]])
	viz.MainView.setQuat(ori)
	
ApplyDataCallback = vizact.onupdate(0,ApplyTrackingData)
ApplyDataCallback.setEnabled(viz.OFF)

vizact.ontimer2(DELAY,0,ApplyDataCallback.setEnabled,viz.ON)
Reply With Quote
  #3  
Old 05-21-2013, 03:20 PM
westbyb westbyb is offline
Member
 
Join Date: Mar 2013
Posts: 5
Fantastic! That worked for using addWalkNavigate, but I'm now using VRPN 7 to get location data, as such:

Quote:
vrpn = viz.add('vrpn7.dle')
headPos = vrpn.addTracker( 'PPT0@'+PPT_MACHINE,0)
iLabs = viz.addExtension( 'inertiallabs.dle' )
headOri = iLabs.addSensorBus(port=INERTIALLABS_HEAD_PORT)[0]
I've tried subbing these values into the code that worked previously, but it's seeming that won't be possible. How should I go about implementing the same idea using vrpn?
Reply With Quote
  #4  
Old 05-21-2013, 05:46 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
Are you getting any errors? Can you post the code you tested with?
Reply With Quote
  #5  
Old 05-23-2013, 02:41 PM
westbyb westbyb is offline
Member
 
Join Date: Mar 2013
Posts: 5
No errors, but here's the code I'm working with:
Quote:
viztracker.go()
recordedData = []
def RecordTrackingData():
recordedData.append( (headPos.getPosition(), headOri.getQuat()) )
vizact.onupdate(0,RecordTrackingData)

def ApplyTrackingData():
pos,ori = recordedData.pop(0)
viz.MainView.setPosition([pos[0],1.8,pos[2]])
viz.MainView.setQuat(ori)

ApplyDataCallback = vizact.onupdate(0,ApplyTrackingData)
ApplyDataCallback.setEnabled(viz.OFF) #OFF

vizact.ontimer2(TIME_DELAY,0,ApplyDataCallback.set Enabled,viz.ON) #ON
I imagine that switching from viz.go() to viztracker.go() is what's causing the issue. I swapped viz.OFF/ON with viztracker.OFF/ON with no results.
Reply With Quote
  #6  
Old 05-23-2013, 06:06 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
The manual setting of the viewpoint in your script is overridden by the viewpoint link defined in the viztracker file. For this custom viewpoint movement its probably best to configure the trackers in this script and not use viztracker.
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
3ds Exported .IVE Model mirrors movement of Mainview Felix Vizard 9 05-18-2012 09:17 AM
Jerking Movement ssaha Vizard 0 04-08-2010 11:41 AM
Reading bone movement from animations Enlil Vizard 5 08-14-2008 02:29 PM
Mouse/Keyboard Movement joeymax Vizard 1 04-02-2007 10:43 AM
movement problems keastman Precision Position Tracker (PPT) 1 09-09-2003 11:41 AM


All times are GMT -7. The time now is 06:40 AM.


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