# URCap servoj xml-rpc c++ realtime pose

**URL:** <https://forum.universal-robots.com/t/urcap-servoj-xml-rpc-c-realtime-pose/14615>\
**Category:** URCap Development\
**Created:** [May 31, 2021, 6:56am UTC](https://forum.universal-robots.com/t/urcap-servoj-xml-rpc-c-realtime-pose/14615 "2021-05-31T06:56:48Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon71656276](https://avatars.discourse-cdn.com/v4/letter/a/a3d4f5/32.png) [@anon71656276](https://forum.universal-robots.com/u/anon71656276)\
**Post date:** [May 31, 2021, 6:56am UTC](https://forum.universal-robots.com/t/urcap-servoj-xml-rpc-c-realtime-pose/14615/1 "2021-05-31T06:56:48Z")

</div>

Hello, I want to use the current position of the robot and some other values to calculate a position through my algorithm and send it to the robot. These points should be dense trajectories. What should I do in URCaps? Is XMl-RPC C++ Can it meet the 125HZ of communication? Or is there any other method to ensure real-time performance, I look forward to your reply

---

<div class="post-metadata">

**Author:** ![anon71656276](https://avatars.discourse-cdn.com/v4/letter/a/a3d4f5/32.png) [@anon71656276](https://forum.universal-robots.com/u/anon71656276)\
**Post date:** [May 31, 2021, 7:33am UTC](https://forum.universal-robots.com/t/urcap-servoj-xml-rpc-c-realtime-pose/14615/2 "2021-05-31T07:33:17Z")

</div>

![image](https://us1.discourse-cdn.com/flex020/uploads/universal_robots/original/2X/f/f90b1dc5c84647d2a182c6b867093660d69eeeed.png)  
As the picture shows, should I use communication such as UDP to send the values of other devices to the dashboard, and then send them to the control box through the primary and secondary interfaces to control the movement of the robot?

---

<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:** [June 2, 2021, 1:26am UTC](https://forum.universal-robots.com/t/urcap-servoj-xml-rpc-c-realtime-pose/14615/3 "2021-06-02T01:26:39Z")

</div>

Hi @anon71656276 ,

You’re right with the servoj part execute dense trajectories, but XMLRPC will not be able to keep up at 125Hz. You should use the general purpose RTDE registers to feed your targets into the robot program instead.

Here’s an example from @anon67600331

> [@Servoj usage from initial to final joint value](https://forum.universal-robots.com/t/servoj-usage-from-initial-to-final-joint-value/13199/4):
>
> Hi, You can find a very simple example on how to use RTDE and servoj here: Best,

This example is using python, if you need to use C++ then you could look into this 3rd party library:

> **[SDU Robotics / ur\_rtde · GitLab](https://gitlab.com/sdurobotics/ur_rtde)**
>
> A C++ interface for controlling and receiving data from an UR robot using the Real-Time Data Exchange (RTDE) interface of the robot. The interface can also be used...

---

<div class="post-metadata">

**Author:** ![anon71656276](https://avatars.discourse-cdn.com/v4/letter/a/a3d4f5/32.png) [@anon71656276](https://forum.universal-robots.com/u/anon71656276)\
**Post date:** [June 3, 2021, 8:04am UTC](https://forum.universal-robots.com/t/urcap-servoj-xml-rpc-c-realtime-pose/14615/4 "2021-06-03T08:04:41Z")

</div>

Thank you very much for your reply, but I have some other questions. I want to encapsulate this function into a URCap, so how can Java be combined with RTDE? Can RTDE functions be used in URCapAPI? What should i do, my god

---

<div class="post-metadata">

**Author:** ![anon71656276](https://avatars.discourse-cdn.com/v4/letter/a/a3d4f5/32.png) [@anon71656276](https://forum.universal-robots.com/u/anon71656276)\
**Post date:** [June 3, 2021, 8:15am UTC](https://forum.universal-robots.com/t/urcap-servoj-xml-rpc-c-realtime-pose/14615/5 "2021-06-03T08:15:22Z")

</div>

I concluded that I am about to complete the URCap with this function: a target position can be calculated by an algorithm based on the real-time value of the external sensor and the real-time position of the robot and sent to the robot, and the servoj can be used to control the movement of the robot, and it can be completed within 125HZ , Can you point me to a feasible way to complete this URCap?

---

<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:** [June 3, 2021, 9:47am UTC](https://forum.universal-robots.com/t/urcap-servoj-xml-rpc-c-realtime-pose/14615/6 "2021-06-03T09:47:32Z")

</div>

Hi @anon71656276 , I would do all of the trajectory calculations in a python daemon and write into the RTDE from there. You could just make a few simple GUI elements in Java to allow control of your underlying daemon.

Some of our articles like this one might help you get started:

[https://plus.universal-robots.com/urcap-basics/ur-software-architecture/](https://plus.universal-robots.com/urcap-basics/ur-software-architecture/)

---

<div class="post-metadata">

**Author:** ![anon71656276](https://avatars.discourse-cdn.com/v4/letter/a/a3d4f5/32.png) [@anon71656276](https://forum.universal-robots.com/u/anon71656276)\
**Post date:** [June 7, 2021, 1:31am UTC](https://forum.universal-robots.com/t/urcap-servoj-xml-rpc-c-realtime-pose/14615/7 "2021-06-07T01:31:41Z")

</div>

Thank you very much. According to what you said, after reading the basic structure of URCap, combined with my needs, I have new questions:

1. According to what you said, use RTDE in myDaemon to send the calculated target position to the register, and then the controller runs the urp program to read the value of the register to make the robot move. Is this correct understanding?
2. Since I want to encapsulate into a URCap, I must ensure that the real-time position is within 125HZ every time from the acquisition of the real-time position to the delivery target position. Can this method ensure the real-time performance of the final URCap running in polyscope??
3. When I installed according to the RTDE tutorial, the error as shown in the figure appeared strange.  
 ![6S89V_5G9SI3{5TGS459V](https://us1.discourse-cdn.com/flex020/uploads/universal_robots/original/2X/4/4817b197401b0636a33274b2580e20ef3a30a90e.png)

Finally, thank you very much for your guidance, all this is to complete a qualified contribution URCap

---

<div class="post-metadata">

**Author:** ![anon71656276](https://avatars.discourse-cdn.com/v4/letter/a/a3d4f5/32.png) [@anon71656276](https://forum.universal-robots.com/u/anon71656276)\
**Post date:** [June 8, 2021, 7:38am UTC](https://forum.universal-robots.com/t/urcap-servoj-xml-rpc-c-realtime-pose/14615/8 "2021-06-08T07:38:43Z")

</div>

I really look forward to hearing from you, my god!

---

<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:** [June 8, 2021, 8:01am UTC](https://forum.universal-robots.com/t/urcap-servoj-xml-rpc-c-realtime-pose/14615/9 "2021-06-08T08:01:35Z")

</div>

Hi @anon71656276 ,

1. Yes this is correct.
2. Yes the RTDE can ensure that new values will be synchronised at 125Hz.
3. I’m afraid this is a 3rd party library that I have never used. Issues can be posted here:

> **[Issues · SDU Robotics / ur\_rtde · GitLab](https://gitlab.com/sdurobotics/ur_rtde/-/issues)**
>
> A C++ interface for controlling and receiving data from an UR robot using the Real-Time Data Exchange (RTDE) interface of the robot. The interface can also be used...

---

<div class="post-metadata">

**Author:** ![anon71656276](https://avatars.discourse-cdn.com/v4/letter/a/a3d4f5/32.png) [@anon71656276](https://forum.universal-robots.com/u/anon71656276)\
**Post date:** [August 5, 2021, 5:53am UTC](https://forum.universal-robots.com/t/urcap-servoj-xml-rpc-c-realtime-pose/14615/10 "2021-08-05T05:53:06Z")

</div>

Hello, I may have encountered a problem, can you please guide me？Here is my question link.

> [@RTDE sends Servoj control problem](https://forum.universal-robots.com/t/rtde-sends-servoj-control-problem/15759):
>
> Dear UR+ development support, I still have some questions when using RTDE and I would like to ask you all. Thanks in advance! Requirement: Send a dense trajectory for the robot to perform Servoj movement Question 1: Directly call the servoj function in RTDE to control the movement of the robot. As shown in the following code, I use simulation mode to check that the robot walks 600 points and takes more than 20 seconds. This is not enough for 125hz. Is this method infeasible? Questio…
