WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
  #1  
Old 06-21-2014, 11:44 PM
agrima agrima is offline
Member
 
Join Date: Jun 2014
Posts: 4
Question animate an object using 5dt data glove 5 ultra

hi;

I have to animate i.e, control the motion of an object using data glove.
I tried grabbing the object , but now i dont know how should i try moving the object in accordance to my glove. I am posting the code below:

import viz
import vizcam
import vizact
import random
import hand

viz.go()
viz.setMultiSample(4)
viz.fov(60)
#viz.go(viz.QUAD_BUFFER)
#viz.go(viz.HALF_RESOLUTION)

PORT_5DT_USB = 0
sensor = viz.addSensor('5dt.dls')
glove = hand.add(sensor,hand.GLOVE_5DT)


vase = viz.add('vase.ive')
vase.setPosition(-160,40,-30)


models={'9.ive'}
model1=viz.add('9.ive')

viz.MainView.setPosition(-160,50,130)
viz.MainView.setEuler(180,00,0)





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 getGesture():
gesture = int(sensor.get()[-1])


if gesture == 7:
#three finger
viz.MainView.setPosition([0,0,0.05],viz.REL_PARENT)
if gesture == 8:
#Little finger point
viz.MainView.setPosition([-0.05,0.0,0],viz.REL_PARENT)
if gesture == 9:
#Little finger and index point
viz.MainView.setPosition([0.05,0.0,0],viz.REL_PARENT)
if gesture == 3:
#two finger point
viz.MainView.setPosition([0,0.0,-0.05],viz.REL_PARENT)
if gesture == 1:
#Index finger point
viz.MainView.setPosition([0,.05,0], viz.REL_PARENT)
if gesture == 0:
#Fist
#vase.setPosition([0,-.05,0], viz.REL_PARENT)
viz.MainView.setPosition([0,-.05,0], viz.REL_PARENT)
if gesture == 14:
viz.link(glove,vase)
viz.grab(glove,vase)


vizact.ontimer(0, getGesture)
Reply With Quote
  #2  
Old 06-23-2014, 04:43 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
The 5dt glove does not provide position data of the hand. Some models provide pitch and roll. Most of the measurements are related to finger movements and hand gestures. You'll need an additional position/orientation tracker mounted on the glove for hand tracking. You can link the glove to the data from a physical tracking device (e.g. PPT, inertia cube) or a virtual tracker using keyboard/mouse inputs. The following code links the glove to a keyboard tracker:

Code:
glove = hand.add(sensor,hand.GLOVE_5DT)

#Create virtual tracker using WASD and other key inputs
import viztracker
handTracker = viztracker.Keyboard6DOF()

#Link the hand to the handTracker
gloveLink = viz.link(handTracker, glove)
Then you can link the vase directly to the handTracker:

Code:
vaseLink = viz.link(handTracker, vase)
or to the gloveLink:

Code:
vaseLink = viz.link(gloveLink, vase)
For future posts, please use code tags to preserve indentation. You can find the guidelines for posting code here.
Reply With Quote
  #3  
Old 06-23-2014, 09:35 PM
agrima agrima is offline
Member
 
Join Date: Jun 2014
Posts: 4
i incorporated the above 3 lines mentioned by you, but now the main view is not at the correct location, it shows the view at the corner of the screen.I tried changing the co-ordinates but in vain.
This problem occurred after i wrote viztracker.go() without which the vase was not responding to keyboard commands.
Reply With Quote
  #4  
Old 07-01-2014, 11:17 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
Are you using viztracker with a vizsetupcfg.py configuration file? If so, then the setup file should contain the code to connect to the glove. In the application that imports the config file, you can get a handle to the hand and link the vase to it. Can you attach your vizsetupcfg.py file if you have one?
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
data glove navigation arielasso Vizard 6 10-24-2007 02:15 PM
Use of 5DT Ultra left handed glove pattie Vizard 1 08-26-2006 12:59 PM
5DT Data Glove 5 Ultra Problem bjgold Vizard 1 08-08-2006 04:08 PM
5DT Data Glove 5 Ultra Flexure Question bjgold Vizard 1 07-25-2006 02:58 PM


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


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