# Directly index only X coordinate of a Pose variable

**URL:** <https://forum.universal-robots.com/t/directly-index-only-x-coordinate-of-a-pose-variable/3342>\
**Category:** Technical Questions\
**Tags:** urscript, variables, arrays\
**Created:** [December 21, 2018, 8:03am UTC](https://forum.universal-robots.com/t/directly-index-only-x-coordinate-of-a-pose-variable/3342 "2018-12-21T08:03:24Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon56349523](https://avatars.discourse-cdn.com/v4/letter/a/cdc98d/32.png) [@anon56349523](https://forum.universal-robots.com/u/anon56349523)\
**Post date:** [December 21, 2018, 8:03am UTC](https://forum.universal-robots.com/t/directly-index-only-x-coordinate-of-a-pose-variable/3342/1 "2018-12-21T08:03:24Z")

</div>

Hi,

I would like to know if is it normal that I can’t use directly the coordinate of a pose If I affect it in a variable example :

var\_1=Waypoint\_1[0] → It returns all the coordinate of the waypoint.

If i want to take only the X coordinate of waypoint 1, I need to do :

var\_1=Waypoint\_1  
var\_2=var\_1[0]

Is there no other way to use only the first example ?

Thanks

---

<div class="post-metadata">

**Author:** ![dsh](https://avatars.discourse-cdn.com/v4/letter/d/ce7236/32.png) [@dsh](https://forum.universal-robots.com/u/dsh)\
**Post date:** [December 26, 2018, 4:32pm UTC](https://forum.universal-robots.com/t/directly-index-only-x-coordinate-of-a-pose-variable/3342/2 "2018-12-26T16:32:08Z")

</div>

Hello Charles,  
I’m not sure why you would be getting that as our robot does allow for indexing in the way described by your first example. I just tested it on the simulator and it works as intended:

MoveJ

- Waypoint\_1
- Waypoint\_2
- var1 = Waypoint\_1[0] //result of var1 is indeed the x value of Waypoint\_1

Are you doing this in Polyscope (our GUI)? Or trying to accomplish this through external communication?

---

<div class="post-metadata">

**Author:** ![anon56349523](https://avatars.discourse-cdn.com/v4/letter/a/cdc98d/32.png) [@anon56349523](https://forum.universal-robots.com/u/anon56349523)\
**Post date:** [December 27, 2018, 6:59am UTC](https://forum.universal-robots.com/t/directly-index-only-x-coordinate-of-a-pose-variable/3342/3 "2018-12-27T06:59:19Z")

</div>

Hi,

I’m doing this on the simulator (3.8).

And my result of var\_1=Waypoint[0] is not the value of X, I don’t know if i’m doing something wrong or not;

see the picture attached :

 ![Return%20of%20var%201](https://us1.discourse-cdn.com/flex020/uploads/universal_robots/original/2X/9/993f40fb05325bc98f579b1456b9a39a6c40dc2d.png)

---

<div class="post-metadata">

**Author:** ![prichlin](https://avatars.discourse-cdn.com/v4/letter/p/b3f665/32.png) [@prichlin](https://forum.universal-robots.com/u/prichlin)\
**Post date:** [December 27, 2018, 9:40pm UTC](https://forum.universal-robots.com/t/directly-index-only-x-coordinate-of-a-pose-variable/3342/4 "2018-12-27T21:40:33Z")

</div>

Hello Charles,  
I was able to reproduce the same results as you found in CB3 3.8.

**Suggested solution to your problem:**  
To work around the issue, try Assigning the position to a temporary variable (var\_pose below) and then taking the X coordinate from that instead.

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

```
 Please let us know if you have any questions.
```

---

<div class="post-metadata">

**Author:** ![ajp](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/ajp/32/471_2.png) [@ajp](https://forum.universal-robots.com/u/ajp)\
**Post date:** [December 28, 2018, 7:36am UTC](https://forum.universal-robots.com/t/directly-index-only-x-coordinate-of-a-pose-variable/3342/5 "2018-12-28T07:36:09Z")

</div>

I am seeing same behaviour in 3.8, but none of the previous versions of CB3 software or the e-Series 5.x releases will let me address a waypoint directly in this way, which makes me think it is unintentional. @dsh can you elaborate on what you did and in what version?

---

<div class="post-metadata">

**Author:** ![dsh](https://avatars.discourse-cdn.com/v4/letter/d/ce7236/32.png) [@dsh](https://forum.universal-robots.com/u/dsh)\
**Post date:** [December 31, 2018, 6:18pm UTC](https://forum.universal-robots.com/t/directly-index-only-x-coordinate-of-a-pose-variable/3342/6 "2018-12-31T18:18:12Z")

</div>

@ajp I used the online simulator version 5.1.1. It appeared to work for me. Due to the holidays I won’t be in the office until Wednesday but I can check on several of our robots then and verify actual use.

---

<div class="post-metadata">

**Author:** ![Savoia](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/savoia/32/4844_2.png) [@Savoia](https://forum.universal-robots.com/u/Savoia)\
**Post date:** [January 27, 2021, 12:19am UTC](https://forum.universal-robots.com/t/directly-index-only-x-coordinate-of-a-pose-variable/3342/7 "2021-01-27T00:19:50Z")

</div>


