pyrcf.components.controller_manager.command_accumulators.cmd_accumulation_policies

Accumulation policies are functions that takes in commands from two controllers and decides how to generate a single command to be sent to the robot.

NOTE: this should ideally be done at joint level, but we are simplifying by doing accumulation at robot-level instead.

Classes

CommandAccumulatorBase

Accumulation policies are functions that takes in commands from two controllers

SimpleCmdOverride

This accumulation policy simply overrides the command from all controllers with the latest

CmdMuxer

This policy combines the commands from all controllers/agents.

Module Contents

class pyrcf.components.controller_manager.command_accumulators.cmd_accumulation_policies.CommandAccumulatorBase

Bases: abc.ABC

Accumulation policies are functions that takes in commands from two controllers and decides how to generate a single command to be sent to the robot.

NOTE: this should ideally be done at joint level, but we are simplifying by doing accumulation at robot-level instead.

abstract accumulate(commands=List[RobotCmd]) pyrcf.core.types.robot_io.RobotCmd

Accumulate the specified commands into a single command to be sent to the robot.

Parameters:

commands (List[RobotCmd]) – the robot commands from different controllers (in sequence).

Returns:

The final control command (action) to be sent to the robot.

Return type:

RobotCmd

Raises:

NotImplementedError – Raised if this method is not implemented by the child class.

class pyrcf.components.controller_manager.command_accumulators.cmd_accumulation_policies.SimpleCmdOverride

Bases: CommandAccumulatorBase

This accumulation policy simply overrides the command from all controllers with the latest one.

accumulate(commands=List[RobotCmd]) pyrcf.core.types.robot_io.RobotCmd

Accumulate the specified commands into a single command to be sent to the robot.

Parameters:

commands (List[RobotCmd]) – the robot commands from different controllers (in sequence).

Returns:

The final control command (action) to be sent to the robot.

Return type:

RobotCmd

Raises:

NotImplementedError – Raised if this method is not implemented by the child class.

class pyrcf.components.controller_manager.command_accumulators.cmd_accumulation_policies.CmdMuxer(allow_conflicting_interfaces: bool = False)

Bases: CommandAccumulatorBase

This policy combines the commands from all controllers/agents.

_cmd: pyrcf.core.types.robot_io.RobotCmd = None
_allow_conflicts = False
accumulate(commands=List[RobotCmd]) pyrcf.core.types.robot_io.RobotCmd

Accumulate the specified commands into a single command to be sent to the robot.

Parameters:

commands (List[RobotCmd]) – the robot commands from different controllers (in sequence).

Returns:

The final control command (action) to be sent to the robot.

Return type:

RobotCmd

Raises:

NotImplementedError – Raised if this method is not implemented by the child class.