WorldViz User Forum Vizard/Kinect Gesture Reader Code
 User Name Remember Me? Password
 Register FAQ Search Today's Posts Mark Forums Read

 Thread Tools Rate Thread Display Modes
#1
04-05-2015, 07:31 PM
 cmeans Member Join Date: Mar 2015 Posts: 2
Vizard/Kinect Gesture Reader Code

I'm a beginner to Vizard. I'm trying to write code that will recognize when the user has their right arm in a right angle. I'm using vizmat.AngleBetweenVectors() to try and get the angle between the right shoulder and the right hand. To my mind, if you hold your arm at a right angle, it will read ~90 degrees.
I'm encountering two problems:
1) As I move my arm back and forth, holding it at a right angle, the degrees change.
2) It's not reading 90 degrees.

Here is my code:
Code:
```def RightArmAngle():
RShoulder = vrpn.addTracker('Tracker0@localhost',RIGHTSHOULDER)
RSpos = RShoulder.getPosition()
RHand  =vrpn.addTracker('Tracker0@localhost',RIGHTHAND)
RHpos = RHand.getPosition()
RHvec = viz.Vector(RHand.getPosition(),normalize = True)
RSvec = viz.Vector(RShoulder.getPosition(),normalize = True)
RAVector=vizmat.AngleBetweenVector(RSvec,RHvec)#RAVector and RAAngle return the same value
RAAngle = vizmat.AngleBetweenVector(RSpos,RHvec)

print("r elbow:",RHvec)
print("r shoulder:",RSvec)

print("position Angle:", RAAngle, "vs RAVector",RAVector)
print("new")

vizact.ontimer(1,RightArmAngle)```
Here are some diagrams and my outputs:

Raised Arm, Turned to Side. Vector Returned: ~31

Right-Angled Arm, Held in Front, Vector Returned: ~23

Right-Angled Arm, Held to Side, Vector Returned: ~16

I'm confused as to how thought this would be a simple way. Should I try to make a triangle instead? Or should I just be returning one Euler value and finding the angle from that?
#2
04-09-2015, 06:01 PM
 Jeff WorldViz Team Member Join Date: Aug 2008 Posts: 2,465
You would need to track three points (hand, elbow, and shoulder) in order to get two vectors and then calculate the angle between those.

 Tags angles, kinect, movement, vizard

 Thread Tools Display Modes Rate This Thread Linear Mode Rate This Thread: 5 : Excellent 4 : Good 3 : Average 2 : Bad 1 : Terrible

 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 Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Announcements Vizard Precision Position Tracker (PPT) Plug-in development

 Similar Threads Thread Thread Starter Forum Replies Last Post Queenss_RA Vizard 2 05-13-2013 09:22 AM nabrahamson Vizard 0 10-31-2011 07:38 AM kopper Vizard 5 05-23-2011 03:39 AM djones1010 Vizard 1 04-24-2009 09:56 PM djones1010 Vizard 1 03-10-2009 02:58 PM

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

 Contact Us - WorldViz Home - Archive - Top

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