# state.actual\_TCP\_pose results in wrong pose!

**URL:** <https://forum.universal-robots.com/t/state-actual-tcp-pose-results-in-wrong-pose/14498>\
**Category:** URScript\
**Created:** [May 24, 2021, 1:11pm UTC](https://forum.universal-robots.com/t/state-actual-tcp-pose-results-in-wrong-pose/14498 "2021-05-24T13:11:44Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon59108369](https://avatars.discourse-cdn.com/v4/letter/a/f05b48/32.png) [@anon59108369](https://forum.universal-robots.com/u/anon59108369)\
**Post date:** [May 24, 2021, 1:11pm UTC](https://forum.universal-robots.com/t/state-actual-tcp-pose-results-in-wrong-pose/14498/1 "2021-05-24T13:11:44Z")

</div>

Hi all,  
I am using rtde package to communicate with the robot via RTDE  
With the package comes a file called `control_loop_configuration` which contains all the recipes i.e. information from the robot we want to read.  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/universal_robots/original/2X/2/2c919d166d90d3627ece9e1fcf0d8eea0c3f45c6.png)  
I have worked using RTDE for a while now but only now I have noticed the following:  
**Whenever I try to read the TCP pose using RTDE in my python script, the values of the pose [x,y,z] correspond to those that appear on the polyscope. However, that is not the case with the orientations/ [Rx,Ry,Rz]**

For example:  
Values obtained using` state.actual_TCP_pos`e: [1.2297, -2.40791 0.1764]  
in polyscope: [1.622, 3.176, -0.233]

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

I know how to read and write registers and how to work with the robot but that seems like something internally in the robot is not right.  
Any help?

@ajp @Ebbe

---

<div class="post-metadata">

**Author:** ![mbush](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/mbush/32/76_2.png) [@mbush](https://forum.universal-robots.com/u/mbush)\
**Post date:** [May 24, 2021, 4:54pm UTC](https://forum.universal-robots.com/t/state-actual-tcp-pose-results-in-wrong-pose/14498/2 "2021-05-24T16:54:39Z")

</div>

There are a number of topics on this in the forum. Basically there are two solutions for the rotations and for whatever reason Polyscope displays one and RTDE sends the other.

We noticed the same thing years ago. If you take your RTDE pose and enter it in the move screen you will go to back to the same point you were at when it was recorded by RTDE.

---

<div class="post-metadata">

**Author:** ![anon59108369](https://avatars.discourse-cdn.com/v4/letter/a/f05b48/32.png) [@anon59108369](https://forum.universal-robots.com/u/anon59108369)\
**Post date:** [May 25, 2021, 9:15am UTC](https://forum.universal-robots.com/t/state-actual-tcp-pose-results-in-wrong-pose/14498/4 "2021-05-25T09:15:41Z")

</div>

@mbush I looked at the old posts on the forum that describe the issue. The problem I have is that I am planning smooth trajectory which robot should follow but if the reading from the RTDE of the orientation are switched than I can’t suceed.  
Did you found a solution to how to obtain orientation reading in axis-angle form consistently from RTDE?

I have checked and the reading from the polyscope is given in rotation vector form in [radians]. The recipe `actual_TCP_pose` should output values in axis\_angles i.e. rotation vector.  
Any other suggestions?

---

<div class="post-metadata">

**Author:** ![mbush](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/mbush/32/76_2.png) [@mbush](https://forum.universal-robots.com/u/mbush)\
**Post date:** [May 25, 2021, 2:20pm UTC](https://forum.universal-robots.com/t/state-actual-tcp-pose-results-in-wrong-pose/14498/5 "2021-05-25T14:20:32Z")

</div>

What RTDE is broadcasting is correct, it is just the other solution to the same pose. We record the positions (joint angle and pose) from RTDE and then use these to play back motion. That is how both our BotX and Cobot Welder solutions work for motion. You will get the motion that you expect. We also record joint positions so that we can use those as the qnear when using movej with a inverse kinematics soution.

---

<div class="post-metadata">

**Author:** ![anon59108369](https://avatars.discourse-cdn.com/v4/letter/a/f05b48/32.png) [@anon59108369](https://forum.universal-robots.com/u/anon59108369)\
**Post date:** [May 26, 2021, 11:52am UTC](https://forum.universal-robots.com/t/state-actual-tcp-pose-results-in-wrong-pose/14498/6 "2021-05-26T11:52:17Z")

</div>

Ok I got it finally,  
Thank you for help everyone,

I guess its not needed to use the polyscope values in my situation. I should just stay consistent with the reading from the robot and that will work perfectly then.

---

<div class="post-metadata">

**Author:** ![mbush](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/mbush/32/76_2.png) [@mbush](https://forum.universal-robots.com/u/mbush)\
**Post date:** [May 26, 2021, 1:41pm UTC](https://forum.universal-robots.com/t/state-actual-tcp-pose-results-in-wrong-pose/14498/7 "2021-05-26T13:41:04Z")

</div>

Correct, as long as you are only using the RTDE values everything will work the way you want it to. Glad you got it working. I too sometimes find myself overthinking the issue.

---

<div class="post-metadata">

**Author:** ![anon59108369](https://avatars.discourse-cdn.com/v4/letter/a/f05b48/32.png) [@anon59108369](https://forum.universal-robots.com/u/anon59108369)\
**Post date:** [May 26, 2021, 5:55pm UTC](https://forum.universal-robots.com/t/state-actual-tcp-pose-results-in-wrong-pose/14498/8 "2021-05-26T17:55:09Z")

</div>

Yeah,  
For some reason I got confused that what I see on polyscope actually influences my python code, while it doesnt.  
Thanks again 🙂

---

<div class="post-metadata">

**Author:** ![kaha](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/kaha/32/5058_2.png) [@kaha](https://forum.universal-robots.com/u/kaha)\
**Post date:** [July 5, 2021, 7:47am UTC](https://forum.universal-robots.com/t/state-actual-tcp-pose-results-in-wrong-pose/14498/9 "2021-07-05T07:47:20Z")

</div>

Hello @anon59108369,

As promised I will answer your question while being back from holiday.  
In PolyScope we scale the rotation vector so that it looks more stable and doesn’t flicker so much. The RTDE data is unscaled, but when scaled it corresponds to the GUI values shown in the customer’s screenshot. Anyway, both solutions represents same position. If you want to scale the RTDE reading this portion of code may be useful:

```auto
def tcp_pose_scal():
	v = get_actual_tcp_pose()
	pi=3.1416
	l = sqrt(pow(v[3],2)+pow(v[4],2)+pow(v[5],2))
	scale = 1-2*pi/l
	if ( (norm(v[3]) >= 0.001 and v[3] < 0.0) or (norm(v[3]) < 0.001 and norm(v[4]) >= 0.001 and v[4] < 0.0) or (norm(v[3]) < 0.001 and norm(v[4]) < 0.001 and v[5] < 0.0) ):
		tcp_pose = p[v[0], v[1], v[2], scale*v[3], scale*v[4], scale*v[5]]
	else:
		tcp_pose = v
	end
		
	return tcp_pose
end

```

I’m hoping it answers your question. Wishing you all the best in developing your robotic solution.  
@mbush, it is never too late to have explanation of something 🙂

---

<div class="post-metadata">

**Author:** ![mbush](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/mbush/32/76_2.png) [@mbush](https://forum.universal-robots.com/u/mbush)\
**Post date:** [July 5, 2021, 2:19pm UTC](https://forum.universal-robots.com/t/state-actual-tcp-pose-results-in-wrong-pose/14498/10 "2021-07-05T14:19:38Z")

</div>

@kaha thanks for that! We’ve been asking about that for years!

---

<div class="post-metadata">

**Author:** ![anon59108369](https://avatars.discourse-cdn.com/v4/letter/a/f05b48/32.png) [@anon59108369](https://forum.universal-robots.com/u/anon59108369)\
**Post date:** [July 6, 2021, 4:03pm UTC](https://forum.universal-robots.com/t/state-actual-tcp-pose-results-in-wrong-pose/14498/11 "2021-07-06T16:03:07Z")

</div>

@kaha  
Thank you for an answer.  
It would be beneficial to attach this information in URScript manual in the future releases or other place.  
For a new person it can be very confusing.

---

<div class="post-metadata">

**Author:** ![vvv](https://avatars.discourse-cdn.com/v4/letter/v/41988e/32.png) [@vvv](https://forum.universal-robots.com/u/vvv)\
**Post date:** [June 17, 2024, 10:07am UTC](https://forum.universal-robots.com/t/state-actual-tcp-pose-results-in-wrong-pose/14498/12 "2024-06-17T10:07:33Z")

</div>

I also found this very useful, I was seeing the same issue from the primary interface.
