Hi,
I suggest you to have a look on this SDK : https://underautomation.com
It allows you to remote control the robot (Send UR Script, power on, release brake, ...) but also read data (cartesian and joint position, I/O, ...).
It has a linux ARM example that can run on a Raspberry PI. But you can customize this example for your needs.