# Retrieve robot\_mode via python

**URL:** <https://forum.universal-robots.com/t/retrieve-robot-mode-via-python/22906>\
**Category:** URScript\
**Created:** [July 26, 2022, 5:40am UTC](https://forum.universal-robots.com/t/retrieve-robot-mode-via-python/22906 "2022-07-26T05:40:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![i-beck](https://avatars.discourse-cdn.com/v4/letter/i/a88e4f/32.png) [@i-beck](https://forum.universal-robots.com/u/i-beck)\
**Post date:** [July 26, 2022, 5:40am UTC](https://forum.universal-robots.com/t/retrieve-robot-mode-via-python/22906/1 "2022-07-26T05:40:17Z")

</div>

Dear developers,  
I would like to know how to get the **Robot Mode** via **Python** and turn the program into an URCap.  
I assume that Primary\_Client would allow me this but how can I add the script commands into the python code?  
|Robot Modes  
| — | — | — | — | — | — | — |  
|Mode|Description|  
|-1|ROBOT\_MODE\_NO\_CONTROLLER|  
|0|ROBOT\_MODE\_DISCONNECTED|  
|1|ROBOT\_MODE\_CONFIRM\_SAFETY|  
|2|ROBOT\_MODE\_BOOTING|  
|3|ROBOT\_MODE\_POWER\_OFF|  
|4|ROBOT\_MODE\_POWER\_ON|  
|5|ROBOT\_MODE\_IDLE|  
|6|ROBOT\_MODE\_BACKDRIVE|  
|7|ROBOT\_MODE\_RUNNING|  
|8 ROBOT\_MODE\_UPDATING\_FIRMWARE|

kindly.  
Beck

---

<div class="post-metadata">

**Author:** ![eehwee.lim](https://avatars.discourse-cdn.com/v4/letter/e/2bfe46/32.png) [@eehwee.lim](https://forum.universal-robots.com/u/eehwee.lim)\
**Post date:** [May 4, 2023, 7:20am UTC](https://forum.universal-robots.com/t/retrieve-robot-mode-via-python/22906/2 "2023-05-04T07:20:53Z")

</div>

Hi Beck,

The robot\_mode can be retrieved via RTDE.  
See [Real-Time Data Exchange (RTDE) Guide - 22229](https://www.universal-robots.com/articles/ur/interface-communication/real-time-data-exchange-rtde-guide/).

Thanks!  
EH
