Custom Joystick Rotation
3 Attachment(s)
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:
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 Code:
babcock.addAction( vizact.spin(1,0,0,90)) #for testing purposes only 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! |
I think I should be able to find a solution by matrix multiplication. However, I'm having some trouble with syntax.
Can someone tell me the correct way to multiply 4x4 and 4x1 matrices? For instance: Code:
import vizmat Therefore, if I uncomment B.set, and comment out B, C = the correct answer of ([[-1],[1.732],[0],[0]]), but then I would need to add another step of extracting just the first column from the matrix. |
I solved the matrix multiplication using the following great code by kai.
http://www.syntagmatic.net/matrix-mu...ion-in-python/ |
Defining & Using Multiple Centers (of Rotation)
HELLO!
I'm still trying to find out how to set multiple centers (three) for my custom joystick. Separately, my three joystick centers (and rotations/translations) work perfectly. However, when I try and put all three of the centers (and rotations/translation) into one main function, I get three separate joysticks or the last of the centers overwrites the first two. Can someone please tell me how I can have three successive centers (and rotation/translation functions) for my joystick? The pseudo code would look something like: Code:
def Kinematics_1(): Code:
shaft = viz.add('shaft.dae', pos = (0,5,-5)) |
Setting the center should change the rotation point but will not affect the position of the object. You should be able to modify the center as many times as you want during the course of the script. You can use the node.getCenter command to verify the center is where you expect it to be.
It's a bit difficult to understand the problem without having an example to run. Can you create an example using Vizard's included resources that reproduces the issue and can be run directly? |
Jeff, thanks for the reply. I've created a simple example below for your review. I've assigned three different centers to rotate about in my Kinematic function.
Code:
import viztask Furthermore, the 'f' key would not rotate with viz.REL_LOCAL for some reason, but does for viz.REL_PARENT (even though there is no parent present). Thanks for your help. Hopefully I'm missing something silly. |
Quote:
Code:
shaft.center = (1,1,1) Code:
shaft.center(1,1,1) Code:
import viztask Quote:
|
1 Attachment(s)
Jeff,
I'm getting closer, but still not quite there. I can get the centers assigned correctly, but my simulation displays my tool in what looks like 3 different places at the same time still (attached). I think the centers, eulers, and positions are not getting assigned quite quickly enough, therefore, there's a small lag between each. Is there a better way to do what I'm trying to accomplish (get the shaft to rotate/position with three separate centers in one visual piece)? Altering the subtasks with yields (setCenters) hasn't changed anything. Thanks again for your help! Updated Code: Code:
def Kinematics_1(): |
I realize this is hard to troubleshoot, but does no response mean you're out of ideas?
|
Sorry for the delay responding. As I mentioned before it's best to post simple example code that shows the problem clearly and that can be run directly.
It sounds like your questions are project specific. You may be interested in our closed support forum where you can get more assistance with that. For more information please contact sales@worldviz.com. |
All times are GMT -7. The time now is 04:22 AM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC