Realtime UR connection #306
-
I'm trying to get the robot actual TCP position from a UR robot from grasshopper using robots. I have seen some previous posts here which use the URReal class which is deprecated. So I tried to implement it using the URRealTimeDataExchange class. I managed to connect to the robot and get some values in return, but all the values are always 0. For instance, the code below returns a array of 6 values in the TCPPosition output: [0,0,0,0,0,0] `private void RunScript(
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I would change this so that the URRealTimeDataExchange instance is a field rather than a local variable inside RunScript. Initialize it only once and run the component on a loop with a timer, without reinitializing it on every call to RunScript. |
Beta Was this translation helpful? Give feedback.
Thanks for the advice. I have done as you suggested but I'm still only getting [0,0,0,0,0,0] as TCP position. Here is how the code looks:
`public class Script_Instance : GH_ScriptInstance
{
// Persistent fields
private URRealTimeDataExchange urRTDE; // Persistent RTDE connection
private bool isConnected = false; // Connection status
private List lastTCPPosition; // Store last successful TCP position
private List logs = new List(); // Log messages