WorldViz User Forum Introducing a rotation offset into a link
 User Name Remember Me? Password
 Register FAQ Search Today's Posts Mark Forums Read

 Thread Tools Rate Thread Display Modes
#1
11-10-2013, 03:56 PM
 EnvisMJ Member Join Date: May 2009 Location: Purdue University, West Lafayette, Indiana Posts: 44
Introducing a rotation offset into a link

I am working in a immersive VR simulator, and I am picking up and moving objects around.

Grabbing an object is pretty easy:
Code:
`grabLink = viz.link(hand,object,1)`
This allows it to follow translation and orientation exactly

I can also modify the link to act in a couple different ways by modifying the link like so:

Creating a 'locked rotations' link (the grabbed object follows the translations of the hand, but it's orientation is locked at [0,0,0] exactly)
Code:
`grabLink.setEuler([0,0,0])	#set the yaw, pitch and roll to zero`
Create a 'z-pinned' link (the grabbed object follows rotations exactly, but the block is only able to translate in the z-axis)
Code:
```yPos = object.getPosition()[1]	#y position of object
xPos = object.getPosition()[0]	#x position of object
grabLink.clampPosY([yPos,yPos],1,viz.LINK_FULL_OP)	#clamp item's vertical motion
grabLink.clampPosX([xPos,xPos],1,viz.LINK_FULL_OP)	#clamp item's lateral motion```
Create a 'movement bounded' link (object can't move past the zBound point on the z-axis)
grabLink.clampPosZ([None,zBound],1,viz.LINK_FULL_OP) #clamp item's forward motion

Ok, so all that is working well and good. But now I need to 'offset' the position of the object vs. the hand with a set of offsets
Code:
`rotationOffsets = [x,y,z]`
Anyone know how to get this done?
#2
11-13-2013, 05:51 AM
 Frank Verberne Member Join Date: Mar 2008 Location: Netherlands Posts: 148
I think you're looking for something like this:
Code:
```positionOffsets = [x,y,z]
rotationOffsets = [yaw,pitch,roll]
grabLink = viz.link(hand,object,1)
grabLink.preTrans(positionOffsets)
grabLink.preEuler(rotationOffsets)```
You mentioned in your question that you want to offset the position, but in the piece of code below, there is a variable called rotationOffsets. You can offset the rotation of a link with link.preEuler() and the position of a link with link.preTrans(). Both are described in the code above. Hope that solves your problem!

 Tags grab, hand, link, offset

 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 Andy Vizard 7 06-18-2013 02:30 AM mhead10 Vizard 9 11-26-2012 12:06 PM vijaykiran Vizard 2 09-29-2009 08:39 AM Elittdogg Vizard 1 09-15-2009 06:28 AM jargon Vizard 2 05-14-2005 04:55 PM

All times are GMT -7. The time now is 09:01 AM.

 Contact Us - WorldViz Home - Archive - Top

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