WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 08-31-2016, 08:27 AM
rroemmich29 rroemmich29 is offline
Member
 
Join Date: Aug 2016
Posts: 5
Jerky changes in view velocity when updating with timer

Hi all,

We have created a visual flow environment where the velocity of the flow matches the velocity of a treadmill in our lab. The velocity of the treadmill changes from step to step based on the step length of the participant and the visual flow in turn updates to the same velocity.

I am having an issue where the visual flow transitions from one velocity to another appear to have some jitter and was wondering if anyone could give me some advice on how to eliminate it. Essentially, when the flow changes velocity, the screen appears to jitter back and forth very briefly (a matter of milliseconds) before settling on the new velocity.

When I run something like this, the view velocity updates very smoothly:

Code:
vel = 1.2
velcount = 1
view = viz.MainView
view.eyeheight(1.7)

def updatevel():
	global vel
	view.velocity([0,0,vel])
	print vel

def addvel():
	global vel
	global velcount
	if velcount == 1:
		vel=vel+1
		velcount = 2
	else:
		vel=vel-1
		velcount = 1

def updatefn():
	updatevel()
	addvel()
	
vizact.ontimer(1,updatefn)
I am unsure why my code differs from this and have attached it below in case anyone has any ideas. I am happy to provide further information if anything is unclear.

Thanks in advance!
Attached Files
File Type: txt VirtualStreetSystem.txt (7.0 KB, 244 views)
Reply With Quote
  #2  
Old 09-01-2016, 05:47 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,462
Can you verify that the frame rate is stable throughout? Is the velocity fluctuating during that period of time when there is jitter? You could try recording the velocity values every frame and look at the values to see if it changes when you expect.
Reply With Quote
  #3  
Old 09-01-2016, 06:49 AM
rroemmich29 rroemmich29 is offline
Member
 
Join Date: Aug 2016
Posts: 5
When I log the velocities inside the update function, I get the following (as sample data):

500
467
220
54
612
497
398
418
700
585
776
825
346
297
552
388
817
542
811

You'll notice that none of the velocities become negative, so I am still struggling to understand why the jitter occurs. Certainly the velocity magnitude should change, but I'm not sure why it momentarily changes direction.
Reply With Quote
  #4  
Old 09-01-2016, 06:49 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,462
Can you verify the update function is only called once per timer period? Just want to make sure multiple timers are not inadvertently created.

You could also try updating the view position each frame instead of using the view.velocity command:

Code:
def UpdateView():
	view.setPosition([0, 0, velocity * viz.getFrameElapsed()], viz.REL_LOCAL)

vizact.ontimer(0, UpdateView)
Reply With Quote
  #5  
Old 09-01-2016, 07:00 AM
rroemmich29 rroemmich29 is offline
Member
 
Join Date: Aug 2016
Posts: 5
Thanks for the suggestion. Unfortunately, the same issue occurs when changing the position. I am running two timers in the current iteration of the code, but only one of the timers updates the view velocity. I have also run the code with only one timer and the issue persists.
Reply With Quote
  #6  
Old 09-01-2016, 07:20 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,462
It's difficult to say without being able to run code that reproduces the issue. If the display frame rate is stable then it seems like something in the code is causing this. Both of these methods to move the viewpoint work fine in other examples. Are you able to run your code and perhaps simulate treadmill values rather than actually doing any IO operations?
Reply With Quote
  #7  
Old 09-01-2016, 07:26 AM
rroemmich29 rroemmich29 is offline
Member
 
Join Date: Aug 2016
Posts: 5
Sure, I understand. Thanks for the advice, I'll keep digging around.
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
animation path problem - coordinates not resetting jelly Vizard 7 04-26-2016 11:45 AM
Using Oculus and Vicon for updating in pit Qiliang He Vizard 1 09-06-2015 03:46 PM
Prevent Oculus DK2 updating the view with accelerometer info Notch Vizard 3 10-24-2014 12:06 PM
View nlfrnassimi Vizard 4 03-12-2009 06:25 AM
problem with stereo mode shivanangel Vizard 3 10-17-2006 10:58 AM


All times are GMT -7. The time now is 10:41 AM.


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