WorldViz User Forum calculating angle differences
 Register FAQ Search Today's Posts Mark Forums Read

#1
08-19-2004, 05:17 PM
 tavaksai Member Join Date: Jul 2004 Posts: 22
calculating angle differences

Hello,

I am trying to find a way to rotate a child in a hierarchy
in such a way that it matches the old rotation of
the parent after parent has been rotated.
Here is an example:

parent_euler = parent.get(viz.EULER)

parent.rotate(yaw1, pitch1, roll1)

now do child.rotate(yaw2, pitch2, roll2) such that
the child has the same rotation as (parallel to)
the parent did before parent rotated.

That is,
(parent_euler) == (child.get(viz.EULER, viz.ABSOLUTE_WORLD))

I am guessing that it may be possible to get the angle
difference between old parent rotation and new parent
rotation and then rotating child by that difference, I
just don't know how get the angle difference.

I am using Euler angles as examples here, but matrix trasformations would be ok also.

Is there maybe a way to detach child from parent using
the hierarchy.dlm plug-in and then reattaching them so that
child keeps old rotation (relative to world) after being attached
to parent?

Max
#2
08-19-2004, 05:46 PM
 farshizzo WorldViz Team Member Join Date: Mar 2003 Posts: 2,849
Hi Max,

The following should work:
Code:
```euler = parent.get(viz.EULER)
parent.rotate(yaw,pitch,roll)
child.rotate(euler,viz.ABSOLUTE_WORLD)```
You could also detach the child from the parent and apply the rotation in local coordinates by doing the following:
Code:
```euler = parent.get(viz.EULER)
parent.rotate(yaw,pitch,roll)
#Detach the child from the parent and attach it to the world
child.parent(viz.WORLD)
child.rotate(euler)```
I believe the parent command was introduced in version 2.16, so make sure you have a recent version of Vizard. Hope this helps.
#3
08-20-2004, 07:32 PM
 tavaksai Member Join Date: Jul 2004 Posts: 22
5dt plug-in not working after upgrade

Thanks for the tip,

I actually tried doing method 1, but with my older
the newest version of Vizard and rotation worked
well, but then I got a brand new problem.

It looks like the new 5DT.dls is not working properly or
the new Vizard simply can't communicate with 5DT gloves.
I get a message like, "ERROR: Failed to connect to
5DT glove on COM3". Same for COM4.

my code looks like:
PORT_5DT = 3
PORT_5DT = 4

The odd thing is that after crashing this way,
ports 3 and 4 get "disabled". Even 5DT Glove Manager
can't accesss those ports after that. What I then do is
disable and re-enable com3 and com4 in the windows
hardware device manager.

Where exactly does Vizard look for plugins first?
Does it look in multiple directories?
#4
08-23-2004, 09:30 AM
 farshizzo WorldViz Team Member Join Date: Mar 2003 Posts: 2,849
Hi Max,

Vizard first looks in the local directory of the script, then it looks in the Vizard20/plug-ins directory. Do you have an older version of the plugin in your local directory? I've placed the latest 5dt plugin in a zip file on our webpage. You can download it here This is the same file that came with the 2.17 installer, but maybe the old version wasn't overridden. Just place this file in the Vizard20/plug-ins directory. Let me know if this helps.
#5
08-23-2004, 10:04 AM
 tavaksai Member Join Date: Jul 2004 Posts: 22
found the bug

Hi,

After more extensive testing, I think I found the cause of the glove problem.

take a look at the following code:

import viz

viz.go(viz.PROMPT)

#####################################
# the following 4 lines must be at the top after viz.go !!!!!
# if you put them after the first if/else statement
# (if viz.get(viz.TRACKER): ..... else tracking = 0)
# glove plug-ins will not be loaded although everything
# else will work
#####################################
PORT_5DT = 3
PORT_5DT = 4

if viz.get(viz.TRACKER):
viz.tracker()
tracking = 1
else:
tracking = 0

left_gyro = viz.add('intersense.dls') # left hand
left_gyro.reset()

right_gyro = viz.add('intersense.dls') # right hand
right_gyro.reset()

See the comment in the box at the top.
My old version of Vizard did not have this problem.

BTW, the

euler = someobj.get(viz.EULER)
child.rotate(euler,viz.ABSOLUTE_WORLD)

method worked great in the new version of Vizard, but did
not work on my older one. So, thanks for that.

Max

 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

All times are GMT -7. The time now is 07:20 AM.