Search code examples
vizard

tracking position/location in test keyboard & mouse mode (not ppt) with new vizconnect


I can track location fine pre - vizconnect using code like this:-

vrpn7 = viz.add('vrpn7.dle')
posTracker = vrpn7.addTracker('PPT0@WorldViz-PC', 0 )

and then

x,y,z = posTracker.getPosition()

but I now use the new vizconnect e.g.

vizconnect.go( 'vizconnect_hmd_ppt.py' )

I'm wondering what the recommended way is to then access the trackers from my main project '.py' file and particularly when I'm using a keyboard/mouse scenario to simulate movement for during program development.

Any advice would be most welcome.

Thanks


Solution

  • Actually it was pretty straightforward:

    first check the names of the trackers using:

    print(  vizconnect.getTrackerDict() )
    

    it may return something like this

    'mouse_and_keyboard_walking'

    along with some others e.g. inertia cube, then do

    gTracker = vizconnect.getTracker( 'mouse_and_keyboard_walking' )
    

    or

    gTracker = vizconnect.getTracker( 'PPT0@WorldViz-PC' )
    

    then periodically call (probably on a callback() ):-

    x, y, z = gTracker.getPosition()