#1
|
|||
|
|||
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! |
#2
|
|||
|
|||
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.
|
#3
|
|||
|
|||
- 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...
|
#4
|
|||
|
|||
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. |
#5
|
|||
|
|||
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. |
#6
|
|||
|
|||
Quote:
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() |
#7
|
|||
|
|||
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.
|
#8
|
|||
|
|||
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.
|
#9
|
|||
|
|||
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
|
#10
|
|||
|
|||
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? |
#11
|
|||
|
|||
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 |
#12
|
|||
|
|||
Perfect, that's exactly what was needed. Thanks!
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Vicon Plugin | Micheal | Plug-in development | 2 | 08-29-2007 04:03 AM |