mani_skill.agents.controllers.base_controller#

Classes#

BaseController

Base class for controllers.

CombinedController

A flat/combined view of multiple controllers.

ControllerConfig

DictController

Base class for controllers.

Module Contents#

class mani_skill.agents.controllers.base_controller.BaseController(config, articulation, control_freq, sim_freq=None, scene=None)[source]#

Base class for controllers. The controller is an interface for the robot to interact with the environment.

Parameters:
__repr__()[source]#
_clip_and_scale_action(action)[source]#
_clip_and_scale_action_space()[source]#
abstract _initialize_action_space()[source]#
_initialize_joints()[source]#
_preprocess_action(action)[source]#
Parameters:

action (mani_skill.utils.structs.types.Array) –

before_simulation_step()[source]#

Called before each simulation step in one control step.

get_state()[source]#

Get the controller state.

Return type:

dict

reset()[source]#

Resets the controller to an initial state. This is called upon environment creation and each environment reset

abstract set_action(action)[source]#

Set the action to execute. The action can be low-level control signals or high-level abstract commands.

Parameters:

action (mani_skill.utils.structs.types.Array) –

abstract set_drive_property()[source]#

Set the joint drive property according to the config.

set_state(state)[source]#
Parameters:

state (dict) –

_control_freq[source]#
_normalize_action[source]#
_original_single_action_space: gymnasium.spaces.Space[source]#

The unbatched, original action space without any additional processing like normalization

_sim_steps[source]#

Number of simulation steps per control step

action_space: gymnasium.spaces.Space[source]#

the action space of the controller, which by default has a batch dimension. This is typically already normalized as well.

active_joint_indices: torch.Tensor[source]#

indices of active joints controlled. Equivalent to [x.active_index for x in self.joints]

articulation[source]#
config[source]#
property control_freq[source]#
property device[source]#
joints: list[mani_skill.utils.structs.ArticulationJoint][source]#

active joints controlled

property qpos[source]#

Get current joint positions.

property qvel[source]#

Get current joint velocities.

scene = None[source]#
sets_target_qpos: bool[source]#

Whether the controller sets the target qpos of the articulation

sets_target_qvel: bool[source]#

Whether the controller sets the target qvel of the articulation

single_action_space: gymnasium.spaces.Space[source]#

The unbatched version of the action space which is also typically already normalized by this class

class mani_skill.agents.controllers.base_controller.CombinedController(configs, articulation, control_freq, sim_freq=None, scene=None)[source]#

Bases: DictController

A flat/combined view of multiple controllers.

Parameters:
_initialize_action_space()[source]#
from_action_dict(action_dict)[source]#

Convert a dict of actions to a flat action.

Parameters:

action_dict (dict) –

set_action(action)[source]#

Set the action to execute. The action can be low-level control signals or high-level abstract commands.

Parameters:

action (numpy.ndarray) –

to_action_dict(action)[source]#

Convert a flat action to a dict of actions.

Parameters:

action (numpy.ndarray) –

class mani_skill.agents.controllers.base_controller.ControllerConfig[source]#
controller_cls[source]#
joint_names: list[str][source]#

the names of the joints to control. Note that some controller configurations might not actually let you directly control all the given joints and will instead have some other implicit control (e.g. Passive controllers or mimic controllers).

class mani_skill.agents.controllers.base_controller.DictController(configs, articulation, control_freq, sim_freq=None, scene=None)[source]#

Bases: BaseController

Base class for controllers. The controller is an interface for the robot to interact with the environment.

Parameters:
__repr__()[source]#
_initialize_action_space()[source]#
_initialize_joints()[source]#
before_simulation_step()[source]#

Called before each simulation step in one control step.

from_qpos(qpos)[source]#

Tries to generate the corresponding action given a full robot qpos. This can be useful for joint position control when setting a desired qposition even if some controllers merge some joints together like the mimic controller

Parameters:

qpos (mani_skill.utils.structs.types.Array) –

get_state()[source]#

Get the controller state.

Return type:

dict

reset()[source]#

Resets the controller to an initial state. This is called upon environment creation and each environment reset

set_action(action)[source]#

Set the action to execute. The action can be low-level control signals or high-level abstract commands.

Parameters:

action (dict[str, numpy.ndarray]) –

set_drive_property()[source]#

Set the joint drive property according to the config.

set_state(state)[source]#
Parameters:

state (dict) –

_control_freq[source]#
action_space[source]#

the action space of the controller, which by default has a batch dimension. This is typically already normalized as well.

articulation[source]#
configs[source]#
controllers: dict[str, BaseController][source]#
scene = None[source]#
sets_target_qpos = False[source]#

Whether the controller sets the target qpos of the articulation

sets_target_qvel = False[source]#

Whether the controller sets the target qvel of the articulation