I am trying to establish communication with Keyence Vision system(CV-X series) using UR5e over TCP/IP.
I am able to read the value from vision controller using:
socket_read_ascii_float().
However, when I am trying to send any commands over socket, for instance,
{Command to change mode form run to set up is: S0}
socket_send_string(“S0”,“CAM1”)
when I am sending this script and checking on Ethernet monitor of Keyence, it is receiving the command S0 but replying with ER,S0,91 which essentially is Error, S0, Timeout error.
Does anyone have any idea how I can fix this because in the script syntax to send, I cannot add timeout??
I really appreciate any suggestions.
Thanks in advance,
I believe your send string command needs to get followed by a socket_send_byte(13) then socket_send_byte(10) to register a new line for a future string to come in. The order could be 10 then 13 fyi, I’m going of of memory and it’s been a bit since I’ve helped with this integration.
Thanks for the suggestion @miwa .
However, I am sending the byte 13 and 10 as well after the main string. But still on the command window, I see the same error.
Can we send a timeout with the send string or any other way it can be achieved?
Post a screenshot of your robot code, and that may help show the issue. If you don’t want your code on the forum, I recommend opening a service case through myUR or reaching out to your distributor.
I believe the Wait 2.0 should go after the socket_send_byte commands. This way, you send the string and new line command consecutively. The connection may be timing out because it is not getting the new line bytes fast enough.
Additionally, when you open your socket in the before start, I recommend assigning the socket_open to a variable, and then looping while that variable is false. This will ensure the socket is actually open before the program continues so you don’t accidentally send commands to an unopened socket. See below: