How to control an UR5 robot through MATLAB via TCP client

Hello!

I want to control the UR5 CB3 robot using MATLAB by sending the URScript’s commands directly into the socket.
For example, writing a “movej([0.0, 0.0, 0.0, 0.0, 0.0, 0.0])” or a “get_actual_tcp_pose()” in such a way that the robot listens and executes this command/returns the information, without needing a script in the robot’s memory (such as I have done previously in older robots using a serial port).

I am currently setting the communication in the following manner:

host = '10.0.26.182';
port = 30003;
s = tcpclient(host, port,'ConnectTimeout',10,'Timeout',10);
configureTerminator(s,'CR');
fopen(s);
disp('Connected!');

Is the real-time connection appropriate in this case, or should I be using RTDE.
Sorry for my ignorance and thank you beforehand for your help!

Some other updates:

  • I am using my university’s local network, so both the computer and the robot are assigned DHCP;
  • I can ping the robot and receive its returning messages;
  • Using Wireshark I managed to see that the messages are correctly sent from MATLAB in the PC to the robot, but it acknowledges and does not respond:
  • In the Ethernet/IP page in Polyscope the LED remains yellow, as if no scanners were connected.