URScript Extensions

Hello,

I’m trying to connect a camera system from a UR5 robot via TCP/IP. The camera uses an asci protocol but
I’m unable to parse the protocol on the robot with URScript (3.4.2) language. I haven’t found any string
manipulation functions.

Is there any way to extend the URScript language on the robot to parse the camera protocol? Maybe by
writing custom python modules or c++ libraries?

URScript does not natively support string handling functions, other than comparison,
However if the camera is able to transmit a float value as ASCII in this format "(1.23, 2.34, 3.45)" it is possible directly to receive this, and convert to numerics by the function data = socket_read_ascii_float(n).

However you might find XML-RPC useful, e.g. check out the XML-RPC Math example in the Samples topic.
This implements an example of string functions.

Alternatively use a URCap to implement a daemon, to perform a handshake between the camera, and URScript.

The camera protocol doesn’t transmit the values in form that is readable by URScript right now. This solution would require to modify the camera protocol.

For XML-RPC a special XML-RPC server is needed to proxy data between camera and URScript. URScript would act as a client to that server. No extra code on the robot would be needed but an XML-RPC server is needed and that has to run somewhere.

The URCap daemon solution sounds interesting. Could you please get a bit deeper into the details of this. Is it like URScript talks to URCap daemon (c++) on the robot and that daemon talks to the camera?

Yes, with the daemon contribution, this could act as a handshake between the URScript, and the camera. so the daemon can relay the information in the protocol desired.

The handshake towards URScript could e.g. be an XML-RPC server, or some other socket comminucation form, based on C++, Python 2.7, Java or another preferrence you yours.

E.g. take a look at the MyDaemon sample in the URCaps SDK, and the XML-RPC Math sample in the Samples topic.
These both implement a daemon.

Hi,
Just to be sure, and to warn others peoples reading this, but we can’t use Python2.7 on our urcaps, were limited to the 2.5 version right? If we wan’t to use 2.7, we have to use another computer right ?
(Tested it just about a minute ago to be sure, and I don’t work, maybe it’s fine if we manually install Py2.7 on the robot, but it won’t be installable as standard urcap )
(I had to rewrite a full library because it wasn’t working on 2.5, it’s why I tilted at your post)

@mdi
Be aware that the Python version is different, depending on the hardware version of the robot.
Namely between CB3.0 and CB3.1

Thank you, I didnt know that CB3.1 was in Python2.7,
It’s already a great thing, maybe we will get Python3 to the next one :wink:
(I’ll will make a detailed “feature request” post later on it)