WorldViz User Forum An implementation of Inverse Kinematics for Vizard
 Register FAQ Search Today's Posts Mark Forums Read

#1
03-14-2014, 05:27 AM
 pwsnow Member Join Date: Apr 2012 Posts: 23
An implementation of Inverse Kinematics for Vizard

Hi everyone,

As those working with avatars know, currently Vizard does not support IK for avatars. Since this was a requirement for my work I decided to implement IK for myself. This was before Vizard 5 was announced, but thought I would share my work so far so that the community has something to work with now.

I am having problems assigning values to the shoulder, elbow and hand joints but the algorithm should work.

The algorithm is from the work of Marcelo Kallmann http://www.hci.iastate.edu/REU09/pub...ulltext-IK.pdf. Using the swing twist decomposition also known as the exponential map and the swivel angle of the elbow to work out the joint values. It does seem to be referenced in a few recent papers as a fast and efficient method for solving IK.

The benefit of the algorithm is that the input is a Vector (position, vgoal) and Quaternion (orientation, qgoal). Meaning that you could use a mouse/xbox controller etc to control the desired position/orientation of the hand. I understand that the best way of implementing IK (as I have found out!) is to use trackers and kinect etc methods. However I know there is also demand for those of us without the technology/requirements for those methods.

The limits of the limbs also provide collision prevention and this IK algorithm can be applied to all limbs too (although this code is only for upper limbs, right limb).

I had to save the .py file as a .txt file due to the forum's upload policy. I'll also copy paste the code in a separate post due to character limits.

I hope it will help people who would like an traditional IK implementation for their work.

Please feel free to contact me or if you have any suggestions/contributions please post them below!

Regards,

Peter

Notes:

My code is pretty messy, and probably not the most readable/efficient but I just wanted to get something working. Any reference to HM stands for HapticMaster to which this IK will be applied to. I have commented these sections out so I could work from home on it without having to have the HapticMaster switched on. For those of you who have a HapticMaster, I would be happy to provide the dle file for you to use it with the IK code. Also alot of the import lines at the top do not need to be included.

The code in its current state gives weird output in terms of the joint positions/orientation. One of the reasons why I wanted to publish the code to the community was that it forces me to take a step back and look at the code more generally than the focused approach I have been taken. I'm hoping that by doing this I might pick up on mistakes etc that I have over looked. E.g very very simple syntax errors which could be the root of the problem. however I expect the problem stems from the transformations applied to the joint's matrixes (VIZ.AVATAR_WORLD etc).

The bulk of the algorithm is converted from C++ to Python from Kallmann's source code which can be found here - http://graphics.ucmerced.edu/software/stik/index.html it also proves that this code can work.

A massive thanks to those on the WorldViz support team who have helped me in the past.
Attached Files
 STIK_TEST_032014NO_HM.txt (25.8 KB, 1026 views)
#2
03-14-2014, 05:41 AM
 pwsnow Member Join Date: Apr 2012 Posts: 23
EDIT! - I just realised that I should mention that Kallmann co-ords are X axis going out, Y axis going up and Z axis going away (from the avatar). So for Vizard the X axis and Z axis are swapped. Also that Kallmann uses local frames in the arm for the joint values, which is a reason why my code gives weird output. The zero position of Kallmann's algorithm might also be causing my code problems too. Food for thought.

 Thread Tools Display Modes Rate This Thread Hybrid 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 Getting Vizard Help with AI Announcements Vizard Precision Position Tracker (PPT) Plug-in development

 Similar Threads Thread Thread Starter Forum Replies Last Post pwsnow Vizard 1 09-06-2012 05:13 AM FranciscoPeters Vizard 2 10-08-2011 04:19 AM

All times are GMT -7. The time now is 11:10 AM.