# Calculate pose\_trans

**URL:** <https://forum.universal-robots.com/t/calculate-pose-trans/31438>\
**Category:** Technical Questions\
**Created:** [November 17, 2023, 12:12pm UTC](https://forum.universal-robots.com/t/calculate-pose-trans/31438 "2023-11-17T12:12:17Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![PMonforte](https://avatars.discourse-cdn.com/v4/letter/p/e36b37/32.png) [@PMonforte](https://forum.universal-robots.com/u/PMonforte)\
**Post date:** [November 17, 2023, 12:12pm UTC](https://forum.universal-robots.com/t/calculate-pose-trans/31438/1 "2023-11-17T12:12:18Z")

</div>

Greetings URCommunity,  
I am trying to mathematically calculate the pose\_trans command. I have a pose p[-0.3205;-0.8276;-0.339;0,0,1.5712] and base coordinates p[0.6336;-0.0792;0.35;2.1995;2.2428;0.007].

When I run the command pose\_trans(p[-0.3205;-0.8276;-0.339;0,0,1.5712], p[0.6336;-0.0792;0.35;2.1995;2.2428;0.007]) I get p[-0.2415;-0.195;0.0118;0.03122;-3.1385;-0.00523]. Mathematically, how could I get to this result?  
Any help is much appreciated  
Best regards,  
Pedro Monforte

---

<div class="post-metadata">

**Author:** ![tizh](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/tizh/32/4176_2.png) [@tizh](https://forum.universal-robots.com/u/tizh)\
**Post date:** [November 20, 2023, 3:23am UTC](https://forum.universal-robots.com/t/calculate-pose-trans/31438/2 "2023-11-20T03:23:51Z")

</div>

Hi,  
Mathematically, it is multiply of transformation matrix.  
But firstly, a point vector shall be translated to transformation matrix, the last three parameters in p[-0.3205;-0.8276;-0.339;0,0,1.5712] , ‘0,0,1.5712’ is in form of Rotation Vector, not RPY or other form.

support site article for your reference: [Universal Robots - Explanation on robot orientation](https://www.universal-robots.com/articles/ur/application-installation/explanation-on-robot-orientation/)

 ![image](https://us1.discourse-cdn.com/flex020/uploads/universal_robots/original/2X/8/8f0580faed1e727871619ab8af50ffa19f03e56e.png)

---

<div class="post-metadata">

**Author:** ![PMonforte](https://avatars.discourse-cdn.com/v4/letter/p/e36b37/32.png) [@PMonforte](https://forum.universal-robots.com/u/PMonforte)\
**Post date:** [November 20, 2023, 9:49am UTC](https://forum.universal-robots.com/t/calculate-pose-trans/31438/3 "2023-11-20T09:49:19Z")

</div>

Hi,  
Thank you very much for your reply. I had already found that page and even other posts but I was unable to wrap my brains around this. What I really wanted was to have a more in-depth explanation, step by step (I know this is not easy to do via forum) because I can’t seem to get there. Then again, the base coordinates are the following: p[0.6336,-0.0792,0.3508,2.1995,2.2428,0.007] and I want to have these coordinates related to a plane/pose p[-0.3205,-0.8276,-0.339,0,0,1.5712]. After doing the pose\_trans I get the p[-0.2415,-0.195,0.0118,0.03122,-3.1385,-0.00523]

How many matrixes do I even need and how does a 4x4 matrix will multiply with a 6x1 array?

Any help is much appreciated  
Best regards  
Pedro

---

<div class="post-metadata">

**Author:** ![cg1](https://avatars.discourse-cdn.com/v4/letter/c/c77e96/32.png) [@cg1](https://forum.universal-robots.com/u/cg1)\
**Post date:** [November 20, 2023, 11:17am UTC](https://forum.universal-robots.com/t/calculate-pose-trans/31438/4 "2023-11-20T11:17:32Z")

</div>

Try looking here.

> [@Pose\_trans and pose\_inv functions in URCap](https://forum.universal-robots.com/t/pose-trans-and-pose-inv-functions-in-urcap/1257/2):
>
> For future readers, I managed to re-implement pose\_trans and pose\_inv in java. You first have to convert the pose to an affine transformation. To do this, you need to calculate the rotation vector as a 3x3 rotation matrix (see [Maths - AxisAngle to Matrix - Martin Baker](http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToMatrix/index.htm)). Then you extend that 3x3 rotation matrix to the 4x4 affine transformation by adding a 4th column vector that corresponds to \<x,y,z,1\>, and a 4th row vector \<0,0,0,1\> so it looks like | R | T | |-------+---| | 0 0 0 | 1 …

---

<div class="post-metadata">

**Author:** ![PMonforte](https://avatars.discourse-cdn.com/v4/letter/p/e36b37/32.png) [@PMonforte](https://forum.universal-robots.com/u/PMonforte)\
**Post date:** [November 21, 2023, 10:02am UTC](https://forum.universal-robots.com/t/calculate-pose-trans/31438/5 "2023-11-21T10:02:59Z")

</div>

Thank you very much. I had already skimmed through it and it works fine for the linear coordinates (x,y,z), but not for the angular ones.  
With the example I gave I was able to get to the -0.2413,-0.194,0.0118 as x,y,z respectively. Yet, a pose needs the angular part (Rx, Ry, Rz) and I can’t get to them.  
Any help is much appreciated since it’s vital I can get this computerized, otherwise my app won’t work  
Best regards  
Pedro Monforte

---

<div class="post-metadata">

**Author:** ![PMonforte](https://avatars.discourse-cdn.com/v4/letter/p/e36b37/32.png) [@PMonforte](https://forum.universal-robots.com/u/PMonforte)\
**Post date:** [November 21, 2023, 11:28am UTC](https://forum.universal-robots.com/t/calculate-pose-trans/31438/6 "2023-11-21T11:28:11Z")

</div>

To make things easier to understand here’s what I have.  
One transformation matrix is:  
 ![Capture](https://us1.discourse-cdn.com/flex020/uploads/universal_robots/original/2X/6/62cbccf2aa8be90c1dc9bc9ede2228956ff09703.png)

Then there is another which is  
 ![Capture1](https://us1.discourse-cdn.com/flex020/uploads/universal_robots/original/2X/2/26efc7e621b1b851098ea727222adbfe8237ba0f.png)

Mutliplying this I get the following matrix  
 ![Capture2](https://us1.discourse-cdn.com/flex020/uploads/universal_robots/original/2X/7/7f0dac39844f956642ab7dc744ee6fe96f755546.png)

The last column corresponds to the transformed coordinates x,y,z (the 1 is irrelevant).  
If I use these matrixes to change the rotations it does not give me the proper result

---

<div class="post-metadata">

**Author:** ![PMonforte](https://avatars.discourse-cdn.com/v4/letter/p/e36b37/32.png) [@PMonforte](https://forum.universal-robots.com/u/PMonforte)\
**Post date:** [November 21, 2023, 11:30am UTC](https://forum.universal-robots.com/t/calculate-pose-trans/31438/7 "2023-11-21T11:30:21Z")

</div>

As far as the rotation matrixes are concerned it should be something like this, right?  
 ![Capture3](https://us1.discourse-cdn.com/flex020/uploads/universal_robots/original/2X/d/d32692d109dc40c9f160204d888569016b836b9b.png)  
The result however is this:  
 ![Capture4](https://us1.discourse-cdn.com/flex020/uploads/universal_robots/original/2X/7/700faad20a5b5ce0e0bb9bf16f9831950f0544a4.png)  
Which is clearly not what I want to obtain

---

<div class="post-metadata">

**Author:** ![cg1](https://avatars.discourse-cdn.com/v4/letter/c/c77e96/32.png) [@cg1](https://forum.universal-robots.com/u/cg1)\
**Post date:** [November 21, 2023, 2:27pm UTC](https://forum.universal-robots.com/t/calculate-pose-trans/31438/8 "2023-11-21T14:27:30Z")

</div>

Please read through it ones more as it works for both.

I have personally implemented the method described in this post an replicated pose\_trans perfectly.

it does both because the affine transformation matrix is a combined translation and rotations matrix.

you should not calculate them individually like you are trying to as the translations is dependent on the rotations and both therefore have to be calculated together at ones.
