WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   data glove navigation (https://forum.worldviz.com/showthread.php?t=1261)

arielasso 10-24-2007 11:07 AM

data glove navigation
 
Hi, im trying to use 5dt data glove to navigate the 3D environment. i try to use the cameraHandler function, but in that function i cannot call the gesture method. below i try to show what is my idea. anyone can help me how can i navigate the 3D space. i need help as soon as possible.
the main objective that is i want try to do is if i use the data glove and i give the instruction by using index finger point the view can move forward.

any one can help me?!
thanks,
may god bless you.
email: arie_3849@yahoo.com

Code:

import viz
import hand
viz.go()

#Identify the data glove's port.
PORT_5DT = 1

#Add the 5DT sensor
sensor = viz.add('5dt.dls')

##Create a hand object from the data glove
glove = hand.add(sensor,hand.GLOVE_5DT)

##Place the hand in front of the user
glove.rotate(0,-45,0)
viz.MainView.translate(0,0.3,-0.4)
glove.setPosition( 0.03, 0.09, 0.5 )

#Initialize world
viz.clearcolor( viz.GRAY )
ground = viz.add( 'tut_ground.wrl' )



#Add an array with all the gesture names from the 5DT user's manual.
gestureName = ['Fist', 'Index finger point', 'Middle finger point',
'Two finger point', 'Ring finger point', 'Ring-Index finger point',
'Ring-middle finger point', 'Three finger point', 'Little finger point',
'Index and little finger point', 'Little-middle finger point',
'Not ring finger point', 'Little-ring finger point',
'Not middle finger point', 'Not index finger point',
'Flat hand', 'Undefined']

def mytimer(num):
        gesture = int(sensor.get()[-1])
       
        if gesture == 1:
                #Index finger point
                ground.view.move( 0, 0, 1)
        if gesture == 0:
                #Fist
                ground.view.move( 0, 0, -1)


farshizzo 10-24-2007 11:17 AM

There are some problems with your timer. First off, you never register your timer with Vizard, so it is never called. Second, you are incorrectly accessing the viewpoint. Try replacing your mytimer function with the following code:
Code:

def UpdateView():
        gesture = glove.getGesture()
       
        if gesture == hand.GESTURE_INDEX_FINGER:
                #Index finger point
                viz.MainView.move( 0, 0, 1*viz.elapsed())
        elif gesture == hand.GESTURE_FIST:
                #Fist
                viz.MainView.move( 0, 0, -1*viz.elapsed())
               
               
vizact.ontimer(0,UpdateView)


arielasso 10-24-2007 11:56 AM

thank you.now i face the new problem.why the hand picture did not follow the view. i create the hand object.but it static.i want it follow the view.can you help me?!..or i can't do that request?..
i more problem how can i turn left/right for the view?...u can suggest any gesture..
anywhere i want to say thank you very2 much for helping me...
may god bless u sir..
can u help me again..
thanks a lot..

Code:

import viz
import hand
viz.go()

#Identify the data glove's port.
PORT_5DT = 1

#Add the 5DT sensor
sensor = viz.add('5dt.dls')

##Create a hand object from the data glove
glove = hand.add(sensor,hand.GLOVE_5DT)

##Place the hand in front of the user
glove.rotate(0,-45,0)
viz.MainView.translate(0,0.3,-0.4)
glove.setPosition( 0.03, 0.09, 0.5 )

#Initialize world
#viz.clearcolor( viz.GRAY )
ground = viz.add( 'tut_ground.wrl' )



#Add an array with all the gesture names from the 5DT user's manual.
gestureName = ['Fist', 'Index finger point', 'Middle finger point',
'Two finger point', 'Ring finger point', 'Ring-Index finger point',
'Ring-middle finger point', 'Three finger point', 'Little finger point',
'Index and little finger point', 'Little-middle finger point',
'Not ring finger point', 'Little-ring finger point',
'Not middle finger point', 'Not index finger point',
'Flat hand', 'Undefined']

def UpdateView():
        gesture = glove.getGesture()
       
        if gesture == hand.GESTURE_INDEX_FINGER:
                #Index finger point
                viz.MainView.move( 0, 0, 1*viz.elapsed())
       
        elif gesture == hand.GESTURE_FIST:
                #Fist
                viz.MainView.move( 0, 0, -1*viz.elapsed())
               
               
vizact.ontimer(0,UpdateView)


farshizzo 10-24-2007 12:30 PM

Here's a modified version of the script that will always place the glove in front of the user. You can use other gestures to control left/right movement. Or, if you have an orientation tracker device, such as the Intersense IneriaCube, you could use that to steer the viewpoint as well.
Code:

import viz
import hand
viz.go()

#Identify the data glove's port.
PORT_5DT = 1

#Add the 5DT sensor
sensor = viz.add('5dt.dls')

##Create a hand object from the data glove
overlayView = viz.addView()
overlayView.setScene(4)
overlay = viz.addWindow(pos=(0,1),size=(1,1),clearMask=viz.GL_DEPTH_BUFFER_BIT,view=overlayView)
glove = hand.add(sensor,hand.GLOVE_5DT,scene=4,pos=(0,1.5,1.5),euler=(0,-90,0))

#Initialize world
viz.clearcolor( viz.GRAY )
ground = viz.add( 'tut_ground.wrl' )

def UpdateView():
        gesture = glove.getGesture()
       
        if gesture == hand.GESTURE_INDEX_FINGER:
                #Index finger point
                viz.MainView.move( 0, 0, 1*viz.elapsed())
        elif gesture == hand.GESTURE_FIST:
                #Fist
                viz.MainView.move( 0, 0, -1*viz.elapsed())
       
               
vizact.ontimer(0,UpdateView)


arielasso 10-24-2007 01:24 PM

coding below i created to try turn left/right for the navigation. but it just go left and right for the same view. i dont know how can i turn it left/right.

one more thing. can i create a new gesture and call it into vizard?
i'm so sorry if i bothering you.
i hope you can help me to solve my problem.
thanks a lot.


Code:

import viz
import hand
viz.go()

#Identify the data glove's port.
PORT_5DT = 1

#Add the 5DT sensor
sensor = viz.add('5dt.dls')

##Create a hand object from the data glove
overlayView = viz.addView()
overlayView.setScene(4)
overlay = viz.addWindow(pos=(0,1),size=(1,1),clearMask=viz.GL_DEPTH_BUFFER_BIT,view=overlayView)
glove = hand.add(sensor,hand.GLOVE_5DT,scene=4,pos=(0,1.5,1.5),euler=(0,-70,0))

#Initialize world
viz.clearcolor( viz.GRAY )
ground = viz.add( 'tut_ground.wrl' )

def UpdateView():
        gesture = glove.getGesture()
       
        if gesture == hand.GESTURE_INDEX_FINGER:
                #Index finger point
                viz.MainView.move( 0, 0, 1*viz.elapsed())
        if gesture == hand.GESTURE_FIST:
                #Fist
                viz.MainView.move( 0, 0, -1*viz.elapsed())
        if gesture == hand.GESTURE_TWO_FINGER:
                #Two finger point
                viz.MainView.move( 1*viz.elapsed(), 0, 0 )
        if gesture == hand.GESTURE_LITTLE_FINGER:
                #Tumb up
                viz.MainView.move( -1*viz.elapsed(), 0, 0 )
               
       
               
vizact.ontimer(0,UpdateView)


farshizzo 10-24-2007 01:28 PM

If you want to turn left/right instead of moving left/right using the following code:
Code:

#Turn right
viz.MainView.setEuler(90*viz.elapsed(),0,0,viz.HEAD_ORI,viz.REL_LOCAL)

#Turn left
viz.MainView.setEuler(-90*viz.elapsed(),0,0,viz.HEAD_ORI,viz.REL_LOCAL)

I'm sorry, I don't understand your second question.

arielasso 10-24-2007 02:15 PM

for the second question is i want create a new gesture.

5dt glove have application to create new gesture.so i create the new gesture to make the navigation in vizard.

i create the gesture and i saved it as EDIT. the gesture is like this thumb= unflexed index=unflexed middle=flexed ring=flexed and little=flexed.

so i try to call the "edit" gesture. like this
Code:

gesture == hand.GESTURE_EDIT:
                #Tumb up
viz.MainView.setEuler(-90*viz.elapsed(),0,0,viz.HEAD_ORI,viz.REL_LOCAL)

but i was error.
i hope you can help me.
thanks a lot


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

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