Universal Robots Forum

What means the keyword "sec"?

What exactly does the keyword “sec”? It is mentioned in the scriptManual on page 4: "(either "def"or “sec"keywords)”
But I found no other reference in this document. Can it even be used in URScript? I am getting syntax errors… (I tried to use it to define a thread, that is started automatically)

I found an advice, that it is used in conjunction with the “secondary interface”.

1 Like

The keyword sec is used in combination with the different client interfaces of the UR. If the UR should be controlled externally using script commands, this interfaces can be used. To let the robot execute more than one command and once, the different Script-lines can be combined by putting them in a function. This is then sent to the UR via a Socket communication. For example:

def test():

The sent commands will be executed after the final end is sent to the UR. If in the meantime another function is sent to the UR, the current executed function will be stopped and the new function will be started immediately.

The sec key-phrase is used instead of def to define a secondary function, which is then sent over port 30002 to the UR. This can then be used to execute commands, which do not take physical time to execute. For example:

sec secondaryProgram():
  set_digital_out(1, True)

This program/function will then be executed parallel to e.g. a robot movement.

Under following Link more information can be found: https://www.universal-robots.com/how-tos-and-faqs/how-to/ur-how-tos/secondary-program-17257/

1 Like

@sko wow How is this not mentioned in the urscript manual. That would have helped me a lot. Please add this information🙂

1 Like

@m.birkholz, @ludwig.oefele: Please take a look at the edit. The first explanation was not fully correct.