Scripting Thread Support

rcp.script

Objects related to performance scripting.

class rcp.script.Script[source]

A script is a procedure run as a separate thread which is permitted to block. This supports a simpler notation for linear action sequences as normal procedures instead of callback state machines. The script thread communicates with the main thread solely using message queues to avoid synchronization problems.

Ivars input:

unified input queue; each item is a tuple in which the first keyword identifies the message type

Ivars output:

unified output queue; each item is a tuple in which the first keyword identifies the message type

event_wait(predicate, timeout)[source]

Consume input messages until one is received which satisfies the predicate or the timeout is reached. Returns the non-False value of the predicate or the string ‘timeout’.

script_task()[source]

Entry point for the script to run on a background thread. The default implementation does nothing, this should be overridden in child classes.

sleep(duration)[source]

Sleep for a given duration unless the user issues a stop command. Returns nothing or raises a ScriptStopException.

start()[source]

Start the script process in the background so will run asynchronously. This function returns immediately.

wait_until_stopped(timeout=20.0)[source]

Sleep until the motion generator reports a stopped status or the timeout is reached.

write(string)[source]

Internal method to send a console message to the main thread.

exception rcp.script.ScriptStopException[source]
exception rcp.script.ScriptTimeoutException[source]