RTDE - Read Robot State and Safety State

I am building a URCap that employs an outside pc running java as the programming language.

I need to check the following robot states;

  1. Program Loaded - Program Running - Program Paused - Program Stopped
    2)Safety States: Normal - Protective Stop - Emergency Stop.

The external pc needs to check the robot Program and Safety State, enable action and then recheck the states during execution and finally close the socket upon external completion.

I have used the Dashboard Server for this purpose successfully but there is a lag in continuous checking that can be up to 30 seconds before a condition change is registered.

I then tried RTDE based on the URCaps sample Get Robot Data posted by jbm on 1 sept 17. I downloaded the com.ur.urcap.sample.getRobotData.tar. I opened the java class "getRobotRealtimeData.java and changed line 17 from “private String TCP_IP = “127.0.0.1”;”
to “private String TCP_IP=“192.168.120.60”;”

I ran the program and got the output from the System.out.println statements. Also, I can read individual lines of the RealtimeMessage[] array using the following statement;
"System.out.println("array line 38= “+RealtimeMessage[38]);”

I think that I have narrowed down what I need but would like to get some verification.
I performed 5 trials and read the array for each of the 5 trials. Each trial had a different robot condition which is the header above the index values and the output is as follows;

My question is this: What is the array index value for program state ( loaded-running-paused) and what is the array index value for safety state ( normal-protective stop - E-stop - fault)

In the alternative; What is the proper java syntax for building a query of the program and safety status using port 30004? I have no issue opening a socket so all I really need is the proper java syntax to poll the robot for it’s state.

Sorry for the long question but I wanted to be specific and show the steps I have taken.
I appreciate any help that might be given on this topic,
Jerry Stokely

Update:
A bit of an ugly solution but I created a couple of java classes and tied the external device execution while loop into discrete calls to the Dashboard server that loop in the execution program and it appears to work well.
So question withdrawn, thanks for taking a look.
Jerry

Hi @jerry.stokely
Thanks for showing your work!

You can find the documentation about the data stream on the Real Time Client (p: 30003) in this article on the support site.
Check out the Excel sheet, and find the tab “RealTime_3.5” - given you are running PolyScope 3.5.
You are correct in assuming, that the safety state is plot 102. The meaning of the individual values are explained in the linked tab “DataStreamFromURController”, and contains both information of safety state including E-Stop.

Plot 86 is the digital inputs.
Plot 132 is the program state. But as ou can see, “playing” and “protective stop” both yield 1, so also check Safety mode together with this information.

1 Like

Generally though, I would recommend using RTDE (p: 30004) over choosing RT or Dashboard.
Both Real Time and Dashboard may have changes, when we perform software updates.
The RTDE interface is more modern, and provides protocol version negotiation.Hence, will be more robust to SW changes.