WorldViz User Forum  

Go Back   WorldViz User Forum > Plug-in development

Reply
 
Thread Tools Rating: Thread Rating: 6 votes, 5.00 average. Display Modes
  #1  
Old 02-07-2008, 01:30 PM
dudey12 dudey12 is offline
Member
 
Join Date: Feb 2008
Posts: 5
Send a message via MSN to dudey12
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!
Reply With Quote
  #2  
Old 02-07-2008, 06:26 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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.
Reply With Quote
  #3  
Old 02-08-2008, 09:38 AM
dudey12 dudey12 is offline
Member
 
Join Date: Feb 2008
Posts: 5
Send a message via MSN to dudey12
- 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...
Reply With Quote
  #4  
Old 02-14-2008, 12:32 PM
dudey12 dudey12 is offline
Member
 
Join Date: Feb 2008
Posts: 5
Send a message via MSN to dudey12
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.
Reply With Quote
  #5  
Old 02-27-2008, 09:39 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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.
Reply With Quote
  #6  
Old 04-03-2008, 11:54 AM
dudey12 dudey12 is offline
Member
 
Join Date: Feb 2008
Posts: 5
Send a message via MSN to dudey12
Quote:
Originally Posted by farshizzo View Post
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?
Reply With Quote
  #7  
Old 04-03-2008, 12:01 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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.
Reply With Quote
  #8  
Old 04-03-2008, 12:17 PM
dudey12 dudey12 is offline
Member
 
Join Date: Feb 2008
Posts: 5
Send a message via MSN to dudey12
Quote:
Originally Posted by farshizzo View Post
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.
Reply With Quote
  #9  
Old 04-11-2008, 09:34 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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
Reply With Quote
  #10  
Old 04-25-2008, 08:45 AM
sscovil sscovil is offline
Member
 
Join Date: Apr 2008
Posts: 7
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?
Reply With Quote
  #11  
Old 04-25-2008, 08:50 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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.
Reply With Quote
  #12  
Old 04-25-2008, 08:59 AM
sscovil sscovil is offline
Member
 
Join Date: Apr 2008
Posts: 7
Perfect, that's exactly what was needed. Thanks!
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Vicon Plugin Micheal Plug-in development 2 08-29-2007 03:03 AM


All times are GMT -7. The time now is 02:01 PM.


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