Rtde Communication with robot

Hi,
I’m trying to use RTDE communication with robot but i don’t understand how to exchange data with it.
I have made RTDE_REQUEST_PROTOCOL_VERSION and RTDE_GET_URCONTROL_VERSION
Now how should i receive information from controller about robot temperature ecc?

I especially need to understand format of package to send robot

Hello,

Have you taken a look at the RTDE reference material on the main website?

https://www.universal-robots.com/how-tos-and-faqs/how-to/ur-how-tos/real-time-data-exchange-rtde-guide-22229/

Yes I have seen but it’s not clare how to receive package from controller and encapsulate data

At the bottom of that page you should be able to find some examples that show how to find temp data:

You can also view the client interfaces page to see if using the secondary interface would work for your implementation:

https://www.universal-robots.com/how-tos-and-faqs/how-to/ur-how-tos/overview-of-client-interfaces-21744/

In UR manuals is recommended to use RTDE because other methods are deprecated.
My question is: Have I to write a specific program in robot teach pendant to comunicate or not?
I would read robot state only using a C# program.
Is it possible with RTDE or I need also to write a program on my robot?

You don’t need to do anything special on the robot to retrieve temperature information via RTDE.
RTDE is an advanced protocol that takes time to set up.
If you want to be quick and connect to the robot in just a few lines, you can use this library to quickly obtain RTDE information:

https://underautomation.com/universal-robots/documentation/rtde

using UnderAutomation.UniversalRobots;
using UnderAutomation.UniversalRobots.Rtde;

var robot = new UR();
var param = new ConnectParameters("192.168.0.1");

// Enable RTDE
param.Rtde.Enable = true;

// Exchange data at 100Hz
param.Rtde.Frequency = 100;

// Select data you want the read from the robot
param.Rtde.OutputSetup.Add(RtdeOutputData.JointTemperatures);
param.Rtde.OutputSetup.Add(RtdeOutputData.ToolTemperature);

// Connect to robot
robot.Connect(param);

// Be notified at 100Hz when data is received
robot.Rtde.OutputDataReceived += Rtde_OutputDataReceived;

////***********

private static void Rtde_OutputDataReceived(object sender, RtdeDataPackageEventArgs e)
{
    double jointBaseTemp = e.OutputDataValues.JointTemperatures.Base;
    double jointElbowTemp = e.OutputDataValues.JointTemperatures.Elbow;
    //double joint...Temp = e.OutputDataValues.JointTemperatures....; // all joints temperature

    double toolTemprature = e.OutputDataValues.ToolTemperature;
}