WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 10-12-2012, 09:00 AM
mhead10 mhead10 is offline
Member
 
Join Date: Mar 2012
Posts: 40
Custom Joystick Rotation

Hello,

I'm trying to find the best way to simulate my grasper (like a tweezer- referred to as "babcock" in my code), which is driven by a custom joystick (I'm including an example picture (attachment # 1) of my joystick (left) and grasper (like a tweezer, on the right) for clarity).

I'm trying to rotate my grasper around three different axes (Rx1, Rx2, Rx3). Therefore, I'm currently thinking the best way to accomplish this is by:
  1. read in data[],
  2. assign new center to Rx1, complete euler rotation # 1,
  3. assign new center to Rx2, complete euler rotation # 2,
  4. assign new center to Rx3, complete euler rotation # 3.


However, when I assign a new center from the original grasper origin, 1 unit in the z-direction away (to obtain Rx1), the center remains at the original origin (as seen in attachment # 3).

Code:
	# move babcock up and forward a bit (1.25, 2) from World Coordinate System
	babcock.setPosition([0,1.25, 2+ data[2]],viz.ABS_GLOBAL)	 # data[2] = TRANSLATION potentiometer
	babcock_axes = vizshape.addAxes(parent = babcock, pos=[0,0,0],scale=[.05,.05,.05])
	X2 = viz.addText3D('X2',pos=[0.1,0,0],color=viz.RED,scale=[0.05,0.05,0.05],parent=babcock)
	Y2 = viz.addText3D('Y2',pos=[0,0.1,0],color=viz.GREEN,scale=[0.05,0.05,0.05],align=viz.ALIGN_CENTER_BASE,parent=babcock)
	Z2 = viz.addText3D('Z2',pos=[0,0,0.1],color=viz.BLUE,scale=[0.05,0.05,0.05],align=viz.ALIGN_CENTER_BASE,parent=babcock)
	
	# center of rotation is 3.5 from original (LCS)
	babcock.center(0, 0, 1) #change center of rotation to Z0 + 1 (DOESN'T WORK?)
	babcock_axes2 = vizshape.addAxes(parent = babcock, pos=[0,0,0], scale = [.05,.05,.05]) #CHANGE local axis to babcock (0,0,1) for Rx1 Rotation
	X3 = viz.addText3D('X3',pos=[0.1,0,0],color=viz.RED,scale=[0.1,0.1,0.1],parent=babcock)
	Y3 = viz.addText3D('Y3',pos=[0,0.1,0],color=viz.GREEN,scale=[0.1,0.1,0.1],align=viz.ALIGN_CENTER_BASE,parent=babcock)
	Z3 = viz.addText3D('Z3',pos=[0,0,0.1],color=viz.BLUE,scale=[0.1,0.1,0.1],align=viz.ALIGN_CENTER_BASE,parent=babcock)
	# why is the new babcock.center over the previous still? attached pic # 3
Furthermore, when I use the spin feature, the new center seems to work correctly.
Code:
	babcock.addAction( vizact.spin(1,0,0,90)) #for testing purposes only
Any suggestions if there is a better method using transformation matrices to accomplish this task? I would use linking, but my virtual grasper is only comprised of the tweezer (babcock) (it does not have the other links as does the joystick in the picture).

Lastly, (a less important problem currently) it seems like my scaling functions are in meters, but the numbers chosen for position are in units of inches for some reason. Is this correct? For example, if I enter a unit of 1 for the new center position distance, it definitely doesn't look like 1m, rather it's more like 1 inch. (as a frame of reference, I put a 1 inch cube (second attachment) in my VR environment, and all the sizes seem correct)

Thanks in advance!
Attached Thumbnails
Click image for larger version

Name:	transformation.JPG
Views:	1174
Size:	46.1 KB
ID:	536   Click image for larger version

Name:	paint.png
Views:	1215
Size:	25.7 KB
ID:	537   Click image for larger version

Name:	lcs.png
Views:	1204
Size:	105.6 KB
ID:	538  
Reply With Quote
 

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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
joystick position nmohandes Vizard 2 01-16-2012 10:03 AM
writing joystick position to a data file Saz Vizard 3 12-17-2008 05:18 AM
Joystick Navigation Vinicius Lima Vizard 7 10-23-2007 10:42 AM
Facetracking and Immersion Joystick Vygreif Vizard 1 01-25-2006 10:56 AM
animating custom faces: in search of "open_mouth" morphs vr_boyko Vizard 1 09-16-2004 10:30 AM


All times are GMT -7. The time now is 03:14 AM.


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