WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 11-03-2014, 02:00 AM
dcnieho dcnieho is offline
Member
 
Join Date: Feb 2011
Posts: 59
Question linking viewpoint to viz.node

Some background first:
I have a project in which the mainview is linked to 6DOF data recorded when walking with HMD. There are some transforms in between the data from the tracker and the position/orientation in the virtual world, implemented with pre and post actions on the link.
The 6DOF data from the tracker as well as transformed to the virtual world are stored to file.

Now, I'd like to replay this data. So simply use the stored tracker position/orientation data as input to the link transform chain to generate the same frames/views as during previous walking (there are other things going on in the code, changing as little as possible by simply providing fake/replayed tracker data is the best solution to implement what I want). I thought I could easily do this by simply using an empty node (viz.addGroup()), setting its position and orientation each frame and using that in place of the tracker linkable as source for the link with mainview. However, the orientation data is ignored, that is, the mainview is oriented always as if all input orientation data is 0.

Code:
 trackerLinkable = viz.addGroup()
 fileReader = MatFileReader()
 vizact.onupdate(viz.PRIORITY_PLUGINS,fileReader.getNextRealPosOri,trackerLinkable) # see below for relevant bits
  
 headLink = viz.link(headTrack, viz.MainView)
 vizact.onupdate(viz.PRIORITY_PLUGINS+2,headLink.update) # viz.PRIORITY_PLUGINS+1 reserved 
 #headLink.postEuler(), etc...
  
 class MatFileReader():
     def getNextRealPosOri(self,output=None):
          # get next rawPos and rawOri from loaded file
          if output is not None:
              output.setPosition(rawPos)
             output.setEuler(rawOri)
              print (output.getPosition(),output.getEuler()) # prints what is expected. e.g. getMatrix() also looks right
So above works as expected for as far as I can debug it, but it seems the orientation information is lost somewhere along the way. when I do
Code:
 print (viz.MainView.getPosition(),viz.MainView.getEuler())
I get [0,0,0] from getEuler.

A second problem I have is that this appears to run at 30 Hz instead of 60. Am I doing something very suboptimal causing the slowdown?

What have I forgotten? Is there a better way to implement something like this?

Thank you!

Last edited by dcnieho; 11-03-2014 at 02:05 AM.
Reply With Quote
  #2  
Old 11-03-2014, 03:13 AM
dcnieho dcnieho is offline
Member
 
Join Date: Feb 2011
Posts: 59
I can no longer edit my post, but I have fixed the problem of orientation data disappearing. Now it is just left to wondering what is so suboptimal about what I'm doing that I achieve only 30 fps, and wondering whether there is a better way to implement such a data replay.

Thanks again!
Reply With Quote
  #3  
Old 11-04-2014, 12:38 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,465
Does the 30 fps only happen when you're playing back the data from file or also during recording? Have you tried reading the data using a director function or storing in a list before playback.
Reply With Quote
  #4  
Old 11-04-2014, 06:35 PM
dcnieho dcnieho is offline
Member
 
Join Date: Feb 2011
Posts: 59
Hi Jeff,

Thanks for the suggestions. Data is recorded at 60 fps, and also i have not implemented any throttling to mimic the recorded timestamps of each frame. It should simply play v-synced. I do read the file to memory first into a 2d numpy array and then return one row from there at a time, getting the six values.

I am not sure how it would work with the director function. i use the scheduling and plenty of yields for the experiment logic, while behind the scene updating each frame is taking care of the data coming in, as I believe happens for real tracker sources as well. More importantly, with the director function, would i be able to specify with what priority the function gets called? It needs to be called at viz.PRIORITY_PLUGINS as the links further leading to an updated mainview run at viz.PRIORITY_PLUGINS+1 and viz.PRIORITY_PLUGINS+2.

All that said, it seems there were some other parts of the program that could be done more efficiently and now things appear to run smoothly most of the time.

Thanks a lot, for thinking along and the suggestions!
Dee
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
How to track the actual viewpoint Jerry Vizard 3 05-25-2016 10:44 AM
Moving main viewpoint when linked to PPT v-clizzin Precision Position Tracker (PPT) 1 04-20-2010 05:09 PM
Avatar w/ hat cannot look at viewpoint TrashcanPatrol Vizard 5 08-19-2008 09:26 AM
3d viewpoint movement spacefarer Vizard 9 07-25-2006 04:37 PM
VRML Viewpoint error bstankie Vizard 1 03-11-2003 03:10 PM


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


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