Universal Robots Forum

Some problems with ur_rtde Python API

Hi friends,

I have some troubles with ur_rtde library using Python (with IO part to be exact): Examples — ur_rtde 1.4.1 documentation

First problem is I cant figure out how to read digital input. There is no equivalent of setStandardDigitalOut for reading purposes.

I’ve tried getActualDigitalInputBits but there is no further explanation how it works in the documentation: API Reference — ur_rtde 1.4.1 documentation

Unfortunately this function always returns 0 no matter of digital input state (I connected combination of H and L state to some inputs via jumper wires). Do anybody know what is going on or how to walk around this problem? My goal is to read digital inputs via RTDE.

Second problem is strange behavior of setAnalogOutputVoltage function. I made a setup where analog input 0 is connected to analog output 0. According to documentation: API Reference — ur_rtde 1.4.1 documentation

setting 0 means minimum voltage, and setting 1 is maximum volatage. Anything between means voltage level is fraction of maximum voltage. Unfortunately this is not a case. To my surprise those voltages are unpredictable. Even more suspicious is that the function takes arguments outside given range 0-1 no problem.

I thought it’s noise or something with wiring but those values are repeatable. There are commands I’ve run + comments:

io.setAnalogOutputVoltage(0, 0) # zero means 0 volts
True

r.getStandardAnalogInput0() # but there is almost 15!
14.71467113494873

io.setAnalogOutputVoltage(0, 1) # one means maximum so 24 volts
True

r.getStandardAnalogInput0() # but there is less than that of 0…
12.574845314025879

io.setAnalogOutputVoltage(0, -1)
True

r.getStandardAnalogInput0()
0.678781270980835

io.setAnalogOutputVoltage(0, -5)
True

r.getStandardAnalogInput0()
0.6878471374511719

io.setAnalogOutputVoltage(0, 5)
True

r.getStandardAnalogInput0()
12.432341575622559

io.setAnalogOutputVoltage(0, 0) # results are repeatable…
True

r.getStandardAnalogInput0()
14.712907791137695

io.setAnalogOutputVoltage(0, 1) # repeatable again
True

r.getStandardAnalogInput0()
12.54891300201416

io.setAnalogOutputVoltage(0, -1) # and again (with some margin of error)
True

r.getStandardAnalogInput0()
0.683063268661499

Any help is very appreciated

This is a 3rd party library produced at University of Southern Denmark. One of the benefits of this is supports C++ where as the standard UR RTDE samples are only for Python. @anpl posted the link to this here a couple of years ago and could potentially assist with this issue.

Personally I have never used this one, but the standard RTDE examples in Python found at the bottom of below article work well for IO handling.

https://www.universal-robots.cn/articles/ur/interface-communication/real-time-data-exchange-rtde-guide/

1 Like

Thanks a lot. I’m also able to get correct values using this library.

I wasn’t able to find this library in Python Package Index. Is it published somewhere else or this is download-only as it is?

Download as is I think, not in any repositories to my knowledge.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.