View Single Post
  #1  
Old 11-03-2014, 01: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 01:05 AM.
Reply With Quote