WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Plug-in development (https://forum.worldviz.com/forumdisplay.php?f=8)
-   -   Vicon plug-in (https://forum.worldviz.com/showthread.php?t=1335)

dudey12 02-07-2008 01:30 PM

Vicon plug-in
 
I'm trying to use the vicon plug-in to access tracking data that vicon is spitting out.
I'm using the code provided in the example: simple.py

import viz

viz.go()

#Add a grounds
viz.add('tut_ground.wrl')

#The number of markers to connect to
NUM_MARKERS = 1

#Specify the IP address of the Vicon server. Default port is 800.
#If you wanted to specify port 803, you would do the following:
#PORT_VICON = '128.2.4.78:803'
PORT_VICON = '128.2.4.78'

#Add the specified number of markers
for x in range(NUM_MARKERS):
#Add a vicon marker
marker = viz.add('vicon.dls')
#Add a 3d ball to represent the marker
ball = viz.add('white_ball.wrl')
#Link the 3d ball to the marker
ball.link(marker)

#Move the viewpoint back 8 meters
viz.move(0,0,-8)


I'm finding that I'm only able to add two markers. The code works perfectly for two markers but if a third or fourth marker is added, I get an error message that says that the maximum number of markers has been reached.

Any help would be greatly appreciated!

farshizzo 02-07-2008 06:26 PM

The plugin allows you to add as many sensors as there are bodies. Are you sure that Vicon is sending out more than 2 bodies? The plugin should have no internal limit on the number of bodies to connect to.

dudey12 02-08-2008 09:38 AM

- I am sure vicon is sending out 4 bodies as we have another program on the same machine that picks up all 4 markers. If it would help, I can post the exact code that we're using...

dudey12 02-14-2008 12:32 PM

Here is the code that I'm using:

from datetime import datetime
import viz
viz.go()

#Add a grounds
#viz.add('tut_ground.wrl')

#PORT_VICON = '130.15.96.174'

#Specify the IP address of the Vicon server. Default port is 800.
#If you wanted to specify port 803, you would do the following:
#PORT_VICON = '128.2.4.78:803'

PORT_VICON = '130.15.96.174:800'
viz.move(0,-2,-4)

#The number of markers to connect to
VICON_MARKERS = 3

#Move the viewpoint back 8 meters

m1 = viz.add('vicon.dls')
b1 = viz.add('white_ball.wrl')
viz.link(m1,b1)

#print m1.getData()

m2 = viz.add('vicon.dls')
b2 = viz.add('white_ball.wrl')
viz.link(m2,b2)



#m3 = viz.add('vicon.dls')
#b3 = viz.add('white_ball.wrl')
#viz.link(m3,b3)

ANIMATE = 1
ANIMATE_RATE=0.1

def mytimer(num):
print datetime.now()
print m1.getPosition()
print m2.getPosition()
#print m3.getPosition()


viz.callback(viz.TIMER_EVENT, mytimer)
viz.starttimer(ANIMATE,ANIMATE_RATE,viz.FOREVER)

As mentioned previously, this code performs perfectly for two markers but complains when a third or fourth is added.

farshizzo 02-27-2008 09:39 AM

Sorry for the delay, we've been waiting to receive a simulator from Vicon. I believe the problem is that you are trying to retrieve marker data, where as the vicon plugin only outputs body data. I was able to simulate 17 bodies and connect to all of them through the Vizard plugin.

Now that we have a simulator for testing, we will be rewriting the Vicon plugin to support both marker and body data. This will be available in the next release.

dudey12 04-03-2008 11:54 AM

Quote:

Originally Posted by farshizzo (Post 5116)
Sorry for the delay, we've been waiting to receive a simulator from Vicon. I believe the problem is that you are trying to retrieve marker data, where as the vicon plugin only outputs body data. I was able to simulate 17 bodies and connect to all of them through the Vizard plugin.

Now that we have a simulator for testing, we will be rewriting the Vicon plugin to support both marker and body data. This will be available in the next release.

Thanks a lot, this has been helpful for tracking the markers. We are, however, having a problem tracking bodies still. The vicon.getBodyList() works correctly, however when I try to use the vicon.getBody(val) function, I receive the error "_ViconExtension object has no attribute getBody". This occurs with the sample program in the help file, shown below. The IP address was changed to the correct one.

Code:

vicon = viz.add('vicon.dle',0,'192.168.0.114')
body = vicon.getBody(0)
marker = vicon.getMarker(0)

print body.getName()
print marker.getName()

Since the bodies are accessible from the getBodyList() function I tried linking a box to the body, but it didn't work either. Any suggestions?

farshizzo 04-03-2008 12:01 PM

Are you using the version of the Vicon plugin that came with the latest release? My guess is that you have some unofficial version. Please download the latest release and make sure you don't have an files called vicon.dle in your script directory.

dudey12 04-03-2008 12:17 PM

Quote:

Originally Posted by farshizzo (Post 5337)
Are you using the version of the Vicon plugin that came with the latest release? My guess is that you have some unofficial version. Please download the latest release and make sure you don't have an files called vicon.dle in your script directory.

I have downloaded the latest version of Vizard and am using the DLE. Mysteriously the getBody() function is working now, but its information does not update. The information updates properly when individual markers are linked to objects.

farshizzo 04-11-2008 09:34 AM

I've tested our plugin with all the sample files that came with the Vicon simulator and it works fine. Can you make a sample recording of your output to the .v format so I can simulate it here. You can post the file directly in the forum or email it to lashkari@worldviz.com

sscovil 04-25-2008 08:45 AM

Hello, my name is Stephen. I'm doing a little bit of work on this project for the time being.

I found out why the body positions weren't updating, and it was a particular setting on the vicon side (we needed to enable 'kinematic data' to be output in the real-time stream).

Now, how do I get the orientation from the body? Is there a getOrientation()-like function or do I need to figure it out from the body position information?

farshizzo 04-25-2008 08:50 AM

You can use one of the following functions to get orientation data from a body:
Code:

quat = body.getQuat() #[x,y,z,w] quaternion rotation
euler = body.getEuler() #[yaw,pitch,roll] euler rotation in degrees
axisAngle = body.getAxisAngle() #[x,y,z,deg] axis-angle rotation
mat = body.getMatrix() #4x4 transform matrix including position and rotation

Hope this helps.

sscovil 04-25-2008 08:59 AM

Perfect, that's exactly what was needed. Thanks!


All times are GMT -7. The time now is 01:15 AM.

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