Home Programming

Discussion

Left ArrowBack to discussions page
StudentStudent Posts: 21 Apprentice
edited April 2017 in Programming
Hi!

I want to generate from the UR10 a txt file with information about the different measures, for example:

Hole 702: OK
Hole 79: NOK (bad precision)
...

Is that possible? If not, which would be the best option? I understand that I need a script (Matlab, C, LabView...) with a TCP server to receive the information from the cobot and then generate the txt. But I have to send the strings one by one?

I mean, I want to do a complete cycle with the cobot (taking different measures) and generate a txt with the results.

Thanks!

Best Answer

Comments

  • StudentStudent Posts: 21 Apprentice
    Thanks, @matthewd92 Solved. Finally I used LabView to receive and create a .txt file with all the strings sent by the cobot. Now I can receive multiple strings over TCP/IP and the function "socket_send_string" with the results of my measures.
  • matthewd92matthewd92 Founding Pro, Tactile Sensor Beta Testers Posts: 1,247 Handy
    You're welcome. 
  • mariem_werfelli22mariem_werfelli22 Posts: 13 Apprentice
    Hi!
    I'm also using labview as server  and UR10 as a client so my robot can send data to labview but i can't send data from labview to Robot so i hope that somebody give me a solution for that
  • matthewd92matthewd92 Founding Pro, Tactile Sensor Beta Testers Posts: 1,247 Handy
    Generally to send data you will have the robot request the data and then wait for the response from the server so something like this:

    # Example of asking camera to trigger and send results
    socket_send_string("trigger", "camera")
    results = socket_read_string("camera") #has two second timeout by default, there are other methods for other data types such as float, binary integer, byte list, etc

    You will need a handler on the server that when the request from the robot is made, what to respond back with 
  • mariem_werfelli22mariem_werfelli22 Posts: 13 Apprentice
    Hi Mathew, 

    can you give me an exemple from labview because i used the command " Socket_read_ascii_float(6)" to recieve data from server to client
  • matthewd92matthewd92 Founding Pro, Tactile Sensor Beta Testers Posts: 1,247 Handy
    I have never used Labview to control a robot so unfortunately I cannot give you that.
  • TesfitTesfit Posts: 4 Apprentice
    @matthewd92
    Hi Matthew,

    I am using the UR10 socket communication to control thee motors by sending string (socket_send_string()) to to PC. This works great but the problem I am having is the every time I send a string I open and close the socket connection. Is there a way where I can avoid open and close connection every time I send string? I want to open the socket connection at the beginning of the program and close the socket at the end of program not every time when I send string.

    example of my current code:

    before Program
    • open=socket_open("IPaddress",port) 
    main program
    • socket_send_string("motor1:on")  
    • close=socket.close()
    • open=socket_open("IPaddress",port) 
    • socket_send_string("motor2:on")
    • close=socket.close()
    • open=socket_open("IPaddress",port) 
    • socket_send_string("motor3:on")
    • close=socket.close()
    Thank you in advance,
    Tesfit 
  • matthewd92matthewd92 Founding Pro, Tactile Sensor Beta Testers Posts: 1,247 Handy
    Just open it at the beginning, the third argument can be a port name as well which you can then use in your send and read commands to make sure they are using the correct port name. 

    Such as: 

    socket_open(“ip”, port, “name”)
    socket_send_string(“message”, “name”)

    as long as you are frequently accessing the port it should stay alive without issue. This is how we control motors as well with sockets. 
Sign In or Register to comment.
Left ArrowBack to discussions page