WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   how to link the Sony HMD to the MainView (https://forum.worldviz.com/showthread.php?t=5051)

armo 06-01-2014 03:55 AM

how to link the Sony HMD to the MainView
 
Hello everyone

I would like to link our Sony HMD to the MainView so the viewer could freely explore the scenarios once worn the HMD. The model is a Sony HMZ-TH1.


but when I run this script:

Code:

import viz
import SonyHMD


hmd = SonyHMD.HMZT1()
headlink = viz.link(hmd, viz.MainView)
       
viz.go()

viz.add('scenario/ground_wood.osgb')


it tells me that the source object is not a linkable type:

Code:

Traceback (most recent call last):
  File "", line 11, in
  File "C:\Users\Armando\Desktop\ARMANDO\ScriptVizard\provaCascoSony\provaCascoSonyArmo.py", line 21, in
    headlink = viz.link(hmd, viz.MainView)
  File "C:\Program Files\WorldViz\Vizard5\python\viz.py", line 8723, in link
    raise TypeError, 'Link source is not a linkable type'
TypeError: Link source is not a linkable type


Could you please tell me where is the error? (as I suppose there should be one, since the viz.link works finely with the wirks example script "The Pit")


kind regards,
armo

Jeff 06-02-2014 12:23 AM

The line of code:

Code:

hmd = SonyHMD.HMZT1()
configures the display settings but does not provide a position and orientation that another object such as the viewpoint can be linked to. You can link the viewpoint to a Kinect or InertialLabs tracker object. In the Wirks demos, take a look at the code where the trackers are added and the viewpoint is linked to a merged tracker created from Kinect position and InertialLabs orientation.

armo 06-03-2014 02:55 AM

Dear Jeff

thank you very much! I followed your instructions and it worked.

However two new problems occured:

1-it seems like the orientation axes are misconfigured because If I try to look up the camera doesn't revolve around the X axis but it actually rolls like if it was on the Z axis. The yaw rotation on the other hand works properly.

2-I can't manage to set the height of the viewpoint. The MainView remains on the ground level even if I use the viz.eyeheight or viz.MainView.setPosition commands

here's the code:

Code:

import Config
import InertialLabs
import SonyHMD
import viz
import viztracker

hmd = SonyHMD.HMZT1()
myILSensor = InertialLabs.addSensor(port=Config.COM_PORT)
tracker = viztracker.KeyboardPos()
head6DoFTracker = viz.mergeLinkable(tracker, myILSensor)
headlink = viz.link(head6DoFTracker, viz.MainView)

viz.go(viz.FULLSCREEN)
viz.eyeheight(1.4)

viz.add('scenario/stanza4.dae',pos=(0, 0.06, 0), euler=(0,0,0), scale=(0.0254]*3))
viz.MainView.setPosition(0, 1.4, 0)


best regards,
armo

Jeff 06-04-2014 10:35 PM

1. Make sure you reset the inertial labs tracker. You'll need to call the resetHeading function as in ThePit.py demo script.

2. You've linked the viewpoint to a tracker that has an initial height value of 0. The position of the link source (keytracker) will override the position you specify in the view.setPosition or viz.eyeheight commands. You can apply an offset to the link so it's initial value is not at ground level:

Code:

headlink.postTrans([0,1.8,0])
You can also force the viewpoint to stay at a certain height. In the following code only the X,Z position of the keytracker is be applied to the link. The height is fixed at 1.8:

Code:

headlink.setPos([None,1.8,None])

armo 06-08-2014 11:34 AM

Dear Jeff

With these latter instructions now it all works fine and well. Thank you so much!



best regards,
armo


All times are GMT -7. The time now is 06:14 PM.

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