Universal Robots Forum

Retrieving information about digital inputs through the real time interface

Hi there,

i currently working to build an interface between python and the UR. I am trying to read the data trough the real time Interface(port 30003). Now i have a problem to read the states of the digital Inputs. Through the file Client_Interface_V3.5.xsl i know that the states of those eight digital inputs is encoded as a 64-bit integer. But i am having Trouble reading those 64 bits to extract which of those eight digital inputs is on or off. Could you help me to decode those eight bytes?

Hi seewald.flo,

You discovered the main challenge of parsing the rt client data! All values in the data stream from the rt client are doubles (except “Message Size” which is an integer). You need to read the “Digital input bits” as a double and then interpret it as an integer so for example “5.00” is interpreted as “5” which is “101” in binary, corresponding to bit 0 and 2 being high.

Makes sense?

1 Like

30003 is what we call “Matlab” interface, so all fields are encoded as doubles.
It’s much more convenient to read from secondary interface 30002.
Masterboard Data in Robot State package contains state of inputs and outputs (among other values).
There is short python script attached that demonstrates how to extract it.