WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rating: Thread Rating: 3 votes, 5.00 average. Display Modes
  #1  
Old 05-02-2008, 01:23 PM
roman_suvorov roman_suvorov is offline
Member
 
Join Date: May 2008
Location: Kingston, ON, Canada
Posts: 25
Post Integrating InertiaCube and Vicon data

Hello, I'm working on a project a part of which requires tracking the user's movements using both Vicon and InterSense InertiaCube data.
The reason is the fact that the orientational data coming from the Vicon system has a lag of ~100 ms which is actually enough to make a significant difference in a virtual world and even has the potential for generating motion sickness. The InertiaCube, on the other hand, has little to no lag and can correct the orientation that Vicon is displaying with respect to a certain time.
I was wondering if there is a ready solution for integrating these two data sources?
This feature is essential to the project I'm working on, any help would be greatly appreciated. I am using Vizard 3.00.2701 and InertiaCube2 Pro (DLL-compatible).
Reply With Quote
  #2  
Old 05-02-2008, 01:33 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Vizard has built-in support for connecting to Intersense devices and a Vicon server. If you are asking if there is a built-in way to combine the data from these devices, the answer is no.

How do you want the data to be combined? Do you want to use the Vicon data to correct for the drift in the Intersense data? If so, you can setup a timer in your script that periodically updates the heading of the Intersense using the heading from Vicon.
Reply With Quote
  #3  
Old 05-02-2008, 01:42 PM
roman_suvorov roman_suvorov is offline
Member
 
Join Date: May 2008
Location: Kingston, ON, Canada
Posts: 25
Thank you for such a lightning-fast reply!
Too bad there's no built-in feature to do this. What I'm trying to do is to correct Vicon by InertiaCube. Vicon is a 6-DOF system it has both positional and orientational data while InertiaCube has 3 DOF and cannot detect position.
I'm hoping to, so to say, get the best of both worlds and form the final data stream from: 1) Vicon's positional data; 2) Vicon's orientational data (which lags ~100 ms behind) corrected by InertiaCube's orientational data which has a much smaller lag and hence is more accurate.
Reply With Quote
  #4  
Old 05-02-2008, 01:52 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Well, you can blend between the two orientations. For example, your final orientation can be composed of 75% Intersense data and 25% Vicon data. However, you should be aware that the Intersense might accumulate some drift depending on your physical environment (metallic interference etc..). Here is some sample code that will accomplish this:
Code:
q1 = isenseOri.getQuat()
q2 = viconOri.getQuat()

# 'q' will contain quaternion rotation with 75% Intersense data and 25% Vicon data
q = vizmat.slerp(q1,q2,0.25)
Reply With Quote
  #5  
Old 05-08-2008, 05:30 PM
roman_suvorov roman_suvorov is offline
Member
 
Join Date: May 2008
Location: Kingston, ON, Canada
Posts: 25
Question

Thanks again farshizzo. Your tip doesn't seem to help in my case though - "slerp" somehow disables position tracking. I think I am going to go with a manual solution (coding this data integration from scratch).

I don't know if this is related, but here goes: what is this error message I get every run?
Code:
intersense.dls           	Intersense Driver v2.1


********** InterSense Tracker Information ***********

Type:     IS Precision Series device on port 5
Model:    InertiaCube2 Pro

Station	Time	State	Cube  Enhancement  Sensitivity  Compass  Prediction
1	ON	ON	1	   2		3	  2	  0

PPT: cannot open serial port: No such file or directory
PPT: cannot open serial port: No such file or directory
PPT: cannot open serial port: No such file or directory
PPT: cannot open serial port: No such file or directory
** ERROR: Failed to connect to PPT
vizppt.dls               	WorldViz PPT v3.0
Cannot open serial port? InertiaCube is indeed connected through a serial port, but seems to be working fine.
AFAIK "vizppt.dls" is a plugin for "Precision Optical Tracker", the line adding it was present in "gallery.py" example script which I'm using. Is it another tracking device I simply do not have? Is it safe to remove the lines referencing it then?
Reply With Quote
  #6  
Old 05-08-2008, 07:16 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
I really don't see how using the slerp command could disable position tracking. There is probably something wrong with your script, but I can't tell without seeing your code.

The vizppt.dls plugin is for connecting to the WorldViz PPT optical tracking device. If you are not using that device then you can remove remove the plugin from your script.
Reply With Quote
  #7  
Old 05-16-2008, 03:35 PM
roman_suvorov roman_suvorov is offline
Member
 
