roboglia.move.Script

class Script(name='SCRIPT', patience=1.0, times=1, robot=None, defaults={}, joints=[], frames={}, sequences={}, scenes={}, script=[])[source]

Bases: roboglia.move.thread.StepLoop

A Script is the top level structure used for defining prescribed motion for a robot.

Parameters
  • name (str) – The name of the script

  • patience (float) – A duration in seconds that the main thread will wait for the background thread to finish setup activities and indicate that it is in started mode.

  • times (int) – How many times the loop should be played. If a negative number is given (ex. -1) the loop will play to infinite

  • robot (BaseRobot or subclass) – The robot that will be performing the script

  • defaults (dict) –

    A dictionary with default behavior. Supported elements for the moment:

    • ”duration” (specifies the duration of a sequence transition, if no explicit one is provided)

    • others to come…

  • times – The number of times the script steps will be executed when play() will be invoked. Default is 1.

  • joints (list of Joint or subclasses) – An ordered list of joints that are used by the script. The frame definitions later uses this order when describing the states.

  • frames (dict of Frame) – The Frame definitions used by the script. See the information for this class for more details.

  • sequences (dict of Sequence) – The Sequence defintions that are used by the script. See the information for this class for more details.

  • scenes (dict of Scene) – The Scene defintions used by the Script. See the information for this class for more details.

  • script (list of Scene) – An ordered list of Scenes that represent the complete Script. When the script is played the scenes are run in the order provided and, if the times parameter is different than 1, it will repeat the execution in a loop.

__init__(name='SCRIPT', patience=1.0, times=1, robot=None, defaults={}, joints=[], frames={}, sequences={}, scenes={}, script=[])[source]

Initialize self. See help(type(self)) for accurate signature.

classmethod from_yaml(robot, file_name)[source]

Reads the script defintion from a YAML file.

property robot

The robot associated with the Script.

property defaults

Default values for Script.

property joints

The joints used by the Script.

property frames

The dictionary of Frames used by the Script.

property sequences

The dictionary of Sequences used by the Script.

property scenes

The dictionary of Scenes used by the Script.

property script

Returns the script (the list of scenes to be executed).

play()[source]

Inherited from StepLoop. Iterates over the scenes and produces the commands.

atomic(data)[source]

Inherited from StepLoop. Submits the data to the robot manager only for valid joints.

teardown()[source]

Informs the robot manager we are finished.

property name

Returns the name of the thread.

pause()

Requests the thread to pause.

property paused

Indicates the thread was paused.

resume()

Requests the thread to resume.

run()

Wraps the execution between the duration provided and decrements iteration run.

property running

Indicates if the thread is running.

setup()

Resets the loop from the begining.

start(wait=True)

Starts the task in it’s own thread.

property started

Indicates if the thread was started.

stop(wait=True)

Sends the stopping signal to the thread. By default waits for the thread to finish.

property stopped

Indicates if the thread was stopped.