![]() |
|
#1
|
|||
|
|||
![]()
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()) ... 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()
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 02:39 PM. |
#2
|
|||
|
|||
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()) |
![]() |
|
|