Join Date: May 2008
Location: Kingston, ON, Canada
Posts: 25
Question pre/post Trans/Quat functions

I hope it's okay to ask a completely different question here regarding the same project..
I am now trying to get position tracking to work properly. Simply doing something along these lines in mytimer callback function doesn't work as expected, as I found out:
Code:
...
def mytimer(num):
if (num == ANIMATE):
... viz.MainView.setPosition(vicon.getPosition()) viz.MainView.setQuat(inertiaCube.getQuat()) ...
...
I decided to form a transformation matrix myself and use viz.MainView.setMatrix method instead:

Code:
...
def mytimer(num):
if (num == ANIMATE):
... mainViewMtx.postTrans(subLists(vicon.getPosition(), prevPosition)) mainViewMtx.postQuat(inertiaCube.getQuat()) viz.MainView.setMatrix(mainViewMtx) ... mainViewMtx = vicon.getMatrix() prevPosition = vicon.getPosition()
Some comments are due:
  1. mainViewMtx is the matrix I construct and eventually assign to viz.MainView every frame. It is updated from its previous value by post-multiplying it first by the change in position (which I get via a call to subLists(minuend, subtrahend), a trivial custom function which returns a list the elements of which are: minuend[0]-subtrahend[0], minuend[1]-subtrahend[1], minuend[2]-subtrahend[2], etc.), and then post-multiplying it by the quaternion I get from InertiaCube.
  2. The change in position is obtained by substracting the position at the previous iteration (prevPosition) from the currect position (vicon.getPosition()). prevPosition and mainViewMtx are updated at the end of each iteration using Vicon's currect data.

As of now, position tracking actually works (that is to say, MainView moves forward as I move forward, etc.), but looking up or down has severe side effects of translating the view in some direction, rotating or tilting of it. Rotating left/right works but also translates the view.

Now I can finally ask the question itself: the underlined bits of code in the second listing seem to me as the source of this problem. What exactly am I doing wrong? Is it their order (i.e., deal with quats before I apply the change in position)? Is it using preTrans/preQuat rather than postTrans/postQuat (by the way, what is the difference in terms of the effect on MainView?)? Is it both?

And another question: I assume the calls vicon.getPosition() and vicon.getMatrix() do not block, that is to say, the execution is not suspended to get the data from Vicon but rather a pre-fetched cached data is used. Is this correct? Otherwise, given that we estimate our Vicon system has a lag of 100 ms, my entire script is WRONG.

In short, I'm lost. I kind of postponed my efforts of integrating Vicon and InertiaCube data in favor of getting this position tracking to work and I seem to be walking into another problem. Any help would be appreciated..

Last edited by roman_suvorov; 05-16-2008 at 03:39 PM.
Reply With Quote
  #8  
Old 05-16-2008, 08:28 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Applying a post rotation to a matrix which already has position data will cause the position data to be rotated as well. So if the position is 1 meter forward and you post rotate the matrix 90 degrees around the Y-axis, the new position will be 1 meter to the right. It seems like you just want to set the rotation of the matrix to the intersense rotation. In that case use setQuat instead.
Code:
mainViewMtx.setQuat(inertiaCube.getQuat())
The Vicon plugin receives data in a separate thread, so it does not block the main graphics thread. So getting sensor data from the plugin will return cached data from the last update.
Reply With Quote
  #9  
Old 05-20-2008, 12:55 PM
roman_suvorov roman_suvorov is offline
Member
 
Join Date: May 2008
Location: Kingston, ON, Canada
Posts: 25
Thanks farshizzo! This seems to work, although the current performance is pretty awful, I estimate the animation lag of ~ 300 ms which is quite bad given that at ~ 100 ms some subjects already experience symptoms of motion sickness.

farshizzo, would you mind looking at the whole script? I'll PM or email it to you, whichever one you find better. Thanks again!
Reply With Quote
  #10  
Old 05-20-2008, 02:10 PM
roman_suvorov roman_suvorov is offline
Member
 
Join Date: May 2008
Location: Kingston, ON, Canada
Posts: 25
Actually, I don't think I can PM this: the script and my comments combine for ~23,500 characters plus I need to attach a ~2.5 MiB output log. Can you PM me your email, farshizzo? Thanks!
Reply With Quote
  #11  
Old 05-20-2008, 05:30 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
You can email me at lashkari@worldviz.com
Reply With Quote
Reply


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


All times are GMT -7. The time now is 04:23 PM.


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