Universal Robots Forum

Creating URCap with deamon

So I’ve looked at the URCap sample for the “mydeamonswing” and I would like to implement a python deamon into a current URCap for serial communication to the robot. However, I don’t know much about deamons other than the basics.

I was looking over the deamon sample and notice that compared to all the other samples, it had an additional folder called daemon

Quesions:

  1. What is this deamon folder for? How can I generate it if I wanted to run a deamon in my URCap
  2. There also is a folder in the src/main/resources called com which I know stores the python file in order to run functions. But there is also a HelloWorld application that I don’t know the reason it is there

To sum it up I really just wanna the start up to create a deamon.

Many Thanks.

Hi!

First:
Think of a daemon like being a normal program (C-executable or python script or any other script or executable) except for one thing: It has no user interaction (no input and output and for sure no GUI) (to be precise: There is (indirect) interaction (I/O) only via files, signals, pipes, sockets and stderr, but not by stdin and stdout).
In order to be useful a urcap daemon will normally communicate with the script by xmlrpc.

Second:
The example (mydaemonswing) shows two kinds of daemons in one example: A python script and a C-executable. By default, the python script is active while the C-executable is deactivated (commented out).

  1. The daemon folder is for a C (or C++) project. Because somehow you have to generate the C executable to be used as a daemon. It is not really used in the example (deactivated), but the python script is used as the daemon script/executable.

  2. The HelloWorld is the result of the (compiled and linked) source in the daemon folder (see 1.). It is a drop-in-replacement for the python script “hello-world.py”. To activate it, you have to make some changes (comment in/comment out) in the source file “MyDaemonDaemonService.java” (line 29/30)

Since you want to use a python daemon, you can simply ignore the daemon folder and the HelloWorld application.

-Ludwig

1 Like

Hey @ludwig.oefele

So the mydeamonswing example did not use the the C executable for daemon (the daemon folder)? Because I did look through the code, and It didn’t really seem like they did use it.

image

So really all I need is this com folder and I assume all sub folders that leads to a python folder in which I will be using as the daemon (exlcluding the HelloWorld application).

Alright

Thank You!

Hi nguyena!

Correct.
See in MyDaemonDaemonService.java the fucntion get Executable(). The python script is returned there. Returning the HelloWorld executable is commented out.

-Ludwig

1 Like