Hey @francesco.menci I have recently released an interface where you can do this over RTDE. See this forum post Universal Robots RTDE C++/Python Interface
An example of your use case in python would be something like:
import rtde_receive
import rtde_control
rtde_r = rtde_receive.RTDEReceiveInterface("127.0.0.1")
rtde_c = rtde_control.RTDEControlInterface("127.0.0.1")
# Set standard digital out
rtde_c.setStandardDigitalOut(0, True)
# Get standard digital output bits, returns current state of the digital outputs. 0-7: Standard, 8-15: Configurable, 16-17: Tool
rtde_r.getActualDigitalOutputBits()
# Mask the bits you want.
# Go to a pick point
pick_point = [-0.143, -0.435, 0.20, -0.001, 3.12, 0.04]
speed = 0.5
acceleration = 0.3
rtde_c.moveL(pick_point, speed, acceleration)
Checkout the documentation with examples and API here: Universal Robots RTDE C++ Interface — ur_rtde 1.5.5 documentation