PDA

View Full Version : tracking with multiple LEDS


dan12345
03-27-2008, 08:14 AM
Hello.
I've been trying to solve the age-old problem of tracking multiple LED lights,
and linking one of them to the head, despite the fact that there's no inherent
identity to the different lights.

We had the system installed just a while ago, and with Paul ( from worldviz )
we tried to work out something which would handle head+hand tracking.
attached is the code - it works on a tryouy with markers
and keyboard/mouse tracking, but get's messed up when i try it with PPT tracking, and things don't get tracked correctly. ( both ppt's end
up moving the head, and none the hand, and strange leaps occur )
#########################
### ##HERE IS THE CODE#######
#########################

import viz
import __main__
import viztracker

head = viz.addGroup()
hand = viz.addGroup()
pos1 = None
pos2 = None
headLink = None
handLink = None
head_ori = None
hand_ori = None
posHeadLink = None
posHandLink = None

STEP_SIZE = 4 # STEP_SIZE * real step in life = the step in the VR

def setUp():
global head,pos1,pos2, posHeadLink, posHandLink, head_ori,hand_ori
__main__.PORT_PPT = 1
pos1 = viz.add('vizppt.dls')
pos2 = viz.add('vizppt.dls')
__main__.PORT_INTERSENSE = 4
hand_ori = viz.add('intersense.dls')
__main__.PORT_INTERSENSE = 5
head_ori = viz.add('intersense.dls')

# pos1 = viztracker.Keyboard6DOF()
# pos2 = viztracker.MouseTracker()
# head_ori = viztracker.Keyboard6DOF()
# hand_ori = viztracker.Keyboard6DOF()

posHeadLink = viz.link(pos1,head,enabled=False,mask=viz.LINK_POS )
oriHeadLink = viz.link(head_ori,head,enabled=False,mask=viz.LINK _ORI)
posHandLink = viz.link(pos2,hand,enabled=False,mask=viz.LINK_POS )
oriHandLink = viz.link(hand_ori,hand,enabled=False,mask=viz.LINK _ORI)
vizact.onupdate(viz.PRIORITY_PLUGINS+1,posHeadLink .update) #Manually update link after plugins
vizact.onupdate(viz.PRIORITY_PLUGINS+1,oriHeadLink .update) #Manually update link after plugins
vizact.onupdate(viz.PRIORITY_PLUGINS+1,posHandLink .update) #Manually update link after plugins
vizact.onupdate(viz.PRIORITY_PLUGINS+1,oriHandLink .update) #Manually update link after plugins
update()

def getHead():
return head

def getHand():
return hand

def update():
y1 = pos1.getPosition()[1]
y2 = pos2.getPosition()[1]
if y2>y1 :
posHandLink.setSrc(pos1)
posHeadLink.setSrc(pos2)
else :
posHandLink.setSrc(pos2)
posHeadLink.setSrc(pos1)

#scaleLink = posHeadLink.postScale([STEP_SIZE,1,STEP_SIZE],target=viz.LINK_POS_OP) #Scale movement factor

def resetPos():
posHeadLink.reset(viz.RESET_X | viz.RESET_Z)
posHandLink.reset(viz.RESET_X | viz.RESET_Z)

def resetOri():
head_ori.reset()
hand_ori.reset()


vizact.onkeydown(' ',update)
vizact.onkeydown('t',resetPos)
vizact.onkeydown('r',resetOri)

if __name__ == '__main__' :
viz.go()
#myroom = viz.add('C:/Dan/WorldViz/Vizard30/tutorials/gettingstarted/room.wrl')
setUp()
marker1 = viz.add('marker.wrl')
marker2 = viz.add('marker.wrl')
viz.eyeheight(0)
marker1.color([1,1,0])
viz.link(head,marker1)
viz.link(hand,marker2)
#viz.link(head,viz.MainView)

#######################
END OF CODE
#######################

I also looked at the forum post from 2003
http://www.worldviz.com/forum/showthread.php?t=175
which talks about the problem there, but i saw the solution given
there by the admin doesn't use updated viz terms, such as links and such,
( for example it uses the viz.tracker() command, which i see isn't
being used in the viztracker file, so i guessed it was outdated...)
but manually translates objects according to position. (Is the solution offered there still possible? would you advise it? )

Hope i was clear enough.... would be happy for any help i could get, i'm
pretty desperate myself. I actually want specifically to solve the problem
for 3 ppts and 2 orientation sensors ( Head, Hand, and one more PPT on the leg ), so if you could provide me a solution to that problem speficially that would be the best...
thanks alot!
dan

farshizzo
03-28-2008, 03:58 PM
What are the specific constraints for your setup? Is the head always going to be above the hands? Will the user always be facing a specific direction? There is no general solution, so we need to know your exact requirements before we can provide a useful solution.

dan12345
03-29-2008, 03:52 PM
my requirements -
at the beginning the head will be above the hand, but later on
the person being tracked is supposed to lift his hands above his heads, so not always - the same regarding the PPT we want to have on the person's leg -
at the beginning we planned to reset the positions, by assuming that
head > hand > leg height wise, but later on theoretically the person
might lower his hand beneath the ppt on the leg.

and the viewpoint should stay linked to the person's head...

so in conclusion there won't be any thing permanent throughout the
experiment, but we planned to perform an inital reset at the beginning,
and later on if for some reason something gets messed up, then to
have a keyboard callback which lets us press a key, and perform the same
height test, assuming head > arm > leg.

Thanks,
dan

dan12345
04-01-2008, 03:01 AM
just to make sure you haven't forgotten about me :\

farshizzo
04-01-2008, 09:45 PM
There is no easy solution to this. One method would be to save the initial location of the head/hand/feet when you perform a reset. Afterward, every frame compare the new PPT marker positions to the previous head/hand/feet positions. The marker that is closest to the previous head position will be the head position for the new frame, and so on for the arm/legs. However, this method will break down if you bring the markers close together, or if a marker becomes occluded for an extended amount of time.

dan12345
04-02-2008, 05:39 AM
i'm a bit confounded :
The ppt is able to differentiate between different ppt devices
, after the initial recognition - this is obvious from the fact that watching
the ppt tracking program, each led gets it's own different color, and these
colors stay with the correct ppt device ( for the sake of the argument
let's assume that the ppt's don't get confused between each other or occluded ).

So what prevents us from implementing something which initially finds out
which device is the led/hand/head, according to the initial height of the
device? Assuming that there is no swapping or occlusion, am i wrong
to think that this would work correctly and consistently throughout
the tracking session?

And since assuming that occlusions and swapppings might occur, that's why
we wanted to provide some sort of callback (keyboard), that would perform
the height test again, and reorganize the links between the ppts and the different body parts.... i am abit confused about the different link objects
in vizard and their functions, and that's why i wasn't really able to implement this myself... ( assuming it's possible )

If this is not possible, i would be happy for an explanation where i'm wrong in my thought process, as i guess i'm missing something.....

THANKS!
dan

farshizzo
04-02-2008, 05:55 PM
If you want to assume that the PPT won't swap markers then what exactly is the problem? Once you determine which marker is connected to the head/hand/legs you can link them to the appropriate Vizard objects (viewpoint,models,etc...) like usual.

dan12345
04-02-2008, 11:44 PM
hey farshi
sadly i admit that there is actually no problem! indeed
it seems that it works fine, and the reason it didn't work before,
was just because i didn't update the number of trackers being tracked
from 1 to 2, and this caused the strange behaviour ( obviously ).
well, i'm new to the system! :)
thanks
dan