pycram.process_module

Implementation of process modules.

Classes: ProcessModule – implementation of process modules.

Module Contents

Classes

ProcessModule

Implementation of process modules. Process modules are the part that communicate with the outer world to execute

RealRobot

Management class for executing designators on the real robot. This is intended to be used in a with environment.

SimulatedRobot

Management class for executing designators on the simulated robot. This is intended to be used in

ProcessModuleManager

Base class for managing process modules, any new process modules have to implement this class to register the

Functions

with_real_robot(→ typing_extensions.Callable)

Decorator to execute designators in the decorated class on the real robot.

with_simulated_robot(→ typing_extensions.Callable)

Decorator to execute designators in the decorated class on the simulated robot.

Attributes

simulated_robot

real_robot

class pycram.process_module.ProcessModule(lock)
Implementation of process modules. Process modules are the part that communicate with the outer world to execute

designators.

Create a new process module.

execution_delay = True

Adds a delay of 0.5 seconds after executing a process module, to make the execution in simulation more realistic

block_list = []

List of thread ids for which no Process Modules should be executed. This is used as an interrupt mechanism for Designators

_execute(designator: pycram.designators.motion_designator.BaseMotion) typing_extensions.Any

Helper method for internal usage only. This method is to be overwritten instead of the execute method.

execute(designator: pycram.designators.motion_designator.BaseMotion) typing_extensions.Any

Execute the given designator. If there is already another process module of the same kind the self._lock will lock this thread until the execution of that process module is finished. This implicitly queues the execution of process modules.

Parameters:

designator – The designator to execute.

Returns:

Return of the Process Module if there is any

class pycram.process_module.RealRobot

Management class for executing designators on the real robot. This is intended to be used in a with environment. When importing this class an instance is imported instead.

Example:

with real_robot:
    some designators
__enter__()

Entering function for ‘with’ scope, saves the previously set execution_type and sets it to ‘real’

__exit__(_type, value, traceback)

Exit method for the ‘with’ scope, sets the execution_type to the previously used one.

__call__()
class pycram.process_module.SimulatedRobot

Management class for executing designators on the simulated robot. This is intended to be used in a with environment. When importing this class an instance is imported instead.

Example:

with simulated_robot:
    some designators
__enter__()

Entering function for ‘with’ scope, saves the previously set execution_type and sets it to ‘simulated’

__exit__(_type, value, traceback)

Exit method for the ‘with’ scope, sets the execution_type to the previously used one.

__call__()
pycram.process_module.with_real_robot(func: typing_extensions.Callable) typing_extensions.Callable

Decorator to execute designators in the decorated class on the real robot.

Example:

@with_real_robot
def plan():
    some designators
Parameters:

func – Function this decorator is annotating

Returns:

The decorated function wrapped into the decorator

pycram.process_module.with_simulated_robot(func: typing_extensions.Callable) typing_extensions.Callable

Decorator to execute designators in the decorated class on the simulated robot.

Example:

@with_simulated_robot
def plan():
    some designators
Parameters:

func – Function this decorator is annotating

Returns:

The decorated function wrapped into the decorator

pycram.process_module.simulated_robot
pycram.process_module.real_robot
class pycram.process_module.ProcessModuleManager(robot_name)

Bases: abc.ABC

Base class for managing process modules, any new process modules have to implement this class to register the Process Modules

Registers the Process modules for this robot. The name of the robot has to match the name given in the robot description.

Parameters:

robot_name – Name of the robot for which these Process Modules are intended

execution_type

Whether the robot for which the process module is intended for is real or a simulated one

available_pms = []

List of all available Process Module Managers

_instance

Singelton instance of this Process Module Manager

static get_manager() typing_extensions.Union[ProcessModuleManager, None]

Returns the Process Module manager for the currently loaded robot or None if there is no Manager.

Returns:

ProcessModuleManager instance of the current robot

abstract navigate() typing_extensions.Type[ProcessModule]
Returns the Process Module for navigating the robot with respect to

the execution_type

Returns:

The Process Module for navigating

abstract pick_up() typing_extensions.Type[ProcessModule]

Returns the Process Module for picking up with respect to the execution_type

Returns:

The Process Module for picking up an object

abstract place() typing_extensions.Type[ProcessModule]

Returns the Process Module for placing with respect to the execution_type

Returns:

The Process Module for placing an Object

abstract looking() typing_extensions.Type[ProcessModule]
Returns the Process Module for looking at a point with respect to

the execution_type

Returns:

The Process Module for looking at a specific point

abstract detecting() typing_extensions.Type[ProcessModule]
Returns the Process Module for detecting an object with respect to

the execution_type

Returns:

The Process Module for detecting an object

abstract move_tcp() typing_extensions.Type[ProcessModule]
Returns the Process Module for moving the Tool Center Point with respect to

the execution_type

Returns:

The Process Module for moving the TCP

abstract move_arm_joints() typing_extensions.Type[ProcessModule]

Returns the Process Module for moving the joints of the robot arm with respect to the execution_type

Returns:

The Process Module for moving the arm joints

abstract world_state_detecting() typing_extensions.Type[ProcessModule]

Returns the Process Module for detecting an object using the world state with respect to the execution_type

Returns:

The Process Module for world state detecting

abstract move_joints() typing_extensions.Type[ProcessModule]

Returns the Process Module for moving any joint of the robot with respect to the execution_type

Returns:

The Process Module for moving joints

abstract move_gripper() typing_extensions.Type[ProcessModule]
Returns the Process Module for moving the gripper with respect to

the execution_type

Returns:

The Process Module for moving the gripper

abstract open() typing_extensions.Type[ProcessModule]
Returns the Process Module for opening drawers with respect to

the execution_type

Returns:

The Process Module for opening drawers

abstract close() typing_extensions.Type[ProcessModule]
Returns the Process Module for closing drawers with respect to

the execution_type

Returns:

The Process Module for closing drawers