Stopping and starting the program

Hello !
How do urscript stop the robot’s motion and restore it?
stop after the beep and start the program after the second beep
What commands support programmatic suspend and restart of the program
Thank you

urscript can only stop the program with halt but not pause, play, or resume.

image

The dashboard server can do any of the above:

A play/stop button can also be wired into the controller.

There are a bunch of ways, if you can describe your goal in more detail, I’m sure the community can help you out.

while i > 0:

        #string_from_server = socket_read_string("socket",prefix="",suffix=" N")
        #string_from_server = socket_read_string("socket")
        sleep(2)

        set_standard_digital_out(1, True)                    
    end

I want to loop the program
in the loop read socket At this time, I want to stop the execution of the program
When the condition with scek = “ok” is fulfilled, I run the program and exit the loop

This seems more like a question on basic usage of the urscript library and control structures. Have you reviewed control structures in the script manual?

i = 2

        while (i > 0):
            socket_open(ip_extruder,100, "socket")
            sleep(2)   
            socket_send_string("M109 S50","socket")
            sleep(2)
    
            string_from_server = socket_read_string("socket")
            leep(2)

            #set_standard_digital_out(1, True)

            socket_close("socket")
            sleep(2)
                 
            #popup("zamykam")    
        end

I want to call the REPEAT cycle until the condition is met
The above program freezes (blocks) the UR3 operation of the program

If you have any typos, calls to the socket will lock the pendant up. For example, you have “leep(2)” instead of “sleep(2)”. Sockets are also super laggy, so if you’re repeatedly making calls to it, prepare to lag out anyway

You need to run the open and close socket functions once only.
And use the while loop for the send and read functions.

You also need to have all the code (open, close, read, send) within a try/catch statement, to handle an unexpected connection lost from the other side without your code crashing.

zmiena_e = str_cat("M109 S50","\n")

problem solved !!!
the cause was a missing line break