pycram.process_module

Contents

pycram.process_module#

Implementation of process modules.

Classes: ProcessModule – implementation of process modules.

Attributes#

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

SemiRealRobot

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

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.

Module Contents#

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

designators.

execution_delay: typing_extensions.Optional[datetime.timedelta]#

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

_lock#
_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_description. 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_description 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
pre: pycram.datastructures.enums.ExecutionType#
pre_delay: datetime.timedelta#
__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
pre: pycram.datastructures.enums.ExecutionType#
__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__()#
class pycram.process_module.SemiRealRobot#

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

Example:

with semi_real_robot:
    some designators
pre: pycram.datastructures.enums.ExecutionType#
__enter__()#

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

__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#
pycram.process_module.semi_real_robot#
class pycram.process_module.ProcessModuleManager(robot_name: str)#

Bases: abc.ABC

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

execution_type: pycram.datastructures.enums.ExecutionType = None#

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

available_pms: typing_extensions.List[ProcessModuleManager] = []#

List of all available Process Module Managers

_instance: ProcessModuleManager = None#

Singelton instance of this Process Module Manager

robot_name#
_navigate_lock#
_pick_up_lock#
_place_lock#
_looking_lock#
_detecting_lock#
_move_tcp_lock#
_move_arm_joints_lock#
_world_state_detecting_lock#
_move_joints_lock#
_move_gripper_lock#
_open_lock#
_close_lock#
_move_tcp_waypoints_lock#
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

static register_all_process_modules()#
abstract navigate() ProcessModule#
Get the Process Module for navigating the robot with respect to

the execution_type

Returns:

The Process Module for navigating

abstract pick_up() ProcessModule#

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

Returns:

The Process Module for picking up an object

abstract place() ProcessModule#

Get the Process Module for placing with respect to the execution_type

Returns:

The Process Module for placing an Object

abstract looking() ProcessModule#
Get 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() ProcessModule#
Get the Process Module for detecting an object with respect to

the execution_type

Returns:

The Process Module for detecting an object

abstract move_tcp() ProcessModule#
Get 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() ProcessModule#

Get 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() ProcessModule#

Get 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() ProcessModule#

Get 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() ProcessModule#
Get the Process Module for moving the gripper with respect to

the execution_type

Returns:

The Process Module for moving the gripper

abstract open() ProcessModule#
Get the Process Module for opening drawers with respect to

the execution_type

Returns:

The Process Module for opening drawers

abstract close() ProcessModule#
Get the Process Module for closing drawers with respect to

the execution_type

Returns:

The Process Module for closing drawers

abstract move_tcp_waypoints() ProcessModule#
Get the Process Module for moving the Tool Center Point along a list of waypoints with respect to

the execution_type

Returns:

The Process Module for moving the TCP along a list of waypoints