# How to check if robot is still moving?

**URL:** <https://forum.universal-robots.com/t/how-to-check-if-robot-is-still-moving/16976>\
**Category:** Robot Communication\
**Created:** [October 11, 2021, 3:52pm UTC](https://forum.universal-robots.com/t/how-to-check-if-robot-is-still-moving/16976 "2021-10-11T15:52:59Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jack](https://avatars.discourse-cdn.com/v4/letter/j/cc9497/32.png) [@Jack](https://forum.universal-robots.com/u/Jack)\
**Post date:** [October 11, 2021, 3:52pm UTC](https://forum.universal-robots.com/t/how-to-check-if-robot-is-still-moving/16976/1 "2021-10-11T15:52:59Z")

</div>

I am trying to send commands to move the robot externally through a socket. Is there a way to know if the robot is still moving or if it has reached its destination?

Thank you in advance.

---

<div class="post-metadata">

**Author:** ![anon43065584](https://avatars.discourse-cdn.com/v4/letter/a/eada6e/32.png) [@anon43065584](https://forum.universal-robots.com/u/anon43065584)\
**Post date:** [October 12, 2021, 12:45am UTC](https://forum.universal-robots.com/t/how-to-check-if-robot-is-still-moving/16976/2 "2021-10-12T00:45:32Z")

</div>

Can you get the joint angle of the robot in real time? If so, is it possible to judge the state of the robot based on the difference between the real-time joint angle and the target angle? If the difference between the two is less than the threshold you set, it is considered that the robot has reached the target point. Instead, it is assumed that the robot is moving. Maybe this method is not accurate, but I think you can try it.

---

<div class="post-metadata">

**Author:** ![moliveira](https://avatars.discourse-cdn.com/v4/letter/m/ecb155/32.png) [@moliveira](https://forum.universal-robots.com/u/moliveira)\
**Post date:** [October 12, 2021, 2:21pm UTC](https://forum.universal-robots.com/t/how-to-check-if-robot-is-still-moving/16976/3 "2021-10-12T14:21:54Z")

</div>

When the robot is moving the program state is set to running. You can use that to flag if the robot is stationary or not.

---

<div class="post-metadata">

**Author:** ![Jack](https://avatars.discourse-cdn.com/v4/letter/j/cc9497/32.png) [@Jack](https://forum.universal-robots.com/u/Jack)\
**Post date:** [October 12, 2021, 4:03pm UTC](https://forum.universal-robots.com/t/how-to-check-if-robot-is-still-moving/16976/4 "2021-10-12T16:03:06Z")

</div>

I am assuming you are talking about robotmode. If that is the case, I am pretty sure the program state stays at “running” even if the robot isn’t moving.

If not, can you please provide me with more info about the program state that you mentioned?

Thank you

---

<div class="post-metadata">

**Author:** ![moliveira](https://avatars.discourse-cdn.com/v4/letter/m/ecb155/32.png) [@moliveira](https://forum.universal-robots.com/u/moliveira)\
**Post date:** [October 13, 2021, 1:44pm UTC](https://forum.universal-robots.com/t/how-to-check-if-robot-is-still-moving/16976/5 "2021-10-13T13:44:10Z")

</div>

No, it’s called Program State,

if you look at the client interfaces excel file, it is located under RealTime in row 38. (min version 3.2).  
It returns the status of the program, if a program is running or not. So basically, paused, stopped, and running.

RobotMode return the status of robot, so it returns the following information:  
“No Controller”  
“Disconnected”  
“Confirm Safety”  
“Booting”  
“Power OFF”  
“Power ON”  
“Idle”  
“Backdrive”  
“Running”  
“Updating Firmware”

---

<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:** [October 13, 2021, 2:43pm UTC](https://forum.universal-robots.com/t/how-to-check-if-robot-is-still-moving/16976/6 "2021-10-13T14:43:41Z")

</div>

You could use yet another socket, to call the “is\_steady()” URScript function on the secondary interface.  
Which should tell you if the robot arm is at rest.  
This is quite useful if your program is a continues while loop, reacting on different socket commands. because then then you would always have (programstate == running) even if the Arm is steady/still.

---

<div class="post-metadata">

**Author:** ![Jack](https://avatars.discourse-cdn.com/v4/letter/j/cc9497/32.png) [@Jack](https://forum.universal-robots.com/u/Jack)\
**Post date:** [October 13, 2021, 3:59pm UTC](https://forum.universal-robots.com/t/how-to-check-if-robot-is-still-moving/16976/7 "2021-10-13T15:59:39Z")

</div>

How will the result of is\_steady() get sent back to us, since the secondary port constantly sends the robot info?

If possible, can you show me a snippet of the code of reading the response?

---

<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:** [October 14, 2021, 6:31am UTC](https://forum.universal-robots.com/t/how-to-check-if-robot-is-still-moving/16976/9 "2021-10-14T06:31:23Z")

</div>

look at the following sample:

> [@URCap Sample: URCap-ScriptCommunicator](https://forum.universal-robots.com/t/urcap-sample-urcap-scriptcommunicator/8460):
>
> Dear community, I have forked Jacobs URCap-ScriptCommunicator and added the framework to proxy URScript functions from Java. So far it is only a subset of the functions that are implemented yet. I hope you will add the functions when you need is there and then share it with the rest of the community! Description of functionality: This sample implements a Java class to: Send URScript commands for immediate execution by URControl Extract a variable from URScript to Java Proxy URScript functio…

Specificly the scriptSender and scriptExpoter files found here:

> <https://github.com/EbbeFuglsang/URCap-ScriptCommunicator/tree/master/com.jbm.urcap.sample.scriptCommunicator/src/main/java/com/jbm/urcap/sample/scriptCommunicator/communicator>
>
> //github.com/EbbeFuglsang/URCap-ScriptCommunicator/tree/master/com.jbm.urcap.sample.scriptCommunicator/src/main/java/com/jbm/urcap/sample/scriptCommunicator/communicator
