rotating a vector in V+

V+ discussions, tips and tricks, sample code, Q & A

rotating a vector in V+

Postby molojose » Tue Feb 28, 2017 1:00 pm

First of all thank you for letting me enter this forum.
And here my first problem and call for help.
I need to rotate a vector in V+. Mathematically this is suppose to be a multiplication (rotation matrix X vector).
how do I do that in V+?
I already tried with * and it didnt work.
SET x.vec.f = x.vec.w*f.orient.w

Thanks for any help.
molojose
 
Posts: 17
Joined: Thu Feb 16, 2017 5:21 am

Re: rotating a vector in V+

Postby molojose » Wed Mar 01, 2017 5:58 pm

Anybody?
Any thoughts?
molojose
 
Posts: 17
Joined: Thu Feb 16, 2017 5:21 am

Re: rotating a vector in V+

Postby stephano » Thu Mar 02, 2017 1:55 am

Hello molojose,

to rotate a vector about the x axis you can use the following code:

Code: Select all
SET x.vec.f = x.vec.f:RX(degree)


rotation.PNG
rotation.PNG (19.23 KiB) Viewed 7106 times


Regards,
Stephan
stephano
 
Posts: 23
Joined: Fri Aug 09, 2013 12:49 am

Re: rotating a vector in V+

Postby molojose » Thu Mar 02, 2017 6:27 am

Thanks for the help Stephano,

I tried that. The problem is that what I acctually want to have is the resulting vector values (X1,Y1,Z1) after the multiplication:

rotation matrix X vector(X,Y,Z) = vector1(X1,Y1,Z1)

I could just programm the multiplication myself to get X1,Y1 and Z1 but I also dont know how to return the roll, pitch and yaw values of an existing transformation. DX,DY and DZ return the X,Y, and Z transformation values but I cant find a function to return the rest?
molojose
 
Posts: 17
Joined: Thu Feb 16, 2017 5:21 am

Re: rotating a vector in V+

Postby stephano » Thu Mar 02, 2017 1:57 pm

Hello molojose,

you can use the "decompose" command to save the different components (x,y,z,yaw,pitch,roll) into an array.

Code: Select all
DECOMPOSE array_name[index] = location



Regards,
Stephan
stephano
 
Posts: 23
Joined: Fri Aug 09, 2013 12:49 am

Re: rotating a vector in V+

Postby molojose » Thu Mar 02, 2017 3:29 pm

Thank you stephano. That is going to help a lot.
Is there also a way to multiply transformations to have the result I am looking for?
molojose
 
Posts: 17
Joined: Thu Feb 16, 2017 5:21 am

Re: rotating a vector in V+

Postby stephano » Fri Mar 03, 2017 7:19 am

Hello molojose,

can you give me some more information about your application and the background of your question?

Maybe there is another way in v+ to achieve your goal.

Regards,
Stephan
stephano
 
Posts: 23
Joined: Fri Aug 09, 2013 12:49 am

Re: rotating a vector in V+

Postby molojose » Fri Mar 03, 2017 9:11 am

I need to program the 4 point method (used for example by KUKA)on a Stäubli so that it can setup custom tools. I did the whole algorithm already. All I need to do now is to write the program in V+. While completing the algorithm I multiplied several vectors by rotation matrices to get these vector coordinates relative to the flange of the robot. I needed to do so becouse all locations to setup custom tools are relativ to the flange but the points given by all robot programs (KUKA, Fanuc, Stäubli, etc) are relativ to the world coordinate system. So I need to multiply the coordinates given by the program by the rotation matrix that represents the orientation of the flange.
molojose
 
Posts: 17
Joined: Thu Feb 16, 2017 5:21 am

Re: rotating a vector in V+

Postby stephano » Mon Mar 06, 2017 1:44 am

See pm
stephano
 
Posts: 23
Joined: Fri Aug 09, 2013 12:49 am


Return to V+

Who is online

Users browsing this forum: No registered users and 2 guests