VRPN Python

Is there a python interface to use the VRPN client supported within Panda3D? There is no documentation on VRPN use, but the function calls (createTracker()) certainly tells me that there is some support built-in.

How would I use the client? If I had a VRPN server streaming data called “Remote” on port 3883 that generates some tracking data, how would I interface with the VRPN api through Panda?

Thanks in advance.

client = VrpnClient('vrpn.server.com')
tracker = TrackerNode(client, 'tracker_name')
print tracker.getTransform()

You can also parent the tracker into the datagraph to have it automatically animate a model’s position:

tnp = base.dataRoot.attachNewNode(tnp)
t2m = tnp.attachNewNode(Transform2SG('t2m'))
t2m.node().setNode(model.node())

There are other kinds of VRPN control devices than trackers; you can also create a DialNode, ButtonNode, or AnalogNode, depending on what hardware you actually have available.

David

Thanks for your help.

Entering this in panda:

from direct.directdevices.DirectDeviceManager import *

gives me the error:

Traceback (most recent call last):
File “”, line 1, in
File “C:\Panda3D-1.5.3\direct\src\directdevices\DirectDeviceManager.py”, line
14, in
myBase = simbase
NameError: name ‘simbase’ is not defined

It worked the first time, then I made the call:

DirectDeviceManager(‘127.0.0.1’)

started freezing up, so I killed the panda process in Windows and have received the error I posted above subsequently.

Also, my other question is, in the example you gave, you didnt specify a port number. How would I go about specifying localhost as my vrpn server, using port number 3883 (or any port). Would it be VrpnClient(‘localhost:3883’)? Doing this resulted in an error when it worked initially.

Thanks again for your help.

Looking at the code in DirectDeviceManager, it’s clear that the first thing it does is assign a pointer to base, which means that you have to import DirectStart (which creates base) before you can import DirectDeviceManager.

Other than that, I know little about how DirectDeviceManager works. The code I gave you is low-level code which doesn’t need this high-level wrapper.

What sort of error did you get from ‘localhost:3883’?

David