policy¶
policy
¶
Modules:
| Name | Description |
|---|---|
base_policy |
Abstract Policy class to run a policy in the environment for data collection or evaluation. |
dummy_policy |
|
learned_policy |
|
random_policy |
|
solvers |
Heuristic policies for data generation. |
base_policy
¶
Abstract Policy class to run a policy in the environment for data collection or evaluation. This class is designed to be subclassed and implemented with specific policies. For example, the policy can be a planner, a human teleop interface, a reinforcement learning agent, or any other type of agent that can interact with the environment to collect data.
Classes:
| Name | Description |
|---|---|
BasePolicy |
Abstract base class for policies. |
InferencePolicy |
|
PlannerPolicy |
|
StatefulPolicy |
|
Attributes:
| Name | Type | Description |
|---|---|---|
NONE_PHASE |
|
|
PolicyFactory |
TypeAlias
|
Factory function with signature |
PolicyFactory
module-attribute
¶
PolicyFactory: TypeAlias = Callable[..., BasePolicy]
Factory function with signature Callable[[MlSpacesExpConfig, BaseMujocoTask | None], BasePolicy].
To avoid forward-reference resolution issues with Pydantic, the type is relaxed to Callable[..., BasePolicy].
BasePolicy
¶
BasePolicy(config: MlSpacesExpConfig, task: BaseMujocoTask | None = None)
Bases: ABC
Abstract base class for policies.
This class provides a template for policies that can be used to interact with an environment for the purpose of data collection or evaluation. It declares methods that should be implemented by any concrete policy class.
Methods:
| Name | Description |
|---|---|
add_auxiliary_objects |
Add auxiliary objects to the scene that might be required for the policy. |
create_policy_sensors |
Create a list of policy-specific sensors. |
get_action |
Decide on the action to take based on the current observation of the or environment. |
get_info |
Get additional information from the policy. Called after episode ended. This method can be |
reset |
Reset the policy's internal state. |
Attributes:
| Name | Type | Description |
|---|---|---|
config |
|
|
task |
|
Source code in molmo_spaces/policy/base_policy.py
add_auxiliary_objects
staticmethod
¶
add_auxiliary_objects(config: MlSpacesExpConfig, spec: MjSpec) -> None
Add auxiliary objects to the scene that might be required for the policy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
MlSpacesExpConfig
|
The configuration for the policy. |
required |
spec
|
MjSpec
|
The experiment configuration. |
required |
Source code in molmo_spaces/policy/base_policy.py
get_action
abstractmethod
¶
Decide on the action to take based on the current observation of the or environment. Information could be observations, goals in the case of an rl_agent, or it could be the full environment state in the case of a planner.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
observation
|
The current information about the task or environment. |
required |
Returns:
| Type | Description |
|---|---|
|
The action to take in response to the information. |
Source code in molmo_spaces/policy/base_policy.py
get_info
¶
Get additional information from the policy. Called after episode ended. This method can be overridden by subclasses to provide extra information about the policy's state. Must be json serializable.
Returns:
| Type | Description |
|---|---|
dict
|
A dictionary containing additional information about the policy. |
Source code in molmo_spaces/policy/base_policy.py
reset
abstractmethod
¶
Reset the policy's internal state.
This method should be implemented by each subclass to reset the policy's internal state. It is typically called at the beginning of each episode or task.
Source code in molmo_spaces/policy/base_policy.py
InferencePolicy
¶
InferencePolicy(config: MlSpacesExpConfig, task: BaseMujocoTask | None = None)
Bases: BasePolicy
Methods:
| Name | Description |
|---|---|
add_auxiliary_objects |
Add auxiliary objects to the scene that might be required for the policy. |
create_policy_sensors |
Create a list of policy-specific sensors. |
get_action |
Decide on the action to take based on the current observation of the or environment. |
get_info |
Get additional information from the policy. Called after episode ended. This method can be |
inference_model |
|
model_output_to_action |
|
obs_to_model_input |
|
prepare_model |
|
render |
Not required to be implemented by subclasses. |
reset |
Reset the policy's internal state. |
Attributes:
| Name | Type | Description |
|---|---|---|
config |
|
|
task |
|
Source code in molmo_spaces/policy/base_policy.py
add_auxiliary_objects
staticmethod
¶
add_auxiliary_objects(config: MlSpacesExpConfig, spec: MjSpec) -> None
Add auxiliary objects to the scene that might be required for the policy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
MlSpacesExpConfig
|
The configuration for the policy. |
required |
spec
|
MjSpec
|
The experiment configuration. |
required |
Source code in molmo_spaces/policy/base_policy.py
get_action
¶
Decide on the action to take based on the current observation of the or environment. Information could be observations, goals in the case of an rl_agent, or it could be the full environment state in the case of a planner.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
observation
|
The current information about the task or environment. |
required |
Returns:
| Type | Description |
|---|---|
|
The action to take in response to the information. |
get_info
¶
Get additional information from the policy. Called after episode ended. This method can be overridden by subclasses to provide extra information about the policy's state. Must be json serializable.
Returns:
| Type | Description |
|---|---|
dict
|
A dictionary containing additional information about the policy. |
inference_model
abstractmethod
¶
model_output_to_action
abstractmethod
¶
obs_to_model_input
abstractmethod
¶
prepare_model
abstractmethod
¶
render
¶
reset
abstractmethod
¶
Reset the policy's internal state.
This method should be implemented by each subclass to reset the policy's internal state. It is typically called at the beginning of each episode or task.
PlannerPolicy
¶
PlannerPolicy(config: MlSpacesExpConfig, task: BaseMujocoTask | None = None)
Bases: BasePolicy
Methods:
| Name | Description |
|---|---|
add_auxiliary_objects |
Add auxiliary objects to the scene that might be required for the policy. |
create_policy_sensors |
Create a list of policy-specific sensors. |
get_action |
Decide on the action to take based on the current observation of the or environment. |
get_all_phases |
Returns: |
get_info |
Get additional information from the policy. Called after episode ended. This method can be |
get_phase |
Returns: |
planners |
Abstract property representing the list or dict of planner instances. |
reset |
Reset the policy's internal state. |
Attributes:
| Name | Type | Description |
|---|---|---|
config |
|
|
retry_count |
int
|
The number of retries the policy has taken. |
task |
|
Source code in molmo_spaces/policy/base_policy.py
add_auxiliary_objects
staticmethod
¶
add_auxiliary_objects(config: MlSpacesExpConfig, spec: MjSpec) -> None
Add auxiliary objects to the scene that might be required for the policy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
MlSpacesExpConfig
|
The configuration for the policy. |
required |
spec
|
MjSpec
|
The experiment configuration. |
required |
Source code in molmo_spaces/policy/base_policy.py
create_policy_sensors
¶
create_policy_sensors() -> list[Sensor]
Create a list of policy-specific sensors.
Source code in molmo_spaces/policy/base_policy.py
get_action
abstractmethod
¶
Decide on the action to take based on the current observation of the or environment. Information could be observations, goals in the case of an rl_agent, or it could be the full environment state in the case of a planner.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
observation
|
The current information about the task or environment. |
required |
Returns:
| Type | Description |
|---|---|
|
The action to take in response to the information. |
Source code in molmo_spaces/policy/base_policy.py
get_all_phases
abstractmethod
¶
Returns:
| Type | Description |
|---|---|
dict[str | int]
|
A dictionary of all possible policy phases |
get_info
¶
Get additional information from the policy. Called after episode ended. This method can be overridden by subclasses to provide extra information about the policy's state. Must be json serializable.
Returns:
| Type | Description |
|---|---|
dict
|
A dictionary containing additional information about the policy. |
Source code in molmo_spaces/policy/base_policy.py
get_phase
abstractmethod
¶
planners
abstractmethod
¶
reset
abstractmethod
¶
Reset the policy's internal state.
This method should be implemented by each subclass to reset the policy's internal state. It is typically called at the beginning of each episode or task.
Source code in molmo_spaces/policy/base_policy.py
StatefulPolicy
¶
StatefulPolicy(config: MlSpacesExpConfig, task: BaseMujocoTask | None = None)
Bases: BasePolicy
Methods:
| Name | Description |
|---|---|
add_auxiliary_objects |
Add auxiliary objects to the scene that might be required for the policy. |
create_policy_sensors |
Create a list of policy-specific sensors. |
get_action |
Decide on the action to take based on the current observation of the or environment. |
get_info |
Get additional information from the policy. Called after episode ended. This method can be |
get_state |
|
reset |
Reset the policy's internal state. |
set_state |
|
Attributes:
| Name | Type | Description |
|---|---|---|
config |
|
|
task |
|
Source code in molmo_spaces/policy/base_policy.py
add_auxiliary_objects
staticmethod
¶
add_auxiliary_objects(config: MlSpacesExpConfig, spec: MjSpec) -> None
Add auxiliary objects to the scene that might be required for the policy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
MlSpacesExpConfig
|
The configuration for the policy. |
required |
spec
|
MjSpec
|
The experiment configuration. |
required |
Source code in molmo_spaces/policy/base_policy.py
get_action
abstractmethod
¶
Decide on the action to take based on the current observation of the or environment. Information could be observations, goals in the case of an rl_agent, or it could be the full environment state in the case of a planner.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
observation
|
The current information about the task or environment. |
required |
Returns:
| Type | Description |
|---|---|
|
The action to take in response to the information. |
Source code in molmo_spaces/policy/base_policy.py
get_info
¶
Get additional information from the policy. Called after episode ended. This method can be overridden by subclasses to provide extra information about the policy's state. Must be json serializable.
Returns:
| Type | Description |
|---|---|
dict
|
A dictionary containing additional information about the policy. |
Source code in molmo_spaces/policy/base_policy.py
get_state
abstractmethod
¶
reset
abstractmethod
¶
Reset the policy's internal state.
This method should be implemented by each subclass to reset the policy's internal state. It is typically called at the beginning of each episode or task.
Source code in molmo_spaces/policy/base_policy.py
dummy_policy
¶
Classes:
| Name | Description |
|---|---|
BrownianMotionPolicy |
Policy that applies Gaussian noise increments over noop control, resulting in Brownian motion. |
DummyPolicy |
A Dummy Policy that return null actions. |
BrownianMotionPolicy
¶
BrownianMotionPolicy(config: MlSpacesExpConfig)
Bases: DummyPolicy
Policy that applies Gaussian noise increments over noop control, resulting in Brownian motion.
Methods:
| Name | Description |
|---|---|
add_auxiliary_objects |
Add auxiliary objects to the scene that might be required for the policy. |
create_policy_sensors |
Create a list of policy-specific sensors. |
get_action |
Dummy action to take based on the action space. |
get_info |
Get additional information from the policy. Called after episode ended. This method can be |
reset |
Reset the policy state. No state to reset for DummyPolicy. |
Attributes:
| Name | Type | Description |
|---|---|---|
config |
|
|
std |
|
|
task |
|
|
type |
|
Source code in molmo_spaces/policy/dummy_policy.py
add_auxiliary_objects
staticmethod
¶
add_auxiliary_objects(config: MlSpacesExpConfig, spec: MjSpec) -> None
Add auxiliary objects to the scene that might be required for the policy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
MlSpacesExpConfig
|
The configuration for the policy. |
required |
spec
|
MjSpec
|
The experiment configuration. |
required |
Source code in molmo_spaces/policy/base_policy.py
get_action
¶
Dummy action to take based on the action space.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
info
|
The current information about the task or environment (not used). |
required |
Returns:
Source code in molmo_spaces/policy/dummy_policy.py
get_info
¶
Get additional information from the policy. Called after episode ended. This method can be overridden by subclasses to provide extra information about the policy's state. Must be json serializable.
Returns:
| Type | Description |
|---|---|
dict
|
A dictionary containing additional information about the policy. |
Source code in molmo_spaces/policy/base_policy.py
DummyPolicy
¶
DummyPolicy(config: MlSpacesExpConfig, task: BaseMujocoTask | None = None)
Bases: BasePolicy
A Dummy Policy that return null actions.
Methods:
| Name | Description |
|---|---|
add_auxiliary_objects |
Add auxiliary objects to the scene that might be required for the policy. |
create_policy_sensors |
Create a list of policy-specific sensors. |
get_action |
Dummy action to take based on the action space. |
get_info |
Get additional information from the policy. Called after episode ended. This method can be |
reset |
Reset the policy state. No state to reset for DummyPolicy. |
Attributes:
| Name | Type | Description |
|---|---|---|
config |
|
|
task |
|
|
type |
|
Source code in molmo_spaces/policy/base_policy.py
add_auxiliary_objects
staticmethod
¶
add_auxiliary_objects(config: MlSpacesExpConfig, spec: MjSpec) -> None
Add auxiliary objects to the scene that might be required for the policy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
MlSpacesExpConfig
|
The configuration for the policy. |
required |
spec
|
MjSpec
|
The experiment configuration. |
required |
Source code in molmo_spaces/policy/base_policy.py
get_action
¶
Dummy action to take based on the action space.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
info
|
The current information about the task or environment (not used). |
required |
Returns:
get_info
¶
Get additional information from the policy. Called after episode ended. This method can be overridden by subclasses to provide extra information about the policy's state. Must be json serializable.
Returns:
| Type | Description |
|---|---|
dict
|
A dictionary containing additional information about the policy. |
Source code in molmo_spaces/policy/base_policy.py
learned_policy
¶
Modules:
| Name | Description |
|---|---|
bimanual_yam_pi_policy |
Bimanual YAM Pi0.5 Policy using LeRobot gRPC inference. |
cap_policy |
|
dreamzero_policy |
|
keyboard_policy |
|
lerobot_grpc_client |
LeRobot gRPC client for remote policy inference. |
phone_policy |
|
pi_policy |
|
rum_client |
|
spacemouse_policy |
|
utils |
|
websocket_policy |
|
bimanual_yam_pi_policy
¶
Bimanual YAM Pi0.5 Policy using LeRobot gRPC inference.
This policy connects to a LeRobot async inference server to run Pi0.5 for bimanual manipulation with the YAM robot.
Classes:
| Name | Description |
|---|---|
BimanualYamPiPolicy |
Policy for bimanual YAM robot using Pi0.5 via LeRobot gRPC server. |
Attributes:
| Name | Type | Description |
|---|---|---|
log |
|
BimanualYamPiPolicy
¶
BimanualYamPiPolicy(exp_config: MlSpacesExpConfig)
Bases: InferencePolicy
Policy for bimanual YAM robot using Pi0.5 via LeRobot gRPC server.
This policy: - Connects to a LeRobot async inference server - Sends observations (3 cameras + 14-dim state + task prompt) - Receives 14-dim action chunks (left arm, left gripper, right arm, right gripper) - Buffers actions to avoid calling the model every step
Expected observation format from MuJoCo
- "left_wrist_camera": RGB image from left wrist
- "right_wrist_camera": RGB image from right wrist
- "exo_camera": RGB image from top-down exo camera
- "qpos": {"left_arm": (6,), "right_arm": (6,), "left_gripper": (N,), "right_gripper": (N,)}
Action format to robot
- "left_arm": (6,) joint positions
- "right_arm": (6,) joint positions
- "left_gripper": (1,) gripper command
- "right_gripper": (1,) gripper command
Initialize the policy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
exp_config
|
MlSpacesExpConfig
|
Experiment configuration containing policy config |
required |
Methods:
| Name | Description |
|---|---|
__del__ |
Cleanup on deletion. |
add_auxiliary_objects |
Add auxiliary objects to the scene that might be required for the policy. |
create_policy_sensors |
Create a list of policy-specific sensors. |
get_action |
Decide on the action to take based on the current observation of the or environment. |
get_info |
Get policy information for logging. |
inference_model |
Run inference with action buffering. |
model_output_to_action |
Convert model output to bimanual robot action dictionary. |
obs_to_model_input |
Transform MuJoCo observations to raw format for LeRobot's build_dataset_frame. |
prepare_model |
Connect to the LeRobot gRPC server and load the policy. |
render |
Display camera views for debugging. |
reset |
Reset the policy state for a new episode. |
Attributes:
| Name | Type | Description |
|---|---|---|
GRIPPER_MAX |
|
|
STATE_NAMES |
|
|
actions_buffer |
list[ndarray] | None
|
|
buffer_length |
|
|
camera_mapping |
|
|
checkpoint_path |
|
|
client |
LeRobotGRPCClient | None
|
|
config |
|
|
current_buffer_index |
int
|
|
grasping_type |
|
|
remote_config |
|
|
starting_time |
float | None
|
|
task |
|
Source code in molmo_spaces/policy/learned_policy/bimanual_yam_pi_policy.py
STATE_NAMES
class-attribute
instance-attribute
¶
STATE_NAMES = ['left_joint_0.pos', 'left_joint_1.pos', 'left_joint_2.pos', 'left_joint_3.pos', 'left_joint_4.pos', 'left_joint_5.pos', 'left_gripper.pos', 'right_joint_0.pos', 'right_joint_1.pos', 'right_joint_2.pos', 'right_joint_3.pos', 'right_joint_4.pos', 'right_joint_5.pos', 'right_gripper.pos']
camera_mapping
instance-attribute
¶
camera_mapping = getattr(policy_config, 'camera_mapping', {'left_wrist_camera': 'observation.images.left', 'right_wrist_camera': 'observation.images.right', 'exo_camera': 'observation.images.top'})
grasping_type
instance-attribute
¶
__del__
¶
add_auxiliary_objects
staticmethod
¶
add_auxiliary_objects(config: MlSpacesExpConfig, spec: MjSpec) -> None
Add auxiliary objects to the scene that might be required for the policy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
MlSpacesExpConfig
|
The configuration for the policy. |
required |
spec
|
MjSpec
|
The experiment configuration. |
required |
Source code in molmo_spaces/policy/base_policy.py
get_action
¶
Decide on the action to take based on the current observation of the or environment. Information could be observations, goals in the case of an rl_agent, or it could be the full environment state in the case of a planner.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
observation
|
The current information about the task or environment. |
required |
Returns:
| Type | Description |
|---|---|
|
The action to take in response to the information. |
get_info
¶
Get policy information for logging.
Returns:
| Type | Description |
|---|---|
dict
|
Dictionary with policy metadata |
Source code in molmo_spaces/policy/learned_policy/bimanual_yam_pi_policy.py
inference_model
¶
Run inference with action buffering.
Only calls the remote model when the buffer is empty or exhausted.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_input
|
dict
|
Preprocessed observation in LeRobot format |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Single action from the buffer |
Source code in molmo_spaces/policy/learned_policy/bimanual_yam_pi_policy.py
model_output_to_action
¶
Convert model output to bimanual robot action dictionary.
Model output format (14 dims): [0:6] - left arm joint positions [6] - left gripper [7:13] - right arm joint positions [13] - right gripper
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_output
|
ndarray
|
14-dim action array from model |
required |
Returns:
| Type | Description |
|---|---|
dict
|
Dictionary with keys: left_arm, right_arm, left_gripper, right_gripper |
Source code in molmo_spaces/policy/learned_policy/bimanual_yam_pi_policy.py
obs_to_model_input
¶
Transform MuJoCo observations to raw format for LeRobot's build_dataset_frame.
The server's build_dataset_frame expects: - Individual state values with keys matching STATE_NAMES - Image keys without "observation.images." prefix (e.g., "left", "right", "top") - "task" key for the text prompt
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obs
|
dict
|
MuJoCo observation dictionary with cameras and joint states |
required |
Returns:
| Type | Description |
|---|---|
dict
|
Dictionary in raw format that build_dataset_frame will transform |
Source code in molmo_spaces/policy/learned_policy/bimanual_yam_pi_policy.py
prepare_model
¶
Connect to the LeRobot gRPC server and load the policy.
Source code in molmo_spaces/policy/learned_policy/bimanual_yam_pi_policy.py
render
¶
Display camera views for debugging.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obs
|
dict
|
Observation dictionary with camera images |
required |
Source code in molmo_spaces/policy/learned_policy/bimanual_yam_pi_policy.py
reset
¶
Reset the policy state for a new episode.
Source code in molmo_spaces/policy/learned_policy/bimanual_yam_pi_policy.py
cap_policy
¶
Classes:
| Name | Description |
|---|---|
CAP_Policy |
|
Functions:
| Name | Description |
|---|---|
action_tensor_to_matrix |
|
Attributes:
| Name | Type | Description |
|---|---|---|
log |
|
CAP_Policy
¶
CAP_Policy(exp_config: MlSpacesExpConfig)
Bases: InferencePolicy
Methods:
| Name | Description |
|---|---|
add_auxiliary_objects |
Add auxiliary objects to the scene that might be required for the policy. |
create_policy_sensors |
Create a list of policy-specific sensors. |
get_action |
Decide on the action to take based on the current observation of the or environment. |
get_info |
Get additional information from the policy. Called after episode ended. This method can be |
inference_model |
|
model_output_to_action |
|
obs_to_model_input |
|
prepare_model |
|
render |
Not required to be implemented by subclasses. |
reset |
Reset the policy's internal state. |
Attributes:
| Name | Type | Description |
|---|---|---|
config |
|
|
grasping_threshold |
|
|
grasping_type |
|
|
model |
|
|
remote_config |
|
|
task |
|
|
use_exo |
|
|
use_vlm |
|
Source code in molmo_spaces/policy/learned_policy/cap_policy.py
add_auxiliary_objects
staticmethod
¶
add_auxiliary_objects(config: MlSpacesExpConfig, spec: MjSpec) -> None
Add auxiliary objects to the scene that might be required for the policy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
MlSpacesExpConfig
|
The configuration for the policy. |
required |
spec
|
MjSpec
|
The experiment configuration. |
required |
Source code in molmo_spaces/policy/base_policy.py
get_action
¶
Decide on the action to take based on the current observation of the or environment. Information could be observations, goals in the case of an rl_agent, or it could be the full environment state in the case of a planner.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
observation
|
The current information about the task or environment. |
required |
Returns:
| Type | Description |
|---|---|
|
The action to take in response to the information. |
get_info
¶
Get additional information from the policy. Called after episode ended. This method can be overridden by subclasses to provide extra information about the policy's state. Must be json serializable.
Returns:
| Type | Description |
|---|---|
dict
|
A dictionary containing additional information about the policy. |
Source code in molmo_spaces/policy/learned_policy/cap_policy.py
inference_model
¶
Source code in molmo_spaces/policy/learned_policy/cap_policy.py
model_output_to_action
¶
obs_to_model_input
¶
Source code in molmo_spaces/policy/learned_policy/cap_policy.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | |
prepare_model
¶
Source code in molmo_spaces/policy/learned_policy/cap_policy.py
render
¶
Not required to be implemented by subclasses. Defaults to noop.
reset
¶
Reset the policy's internal state.
This method should be implemented by each subclass to reset the policy's internal state. It is typically called at the beginning of each episode or task.
action_tensor_to_matrix
¶
Source code in molmo_spaces/policy/learned_policy/cap_policy.py
dreamzero_policy
¶
Classes:
| Name | Description |
|---|---|
DreamZeroWebsocketClient |
Websocket client that adds endpoint field for DreamZero server. |
DreamZero_Policy |
|
Attributes:
| Name | Type | Description |
|---|---|---|
PING_INTERVAL_SECS |
|
|
PING_TIMEOUT_SECS |
|
|
log |
|
DreamZeroWebsocketClient
¶
Websocket client that adds endpoint field for DreamZero server.
Methods:
| Name | Description |
|---|---|
infer |
|
reset |
|
Source code in molmo_spaces/policy/learned_policy/dreamzero_policy.py
infer
¶
Source code in molmo_spaces/policy/learned_policy/dreamzero_policy.py
reset
¶
Source code in molmo_spaces/policy/learned_policy/dreamzero_policy.py
DreamZero_Policy
¶
DreamZero_Policy(exp_config: MlSpacesExpConfig)
Bases: InferencePolicy
Methods:
| Name | Description |
|---|---|
add_auxiliary_objects |
Add auxiliary objects to the scene that might be required for the policy. |
create_policy_sensors |
Create a list of policy-specific sensors. |
get_action |
Decide on the action to take based on the current observation of the or environment. |
get_info |
Get additional information from the policy. Called after episode ended. This method can be |
inference_model |
|
model_output_to_action |
|
obs_to_model_input |
|
prepare_model |
|
render |
Not required to be implemented by subclasses. |
reset |
Reset the policy's internal state. |
Attributes:
| Name | Type | Description |
|---|---|---|
checkpoint_path |
|
|
chunk_size |
|
|
config |
|
|
grasping_threshold |
|
|
grasping_type |
|
|
model |
|
|
remote_config |
|
|
session_id |
|
|
task |
|
Source code in molmo_spaces/policy/learned_policy/dreamzero_policy.py
add_auxiliary_objects
staticmethod
¶
add_auxiliary_objects(config: MlSpacesExpConfig, spec: MjSpec) -> None
Add auxiliary objects to the scene that might be required for the policy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
MlSpacesExpConfig
|
The configuration for the policy. |
required |
spec
|
MjSpec
|
The experiment configuration. |
required |
Source code in molmo_spaces/policy/base_policy.py
get_action
¶
Decide on the action to take based on the current observation of the or environment. Information could be observations, goals in the case of an rl_agent, or it could be the full environment state in the case of a planner.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
observation
|
The current information about the task or environment. |
required |
Returns:
| Type | Description |
|---|---|
|
The action to take in response to the information. |
get_info
¶
Get additional information from the policy. Called after episode ended. This method can be overridden by subclasses to provide extra information about the policy's state. Must be json serializable.
Returns:
| Type | Description |
|---|---|
dict
|
A dictionary containing additional information about the policy. |
Source code in molmo_spaces/policy/learned_policy/dreamzero_policy.py
inference_model
¶
Source code in molmo_spaces/policy/learned_policy/dreamzero_policy.py
model_output_to_action
¶
Source code in molmo_spaces/policy/learned_policy/dreamzero_policy.py
obs_to_model_input
¶
Source code in molmo_spaces/policy/learned_policy/dreamzero_policy.py
prepare_model
¶
Source code in molmo_spaces/policy/learned_policy/dreamzero_policy.py
render
¶
Not required to be implemented by subclasses. Defaults to noop.
reset
¶
Reset the policy's internal state.
This method should be implemented by each subclass to reset the policy's internal state. It is typically called at the beginning of each episode or task.
keyboard_policy
¶
Classes:
| Name | Description |
|---|---|
Keyboard_Policy |
|
Attributes:
| Name | Type | Description |
|---|---|---|
log |
|
Keyboard_Policy
¶
Keyboard_Policy(exp_config: MlSpacesExpConfig)
Bases: InferencePolicy
Methods:
| Name | Description |
|---|---|
add_auxiliary_objects |
Add auxiliary objects to the scene that might be required for the policy. |
create_policy_sensors |
Create a list of policy-specific sensors. |
get_action |
Decide on the action to take based on the current observation of the or environment. |
get_info |
Get additional information from the policy. Called after episode ended. This method can be |
inference_model |
|
model_output_to_action |
|
obs_to_model_input |
|
prepare_model |
|
render |
Not required to be implemented by subclasses. |
reset |
Reset the policy's internal state. |
Attributes:
| Name | Type | Description |
|---|---|---|
config |
|
|
robot_type |
|
|
rot_step |
|
|
step_size |
|
|
task |
|
Source code in molmo_spaces/policy/learned_policy/keyboard_policy.py
add_auxiliary_objects
staticmethod
¶
add_auxiliary_objects(config: MlSpacesExpConfig, spec: MjSpec) -> None
Add auxiliary objects to the scene that might be required for the policy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
MlSpacesExpConfig
|
The configuration for the policy. |
required |
spec
|
MjSpec
|
The experiment configuration. |
required |
Source code in molmo_spaces/policy/base_policy.py
get_action
¶
Decide on the action to take based on the current observation of the or environment. Information could be observations, goals in the case of an rl_agent, or it could be the full environment state in the case of a planner.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
observation
|
The current information about the task or environment. |
required |
Returns:
| Type | Description |
|---|---|
|
The action to take in response to the information. |
get_info
¶
Get additional information from the policy. Called after episode ended. This method can be overridden by subclasses to provide extra information about the policy's state. Must be json serializable.
Returns:
| Type | Description |
|---|---|
dict
|
A dictionary containing additional information about the policy. |
inference_model
¶
Source code in molmo_spaces/policy/learned_policy/keyboard_policy.py
model_output_to_action
¶
obs_to_model_input
¶
Source code in molmo_spaces/policy/learned_policy/keyboard_policy.py
prepare_model
¶
render
¶
Not required to be implemented by subclasses. Defaults to noop.
Source code in molmo_spaces/policy/learned_policy/keyboard_policy.py
reset
¶
Reset the policy's internal state.
This method should be implemented by each subclass to reset the policy's internal state. It is typically called at the beginning of each episode or task.
lerobot_grpc_client
¶
LeRobot gRPC client for remote policy inference.
This client connects to a LeRobot async inference server and handles the gRPC protocol for sending observations and receiving actions.
Classes:
| Name | Description |
|---|---|
LeRobotGRPCClient |
gRPC client for LeRobot async inference server. |
Attributes:
| Name | Type | Description |
|---|---|---|
log |
|
LeRobotGRPCClient
¶
gRPC client for LeRobot async inference server.
This client handles the communication protocol with a LeRobot policy server, including connection setup, observation streaming, and action retrieval.
Initialize the gRPC client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
host
|
str
|
Server hostname |
'localhost'
|
port
|
int
|
Server port |
8080
|
Methods:
| Name | Description |
|---|---|
close |
Close the gRPC channel. |
connect |
Connect to the server and initialize the policy. |
infer |
Send observation and receive action chunk. |
reset |
Reset the client state (timestep counter). |
Attributes:
| Name | Type | Description |
|---|---|---|
channel |
|
|
connected |
|
|
host |
|
|
port |
|
|
stub |
|
|
timestep |
|
Source code in molmo_spaces/policy/learned_policy/lerobot_grpc_client.py
close
¶
Close the gRPC channel.
Source code in molmo_spaces/policy/learned_policy/lerobot_grpc_client.py
connect
¶
connect(pretrained_name_or_path: str, policy_type: str = 'pi05', device: str = 'cuda', actions_per_chunk: int = 50, lerobot_features: dict | None = None, rename_map: dict | None = None, max_retries: int = 5, retry_delay: float = 1.0) -> None
Connect to the server and initialize the policy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pretrained_name_or_path
|
str
|
HuggingFace model ID or local path |
required |
policy_type
|
str
|
Type of policy (e.g., "pi05", "act", "smolvla") |
'pi05'
|
device
|
str
|
Device to run inference on ("cuda", "cpu") |
'cuda'
|
actions_per_chunk
|
int
|
Number of actions per inference call |
50
|
lerobot_features
|
dict | None
|
Feature definitions for observations |
None
|
rename_map
|
dict | None
|
Optional mapping to rename observation keys |
None
|
max_retries
|
int
|
Number of connection retry attempts |
5
|
retry_delay
|
float
|
Delay between retries in seconds |
1.0
|
Source code in molmo_spaces/policy/learned_policy/lerobot_grpc_client.py
infer
¶
Send observation and receive action chunk.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
observation
|
dict[str, Any]
|
Dictionary with observation data matching LeRobot format:
- "observation.state": np.ndarray of robot state
- "observation.images. |
required |
Returns:
| Type | Description |
|---|---|
list[ndarray]
|
List of action arrays (one per timestep in the chunk) |
Source code in molmo_spaces/policy/learned_policy/lerobot_grpc_client.py
phone_policy
¶
Classes:
| Name | Description |
|---|---|
Phone_Policy |
|
Attributes:
| Name | Type | Description |
|---|---|---|
log |
|
Phone_Policy
¶
Phone_Policy(exp_config: MlSpacesExpConfig)
Bases: InferencePolicy
Methods:
| Name | Description |
|---|---|
add_auxiliary_objects |
Add auxiliary objects to the scene that might be required for the policy. |
create_policy_sensors |
Create a list of policy-specific sensors. |
get_action |
Decide on the action to take based on the current observation of the or environment. |
get_info |
Get additional information from the policy. Called after episode ended. This method can be |
inference_model |
|
model_output_to_action |
|
obs_to_model_input |
|
prepare_model |
|
render |
Not required to be implemented by subclasses. |
reset |
Reset the policy's internal state. |
Attributes:
| Name | Type | Description |
|---|---|---|
config |
|
|
robot_type |
|
|
session |
|
|
task |
|
Source code in molmo_spaces/policy/learned_policy/phone_policy.py
add_auxiliary_objects
staticmethod
¶
add_auxiliary_objects(config: MlSpacesExpConfig, spec: MjSpec) -> None
Add auxiliary objects to the scene that might be required for the policy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
MlSpacesExpConfig
|
The configuration for the policy. |
required |
spec
|
MjSpec
|
The experiment configuration. |
required |
Source code in molmo_spaces/policy/base_policy.py
get_action
¶
Decide on the action to take based on the current observation of the or environment. Information could be observations, goals in the case of an rl_agent, or it could be the full environment state in the case of a planner.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
observation
|
The current information about the task or environment. |
required |
Returns:
| Type | Description |
|---|---|
|
The action to take in response to the information. |
get_info
¶
Get additional information from the policy. Called after episode ended. This method can be overridden by subclasses to provide extra information about the policy's state. Must be json serializable.
Returns:
| Type | Description |
|---|---|
dict
|
A dictionary containing additional information about the policy. |
inference_model
¶
Source code in molmo_spaces/policy/learned_policy/phone_policy.py
model_output_to_action
¶
obs_to_model_input
¶
Source code in molmo_spaces/policy/learned_policy/phone_policy.py
prepare_model
abstractmethod
¶
render
¶
Not required to be implemented by subclasses. Defaults to noop.
Source code in molmo_spaces/policy/learned_policy/phone_policy.py
reset
¶
Reset the policy's internal state.
This method should be implemented by each subclass to reset the policy's internal state. It is typically called at the beginning of each episode or task.
pi_policy
¶
Classes:
| Name | Description |
|---|---|
PI_Policy |
|
PI_PolicyState |
|
Attributes:
| Name | Type | Description |
|---|---|---|
log |
|
PI_Policy
¶
PI_Policy(exp_config: MlSpacesExpConfig)
Bases: InferencePolicy, StatefulPolicy
Methods:
| Name | Description |
|---|---|
add_auxiliary_objects |
Add auxiliary objects to the scene that might be required for the policy. |
create_policy_sensors |
Create a list of policy-specific sensors. |
get_action |
Decide on the action to take based on the current observation of the or environment. |
get_info |
Get additional information from the policy. Called after episode ended. This method can be |
get_state |
|
inference_model |
|
model_output_to_action |
|
obs_to_model_input |
|
prepare_model |
|
render |
Not required to be implemented by subclasses. |
reset |
Reset the policy's internal state. |
set_state |
|
Attributes:
| Name | Type | Description |
|---|---|---|
checkpoint_path |
|
|
chunk_size |
|
|
config |
|
|
grasping_threshold |
|
|
grasping_type |
|
|
model |
|
|
remote_config |
|
|
task |
|
Source code in molmo_spaces/policy/learned_policy/pi_policy.py
add_auxiliary_objects
staticmethod
¶
add_auxiliary_objects(config: MlSpacesExpConfig, spec: MjSpec) -> None
Add auxiliary objects to the scene that might be required for the policy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
MlSpacesExpConfig
|
The configuration for the policy. |
required |
spec
|
MjSpec
|
The experiment configuration. |
required |
Source code in molmo_spaces/policy/base_policy.py
get_action
¶
Decide on the action to take based on the current observation of the or environment. Information could be observations, goals in the case of an rl_agent, or it could be the full environment state in the case of a planner.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
observation
|
The current information about the task or environment. |
required |
Returns:
| Type | Description |
|---|---|
|
The action to take in response to the information. |
get_info
¶
Get additional information from the policy. Called after episode ended. This method can be overridden by subclasses to provide extra information about the policy's state. Must be json serializable.
Returns:
| Type | Description |
|---|---|
dict
|
A dictionary containing additional information about the policy. |
Source code in molmo_spaces/policy/learned_policy/pi_policy.py
get_state
¶
inference_model
¶
Source code in molmo_spaces/policy/learned_policy/pi_policy.py
model_output_to_action
¶
Source code in molmo_spaces/policy/learned_policy/pi_policy.py
obs_to_model_input
¶
Source code in molmo_spaces/policy/learned_policy/pi_policy.py
prepare_model
¶
render
¶
Not required to be implemented by subclasses. Defaults to noop.
reset
¶
Reset the policy's internal state.
This method should be implemented by each subclass to reset the policy's internal state. It is typically called at the beginning of each episode or task.
set_state
¶
set_state(state: PI_PolicyState)
PI_PolicyState
dataclass
¶
PI_PolicyState(actions_buffer: list[ndarray] | None = None, current_buffer_index: int = 0, starting_time: float | None = None)
Attributes:
| Name | Type | Description |
|---|---|---|
actions_buffer |
list[ndarray] | None
|
|
current_buffer_index |
int
|
|
starting_time |
float | None
|
|
rum_client
¶
Classes:
| Name | Description |
|---|---|
RUMClient |
|
Attributes:
| Name | Type | Description |
|---|---|---|
log |
|
RUMClient
¶
Methods:
| Name | Description |
|---|---|
close |
|
get_server_metadata |
|
infer |
|
infer_point |
|
infer_point_molmo |
|
reset |
|
Attributes:
| Name | Type | Description |
|---|---|---|
uri |
|
|
websocket |
|
Source code in molmo_spaces/policy/learned_policy/rum_client.py
close
¶
get_server_metadata
¶
infer
¶
Source code in molmo_spaces/policy/learned_policy/rum_client.py
infer_point
¶
Source code in molmo_spaces/policy/learned_policy/rum_client.py
infer_point_molmo
¶
infer_point_molmo(rgb: ndarray, object_name: str = None, prompt: str = None, task: str = 'pick') -> ndarray
Source code in molmo_spaces/policy/learned_policy/rum_client.py
spacemouse_policy
¶
Classes:
| Name | Description |
|---|---|
SpaceMouse_Policy |
|
Attributes:
| Name | Type | Description |
|---|---|---|
DOUBLE_CLICK_TIME |
|
|
VENDOR_ID |
|
|
log |
|
SpaceMouse_Policy
¶
SpaceMouse_Policy(exp_config: MlSpacesExpConfig)
Bases: InferencePolicy
Methods:
| Name | Description |
|---|---|
add_auxiliary_objects |
Add auxiliary objects to the scene that might be required for the policy. |
create_policy_sensors |
Create a list of policy-specific sensors. |
get_action |
Decide on the action to take based on the current observation of the or environment. |
get_info |
Get additional information from the policy. Called after episode ended. This method can be |
inference_model |
|
model_output_to_action |
|
obs_to_model_input |
|
prepare_model |
|
render |
Not required to be implemented by subclasses. |
reset |
Reset the policy's internal state. |
Attributes:
| Name | Type | Description |
|---|---|---|
config |
|
|
pos_sensitivity |
|
|
robot_type |
|
|
rot_sensitivity |
|
|
task |
|
Source code in molmo_spaces/policy/learned_policy/spacemouse_policy.py
add_auxiliary_objects
staticmethod
¶
add_auxiliary_objects(config: MlSpacesExpConfig, spec: MjSpec) -> None
Add auxiliary objects to the scene that might be required for the policy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
MlSpacesExpConfig
|
The configuration for the policy. |
required |
spec
|
MjSpec
|
The experiment configuration. |
required |
Source code in molmo_spaces/policy/base_policy.py
get_action
¶
Decide on the action to take based on the current observation of the or environment. Information could be observations, goals in the case of an rl_agent, or it could be the full environment state in the case of a planner.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
observation
|
The current information about the task or environment. |
required |
Returns:
| Type | Description |
|---|---|
|
The action to take in response to the information. |
get_info
¶
Get additional information from the policy. Called after episode ended. This method can be overridden by subclasses to provide extra information about the policy's state. Must be json serializable.
Returns:
| Type | Description |
|---|---|
dict
|
A dictionary containing additional information about the policy. |
inference_model
¶
Source code in molmo_spaces/policy/learned_policy/spacemouse_policy.py
model_output_to_action
¶
obs_to_model_input
¶
Source code in molmo_spaces/policy/learned_policy/spacemouse_policy.py
prepare_model
abstractmethod
¶
render
¶
Not required to be implemented by subclasses. Defaults to noop.
Source code in molmo_spaces/policy/learned_policy/spacemouse_policy.py
reset
¶
Reset the policy's internal state.
This method should be implemented by each subclass to reset the policy's internal state. It is typically called at the beginning of each episode or task.
utils
¶
Classes:
| Name | Description |
|---|---|
PromptSampler |
|
Functions:
| Name | Description |
|---|---|
generate_object_hash |
|
resize_with_pad |
|
Attributes:
| Name | Type | Description |
|---|---|---|
log |
|
PromptSampler
¶
PromptSampler(task_type: str = 'pick', prompt_templates: list[str] = None, prompt_object_word_num: int = 1, disambiguate_distractors_by_pos: bool = False)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task_type
|
str
|
The type of task to sample prompts for. |
'pick'
|
prompt_templates
|
list[str]
|
A list of prompt templates to sample from. If None, the default templates for the task type will be used. |
None
|
prompt_object_word_num
|
int
|
The number of words to use for the object name in the prompt. |
1
|
disambiguate_distractors_by_pos
|
bool
|
Whether to disambiguate distractors by position in the prompt. This relies on functionality only present when using a frozen config. |
False
|
Methods:
| Name | Description |
|---|---|
clean_object_name |
|
get_prompt |
|
get_short_description |
|
get_state |
|
get_target_object_uid |
|
next |
|
set_state |
|
Attributes:
| Name | Type | Description |
|---|---|---|
DEFAULT_TEMPLATES_BY_TASK |
|
|
current_index |
|
|
prompt_object_word_num |
|
|
prompt_templates |
|
|
task_type |
|
Source code in molmo_spaces/policy/learned_policy/utils.py
DEFAULT_TEMPLATES_BY_TASK
class-attribute
instance-attribute
¶
DEFAULT_TEMPLATES_BY_TASK = {'pick': ['pick up the {}.'], 'open': ['open the {}.'], 'pick_and_place': ['pick up the {} and place it on the {}.'], 'packing': ['pack container.'], 'close': ['close the {}.']}
clean_object_name
¶
clean_object_name(task: BaseMujocoTask) -> str
get_prompt
¶
get_prompt(task: BaseMujocoTask) -> str
Source code in molmo_spaces/policy/learned_policy/utils.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | |
get_short_description
¶
get_state
¶
get_target_object_uid
¶
next
¶
generate_object_hash
¶
resize_with_pad
¶
Source code in molmo_spaces/policy/learned_policy/utils.py
websocket_policy
¶
Classes:
| Name | Description |
|---|---|
WebsocketPolicy |
Implements the Policy interface by communicating with a server over websocket. |
Attributes:
| Name | Type | Description |
|---|---|---|
logger |
|
WebsocketPolicy
¶
WebsocketPolicy(config: MlSpacesExpConfig, model_name: str, host: str = '127.0.0.1', port: int | None = None, connection_timeout: float | None = None)
Bases: InferencePolicy
Implements the Policy interface by communicating with a server over websocket.
See WebsocketPolicyServer for a corresponding server implementation.
Methods:
| Name | Description |
|---|---|
add_auxiliary_objects |
Add auxiliary objects to the scene that might be required for the policy. |
close |
|
create_policy_sensors |
Create a list of policy-specific sensors. |
get_action |
Decide on the action to take based on the current observation of the or environment. |
get_info |
Get additional information from the policy. Called after episode ended. This method can be |
get_server_metadata |
|
infer |
|
inference_model |
|
model_output_to_action |
|
obs_to_model_input |
|
prepare_model |
|
render |
Not required to be implemented by subclasses. |
reset |
Reset the policy's internal state. |
Attributes:
| Name | Type | Description |
|---|---|---|
config |
|
|
model_name |
|
|
task |
|
Source code in molmo_spaces/policy/learned_policy/websocket_policy.py
add_auxiliary_objects
staticmethod
¶
add_auxiliary_objects(config: MlSpacesExpConfig, spec: MjSpec) -> None
Add auxiliary objects to the scene that might be required for the policy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
MlSpacesExpConfig
|
The configuration for the policy. |
required |
spec
|
MjSpec
|
The experiment configuration. |
required |
Source code in molmo_spaces/policy/base_policy.py
close
¶
get_action
¶
Decide on the action to take based on the current observation of the or environment. Information could be observations, goals in the case of an rl_agent, or it could be the full environment state in the case of a planner.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
observation
|
The current information about the task or environment. |
required |
Returns:
| Type | Description |
|---|---|
|
The action to take in response to the information. |
get_info
¶
Get additional information from the policy. Called after episode ended. This method can be overridden by subclasses to provide extra information about the policy's state. Must be json serializable.
Returns:
| Type | Description |
|---|---|
dict
|
A dictionary containing additional information about the policy. |
get_server_metadata
¶
infer
¶
Source code in molmo_spaces/policy/learned_policy/websocket_policy.py
inference_model
¶
Source code in molmo_spaces/policy/learned_policy/websocket_policy.py
model_output_to_action
¶
obs_to_model_input
¶
Source code in molmo_spaces/policy/learned_policy/websocket_policy.py
prepare_model
¶
render
¶
reset
¶
Reset the policy's internal state.
This method should be implemented by each subclass to reset the policy's internal state. It is typically called at the beginning of each episode or task.
random_policy
¶
Classes:
| Name | Description |
|---|---|
RandomPolicy |
A Random Policy that selects actions randomly. |
RandomPolicy
¶
RandomPolicy(config: MlSpacesExpConfig)
Bases: BasePolicy
A Random Policy that selects actions randomly.
Methods:
| Name | Description |
|---|---|
add_auxiliary_objects |
Add auxiliary objects to the scene that might be required for the policy. |
create_policy_sensors |
Create a list of policy-specific sensors. |
get_action |
Decide on a random action to take based on the action space. |
get_info |
Get additional information from the policy. Called after episode ended. This method can be |
reset |
Reset the policy state. No state to reset for RandomPolicy. |
Attributes:
| Name | Type | Description |
|---|---|---|
action_space |
|
|
config |
|
|
task |
|
|
type |
str
|
|
Source code in molmo_spaces/policy/random_policy.py
add_auxiliary_objects
staticmethod
¶
add_auxiliary_objects(config: MlSpacesExpConfig, spec: MjSpec) -> None
Add auxiliary objects to the scene that might be required for the policy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
MlSpacesExpConfig
|
The configuration for the policy. |
required |
spec
|
MjSpec
|
The experiment configuration. |
required |
Source code in molmo_spaces/policy/base_policy.py
get_action
¶
Decide on a random action to take based on the action space.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
observation
|
The current observation about the task or environment (not used). |
required |
Returns:
| Type | Description |
|---|---|
|
A random action from the action space. |
Source code in molmo_spaces/policy/random_policy.py
get_info
¶
Get additional information from the policy. Called after episode ended. This method can be overridden by subclasses to provide extra information about the policy's state. Must be json serializable.
Returns:
| Type | Description |
|---|---|
dict
|
A dictionary containing additional information about the policy. |
Source code in molmo_spaces/policy/base_policy.py
solvers
¶
Heuristic policies for data generation.
Modules:
| Name | Description |
|---|---|
curobo_planner_policy |
|
move_solver |
|
navigation |
|
object_manipulation |
Object manipulation (open/close/pick/pick-place) planner policies. |
opening_solver |
|
curobo_planner_policy
¶
Classes:
| Name | Description |
|---|---|
CuroboPlannerPolicy |
Base class for Curobo-based planner policies. |
Attributes:
| Name | Type | Description |
|---|---|---|
log |
|
CuroboPlannerPolicy
¶
CuroboPlannerPolicy(config: MlSpacesExpConfig, task: BaseMujocoTask | None = None)
Bases: PlannerPolicy
Base class for Curobo-based planner policies.
This class provides common functionality for motion planning using Curobo, including trajectory execution, coordinate frame transformations, and gripper control. Subclasses should implement task-specific planning logic.
Methods:
| Name | Description |
|---|---|
add_auxiliary_objects |
Add auxiliary objects to the scene that might be required for the policy. |
batch_plan_trajectory |
Plan trajectory using batch motion planning. |
clip_to_velocity_constraint |
Clip action to respect velocity constraints. |
create_policy_sensors |
Create a list of policy-specific sensors. |
get_action |
Decide on the action to take based on the current observation of the or environment. |
get_all_phases |
Returns: |
get_info |
Get additional information from the policy. Called after episode ended. This method can be |
get_look_at_action |
Get action to look at a target. |
get_phase |
Returns: |
reset |
Reset the policy state. |
select_arm |
Select which arm to use based on distance to pickup object. |
solve_ik |
Solve inverse kinematics for a target pose and create interpolated trajectory. |
visualize_world_config_mesh |
Visualize the world configuration as a mesh file. |
Attributes:
| Name | Type | Description |
|---|---|---|
arm_end_idx |
int
|
|
arm_side |
str | None
|
|
arm_start_idx |
int
|
|
config |
|
|
current_gripper_command |
dict[str, float]
|
|
is_done |
bool
|
Property to expose completion state for task checking. |
planned_trajectory |
list[list[float]] | None
|
|
planner |
CuroboPlanner | None
|
|
planner_joint_ranges |
dict[str, tuple[int, int]]
|
|
planners |
dict[str, CuroboPlanner]
|
Return dictionary of planner instances. |
profiler |
|
|
retry_count |
int
|
The number of retries the policy has taken. |
steps_spent_in_waypoint |
int
|
|
task |
|
|
trajectory_index |
int
|
|
Source code in molmo_spaces/policy/solvers/curobo_planner_policy.py
is_done
abstractmethod
property
¶
Property to expose completion state for task checking.
planners
abstractmethod
property
¶
Return dictionary of planner instances.
add_auxiliary_objects
staticmethod
¶
add_auxiliary_objects(config: MlSpacesExpConfig, spec: MjSpec) -> None
Add auxiliary objects to the scene that might be required for the policy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
MlSpacesExpConfig
|
The configuration for the policy. |
required |
spec
|
MjSpec
|
The experiment configuration. |
required |
Source code in molmo_spaces/policy/base_policy.py
batch_plan_trajectory
¶
Plan trajectory using batch motion planning.
Uses the current phase to determine goal poses and plans trajectories in batches for efficiency. Sets self.planned_trajectory to the best trajectory found.
Source code in molmo_spaces/policy/solvers/curobo_planner_policy.py
499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 | |
clip_to_velocity_constraint
¶
Clip action to respect velocity constraints.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
action
|
dict[str, Any]
|
Dictionary of commanded joint positions by move group. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Clipped action dictionary. |
Source code in molmo_spaces/policy/solvers/curobo_planner_policy.py
create_policy_sensors
¶
create_policy_sensors() -> list[Sensor]
Create a list of policy-specific sensors.
Source code in molmo_spaces/policy/base_policy.py
get_action
abstractmethod
¶
Decide on the action to take based on the current observation of the or environment. Information could be observations, goals in the case of an rl_agent, or it could be the full environment state in the case of a planner.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
observation
|
The current information about the task or environment. |
required |
Returns:
| Type | Description |
|---|---|
|
The action to take in response to the information. |
Source code in molmo_spaces/policy/base_policy.py
get_all_phases
abstractmethod
¶
Returns:
| Type | Description |
|---|---|
dict[str | int]
|
A dictionary of all possible policy phases |
get_info
¶
Get additional information from the policy. Called after episode ended. This method can be overridden by subclasses to provide extra information about the policy's state. Must be json serializable.
Returns:
| Type | Description |
|---|---|
dict
|
A dictionary containing additional information about the policy. |
Source code in molmo_spaces/policy/base_policy.py
get_look_at_action
¶
Get action to look at a target.
Subclasses can override this to implement head tracking.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dictionary with head control commands, or empty dict. |
Source code in molmo_spaces/policy/solvers/curobo_planner_policy.py
get_phase
abstractmethod
¶
reset
¶
Reset the policy state.
select_arm
¶
Select which arm to use based on distance to pickup object.
Also instantiates the motion planner for the selected arm. This lazy initialization saves ~11GB of GPU memory by only loading one arm's planner.
Source code in molmo_spaces/policy/solvers/curobo_planner_policy.py
solve_ik
¶
Solve inverse kinematics for a target pose and create interpolated trajectory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target_pose
|
ndarray
|
4x4 transformation matrix for target end-effector pose in world frame. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If IK solution cannot be found. |
Source code in molmo_spaces/policy/solvers/curobo_planner_policy.py
visualize_world_config_mesh
¶
Visualize the world configuration as a mesh file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
world_cfg
|
WorldConfig
|
Curobo WorldConfig to visualize. |
required |
Source code in molmo_spaces/policy/solvers/curobo_planner_policy.py
619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 | |
move_solver
¶
navigation
¶
Modules:
| Name | Description |
|---|---|
astar_planner_policy |
|
astar_planner_policy
¶
Classes:
| Name | Description |
|---|---|
AStarPlannerPolicy |
|
AStarSmoothPlannerPolicy |
|
Attributes:
| Name | Type | Description |
|---|---|---|
log |
This planner policy relies on the computation of a sparse set of (x,y) waypoints |
log
module-attribute
¶
This planner policy relies on the computation of a sparse set of (x,y) waypoints from the AStarPlanner. It then builds a navigation plan by interleaving rotation and translation phases with interpolated waypoints (either by slerp for rotation phases, or by linear interpolation for translation ones).
Note: Even though rotation phases could be ideally skipped for waypoints that are
colinear (i.e., interpolated between two spatially distant planner waypoints), as
the agent orientation is constant, we still allow a correction, since the controller
can deviate from the ideal plan. We introduce corrections by means of two mechanisms:
1. Enforcing some intermediate waypoints between spatially distant ones, regardless
of Euclidean distance (via path_interpolation_density, which can be kept low,
e.g. 1)
2. Enforcing intermediate waypoint to keep consecutive ones under a limit distance
(via path_max_inter_waypoint_dist, which should be kept low enough to prevent
too much overshooting by the controller)
Note 2: For rotation, we limit the maximal arc length via path_max_inter_waypoint_angle,
which we set by default to 10 degrees. This, combined with a fix in the holonomic
base control to express the current yaw according to the intended motion direction to
prevent wrapping errors, leads to smooth rotations.
Note 3: the current replanning heuristic is brittle, so we can just switch it off by
e.g. setting plan_fail_after_waypoint_steps to a value larger than the task horizon.
Some TODOs
- Use joint_pos_rel to decide upon failure to complete previous action
- Select the nearest plannable random location near target instead of first one with valid plan
AStarPlannerPolicy
¶
AStarPlannerPolicy(config: MlSpacesExpConfig, task: BaseMujocoTask)
Bases: PlannerPolicy
Methods:
| Name | Description |
|---|---|
add_auxiliary_objects |
Add auxiliary objects to the scene that might be required for the policy. |
build_policy_plan |
|
create_policy_sensors |
Create a list of policy-specific sensors. |
current_waypoint |
|
get_action |
Decide on the action to take based on the current observation of the or environment. |
get_all_phases |
Returns: |
get_info |
Get additional information from the policy. Called after episode ended. This method can be |
get_phase |
Returns: |
interpolate_waypoints |
Interpolate waypoints between each pair of waypoints. |
max_angle_waypoints |
|
max_dist_waypoints |
|
planners |
Abstract property representing the list or dict of planner instances. |
reset |
Reset the policy's internal state. |
skip_candidate |
|
stop_plan |
|
Attributes:
| Name | Type | Description |
|---|---|---|
candidate_objs |
list[MlSpacesObject]
|
|
config |
|
|
nav_goal_sampler |
NavGoalSampler
|
|
nav_plan |
|
|
nav_planner |
|
|
retry_count |
int
|
The number of retries the policy has taken. |
robot_view |
|
|
target_object |
MlSpacesObject
|
Get the nearest navigation target object for the current batch. |
target_pos_quat |
|
|
task |
|
Source code in molmo_spaces/policy/solvers/navigation/astar_planner_policy.py
target_object
property
¶target_object: MlSpacesObject
Get the nearest navigation target object for the current batch.
add_auxiliary_objects
staticmethod
¶add_auxiliary_objects(config: MlSpacesExpConfig, spec: MjSpec) -> None
Add auxiliary objects to the scene that might be required for the policy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
MlSpacesExpConfig
|
The configuration for the policy. |
required |
spec
|
MjSpec
|
The experiment configuration. |
required |
Source code in molmo_spaces/policy/base_policy.py
build_policy_plan
¶Source code in molmo_spaces/policy/solvers/navigation/astar_planner_policy.py
create_policy_sensors
¶create_policy_sensors() -> list[Sensor]
Create a list of policy-specific sensors.
Source code in molmo_spaces/policy/base_policy.py
current_waypoint
¶Source code in molmo_spaces/policy/solvers/navigation/astar_planner_policy.py
373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 | |
get_action
¶Decide on the action to take based on the current observation of the or environment. Information could be observations, goals in the case of an rl_agent, or it could be the full environment state in the case of a planner.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
observation
|
The current information about the task or environment. |
required |
Returns:
| Type | Description |
|---|---|
|
The action to take in response to the information. |
Source code in molmo_spaces/policy/solvers/navigation/astar_planner_policy.py
get_all_phases
¶ get_info
¶Get additional information from the policy. Called after episode ended. This method can be overridden by subclasses to provide extra information about the policy's state. Must be json serializable.
Returns:
| Type | Description |
|---|---|
dict
|
A dictionary containing additional information about the policy. |
Source code in molmo_spaces/policy/base_policy.py
get_phase
¶ interpolate_waypoints
¶Interpolate waypoints between each pair of waypoints.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
waypoints
|
ndarray
|
original waypoints array, shape (N, 2) |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
interpolated waypoints array |
Source code in molmo_spaces/policy/solvers/navigation/astar_planner_policy.py
max_angle_waypoints
¶Source code in molmo_spaces/policy/solvers/navigation/astar_planner_policy.py
max_dist_waypoints
¶Source code in molmo_spaces/policy/solvers/navigation/astar_planner_policy.py
planners
¶ reset
¶Reset the policy's internal state.
This method should be implemented by each subclass to reset the policy's internal state. It is typically called at the beginning of each episode or task.
Source code in molmo_spaces/policy/solvers/navigation/astar_planner_policy.py
skip_candidate
¶ stop_plan
¶Source code in molmo_spaces/policy/solvers/navigation/astar_planner_policy.py
AStarSmoothPlannerPolicy
¶
AStarSmoothPlannerPolicy(config: MlSpacesExpConfig, task: BaseMujocoTask)
Bases: AStarPlannerPolicy
Methods:
| Name | Description |
|---|---|
add_auxiliary_objects |
Add auxiliary objects to the scene that might be required for the policy. |
build_policy_plan |
|
create_policy_sensors |
Create a list of policy-specific sensors. |
current_waypoint |
|
get_action |
Decide on the action to take based on the current observation of the or environment. |
get_all_phases |
Returns: |
get_info |
Get additional information from the policy. Called after episode ended. This method can be |
get_phase |
Returns: |
interpolate_waypoints |
Interpolate waypoints between each pair of waypoints. |
max_angle_waypoints |
|
max_dist_waypoints |
|
planners |
Abstract property representing the list or dict of planner instances. |
reset |
Reset the policy's internal state. |
skip_candidate |
|
stop_plan |
|
Attributes:
| Name | Type | Description |
|---|---|---|
candidate_objs |
list[MlSpacesObject]
|
|
config |
|
|
nav_goal_sampler |
NavGoalSampler
|
|
nav_plan |
|
|
nav_planner |
|
|
retry_count |
int
|
The number of retries the policy has taken. |
robot_view |
|
|
target_object |
MlSpacesObject
|
Get the nearest navigation target object for the current batch. |
target_pos_quat |
|
|
task |
|
Source code in molmo_spaces/policy/solvers/navigation/astar_planner_policy.py
target_object
property
¶target_object: MlSpacesObject
Get the nearest navigation target object for the current batch.
add_auxiliary_objects
staticmethod
¶add_auxiliary_objects(config: MlSpacesExpConfig, spec: MjSpec) -> None
Add auxiliary objects to the scene that might be required for the policy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
MlSpacesExpConfig
|
The configuration for the policy. |
required |
spec
|
MjSpec
|
The experiment configuration. |
required |
Source code in molmo_spaces/policy/base_policy.py
build_policy_plan
¶Source code in molmo_spaces/policy/solvers/navigation/astar_planner_policy.py
create_policy_sensors
¶create_policy_sensors() -> list[Sensor]
Create a list of policy-specific sensors.
Source code in molmo_spaces/policy/base_policy.py
current_waypoint
¶Source code in molmo_spaces/policy/solvers/navigation/astar_planner_policy.py
373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 | |
get_action
¶Decide on the action to take based on the current observation of the or environment. Information could be observations, goals in the case of an rl_agent, or it could be the full environment state in the case of a planner.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
observation
|
The current information about the task or environment. |
required |
Returns:
| Type | Description |
|---|---|
|
The action to take in response to the information. |
Source code in molmo_spaces/policy/solvers/navigation/astar_planner_policy.py
get_all_phases
¶ get_info
¶Get additional information from the policy. Called after episode ended. This method can be overridden by subclasses to provide extra information about the policy's state. Must be json serializable.
Returns:
| Type | Description |
|---|---|
dict
|
A dictionary containing additional information about the policy. |
Source code in molmo_spaces/policy/base_policy.py
get_phase
¶ interpolate_waypoints
¶Interpolate waypoints between each pair of waypoints.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
waypoints
|
ndarray
|
original waypoints array, shape (N, 2) |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
interpolated waypoints array |
Source code in molmo_spaces/policy/solvers/navigation/astar_planner_policy.py
max_angle_waypoints
¶Source code in molmo_spaces/policy/solvers/navigation/astar_planner_policy.py
max_dist_waypoints
¶Source code in molmo_spaces/policy/solvers/navigation/astar_planner_policy.py
planners
¶ reset
¶Reset the policy's internal state.
This method should be implemented by each subclass to reset the policy's internal state. It is typically called at the beginning of each episode or task.
Source code in molmo_spaces/policy/solvers/navigation/astar_planner_policy.py
skip_candidate
¶ stop_plan
¶Source code in molmo_spaces/policy/solvers/navigation/astar_planner_policy.py
object_manipulation
¶
Object manipulation (open/close/pick/pick-place) planner policies.
Modules:
base_object_manipulation_planner_policy
¶
Classes:
| Name | Description |
|---|---|
ActionPrimitive |
Abstract base class for action primitives. |
BaseObjectManipulationPlannerPolicy |
Base class for object manipulation (open/close/pick/pick-place) planner policies. |
GraspPoseSensor |
Sensor for the planned grasp pose in 7D format. |
GripperAction |
Action primitive that opens or closes the gripper. |
JointMoveSegment |
A move segment that moves the robot joints to a target configuration. |
JointMoveSequence |
Action primitive that tracks a trajectory in joint space. |
MoveSegment |
A move segment is a single movement in a MoveSequence, |
MoveSequence |
A sequence of (TCP or joint) move segments executed sequentially without pauses. |
NoopAction |
Action primitive that does nothing for a given duration. |
TCPMoveSegment |
A move segment that moves the robot TCP to a target pose. |
TCPMoveSequence |
Action primitive that tracks a trajectory in task space. |
Attributes:
| Name | Type | Description |
|---|---|---|
log |
|
ActionPrimitive
¶
ActionPrimitive(robot_view: RobotView, duration: float)
Bases: ABC
Abstract base class for action primitives. An action primitive is a single action that can be executed by the robot.
Methods:
| Name | Description |
|---|---|
check_failure |
|
elapsed_time |
|
execute |
|
get_current_action |
|
get_current_phase |
|
reset |
|
Attributes:
| Name | Type | Description |
|---|---|---|
duration |
|
|
robot_view |
|
|
start_time |
|
Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
BaseObjectManipulationPlannerPolicy
¶
BaseObjectManipulationPlannerPolicy(config: MlSpacesExpConfig, task: BaseMujocoTask)
Bases: PlannerPolicy
Base class for object manipulation (open/close/pick/pick-place) planner policies. This class provides common functionality for object manipulation planner policies, including concatenating multiple action primitives into a single trajectory.
Methods:
| Name | Description |
|---|---|
add_auxiliary_objects |
Add auxiliary objects to the scene that might be required for the policy. |
check_feasible_ik |
|
create_policy_sensors |
Create a list of policy-specific sensors. |
get_action |
Decide on the action to take based on the current observation of the or environment. |
get_all_phases |
Returns: |
get_info |
Get additional information from the policy. Called after episode ended. This method can be |
get_phase |
Returns: |
reset |
Reset the policy's internal state. |
Attributes:
| Name | Type | Description |
|---|---|---|
action_idx |
|
|
action_primitives |
|
|
config |
|
|
ik_warmed_up |
|
|
planners |
Abstract property representing the list or dict of planner instances. |
|
policy_config |
|
|
retry_count |
int
|
The number of retries the policy has taken. |
robot_view |
|
|
sequential_ik_failures |
|
|
target_poses |
|
|
task |
|
Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
add_auxiliary_objects
staticmethod
¶add_auxiliary_objects(config: MlSpacesExpConfig, spec: MjSpec) -> None
Add auxiliary objects to the scene that might be required for the policy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
MlSpacesExpConfig
|
The configuration for the policy. |
required |
spec
|
MjSpec
|
The experiment configuration. |
required |
Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
check_feasible_ik
¶Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
get_action
¶Decide on the action to take based on the current observation of the or environment. Information could be observations, goals in the case of an rl_agent, or it could be the full environment state in the case of a planner.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
observation
|
The current information about the task or environment. |
required |
Returns:
| Type | Description |
|---|---|
|
The action to take in response to the information. |
Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
get_all_phases
¶Returns:
| Type | Description |
|---|---|
dict[str | int]
|
A dictionary of all possible policy phases |
Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
get_info
¶Get additional information from the policy. Called after episode ended. This method can be overridden by subclasses to provide extra information about the policy's state. Must be json serializable.
Returns:
| Type | Description |
|---|---|
dict
|
A dictionary containing additional information about the policy. |
Source code in molmo_spaces/policy/base_policy.py
get_phase
¶Returns:
| Type | Description |
|---|---|
str
|
The current policy phase |
Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
reset
¶Reset the policy's internal state.
This method should be implemented by each subclass to reset the policy's internal state. It is typically called at the beginning of each episode or task.
Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
GraspPoseSensor
¶
Bases: Sensor
Sensor for the planned grasp pose in 7D format.
Methods:
| Name | Description |
|---|---|
get_observation |
Get grasp pose (using current TCP pose as proxy). |
reset |
Reset the sensor to its initial state. |
Attributes:
| Name | Type | Description |
|---|---|---|
is_dict |
bool
|
|
observation_space |
Space
|
|
str_max_len |
int
|
|
uuid |
str
|
|
Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
get_observation
¶Get grasp pose (using current TCP pose as proxy).
Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
GripperAction
¶
GripperAction(robot_view: RobotView, target_open: bool, duration: float)
Bases: ActionPrimitive
Action primitive that opens or closes the gripper.
Methods:
| Name | Description |
|---|---|
check_failure |
|
elapsed_time |
|
execute |
|
get_current_action |
|
get_current_phase |
|
reset |
|
Attributes:
| Name | Type | Description |
|---|---|---|
duration |
|
|
robot_view |
|
|
start_time |
|
|
target_open |
|
Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
check_failure
¶ elapsed_time
¶ execute
¶Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
get_current_action
¶ get_current_phase
¶
JointMoveSegment
dataclass
¶
JointMoveSegment(name: str, start_qpos: dict[str, ndarray | list[float]] | None, end_qpos: dict[str, ndarray | list[float]], duration_s: float)
Bases: MoveSegment
A move segment that moves the robot joints to a target configuration. The movement is a straight line in joint space.
Attributes:
| Name | Type | Description |
|---|---|---|
duration |
float
|
|
duration_s |
float
|
|
end_qpos |
dict[str, ndarray | list[float]]
|
|
name |
str
|
|
start_qpos |
dict[str, ndarray | list[float]] | None
|
|
JointMoveSequence
¶
JointMoveSequence(robot_view: RobotView, settle_time: float, move_segments: list[JointMoveSegment], is_holding_object: bool = False, gripper_empty_threshold: float = 0.0)
Bases: MoveSequence
Action primitive that tracks a trajectory in joint space. Waypoints are interpolated linearly in joint space. The sequence is terminated after the cumulative duration of the move segments, plus the settling period.
Methods:
| Name | Description |
|---|---|
check_failure |
|
elapsed_time |
|
execute |
|
get_current_action |
|
get_current_phase |
|
reset |
|
Attributes:
| Name | Type | Description |
|---|---|---|
duration |
|
|
gripper_empty_threshold |
|
|
is_holding_object |
|
|
move_seg_idx |
|
|
move_seg_start_time |
|
|
move_segments |
list[JointMoveSegment]
|
|
robot_view |
|
|
settle_time |
|
|
start_time |
|
Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
check_failure
¶Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
elapsed_time
¶ execute
¶Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
get_current_action
¶Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
get_current_phase
¶Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
MoveSegment
dataclass
¶
MoveSequence
¶
MoveSequence(robot_view: RobotView, settle_time: float, move_segments: list[MoveSegment], is_holding_object: bool = False, gripper_empty_threshold: float = 0.0)
Bases: ActionPrimitive
A sequence of (TCP or joint) move segments executed sequentially without pauses. The sequence is terminated when the last move segment is completed, after a settling period.
Methods:
| Name | Description |
|---|---|
check_failure |
|
elapsed_time |
|
execute |
|
get_current_action |
|
get_current_phase |
|
reset |
|
Attributes:
| Name | Type | Description |
|---|---|---|
duration |
|
|
gripper_empty_threshold |
|
|
is_holding_object |
|
|
move_seg_idx |
|
|
move_seg_start_time |
|
|
robot_view |
|
|
settle_time |
|
|
start_time |
|
Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
check_failure
¶Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
elapsed_time
¶ execute
¶Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
get_current_action
¶Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
get_current_phase
¶Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
NoopAction
¶
NoopAction(robot_view: RobotView, duration: float)
Bases: ActionPrimitive
Action primitive that does nothing for a given duration.
Methods:
| Name | Description |
|---|---|
check_failure |
|
elapsed_time |
|
execute |
|
get_current_action |
|
get_current_phase |
|
reset |
|
Attributes:
| Name | Type | Description |
|---|---|---|
duration |
|
|
robot_view |
|
|
start_time |
|
Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
TCPMoveSegment
dataclass
¶
Bases: MoveSegment
A move segment that moves the robot TCP to a target pose. The movement is a straight line in task space.
Attributes:
| Name | Type | Description |
|---|---|---|
duration |
float
|
|
end_pose |
ndarray
|
|
name |
str
|
|
speed |
float
|
|
start_pose |
ndarray
|
|
TCPMoveSequence
¶
TCPMoveSequence(robot_view: RobotView, tcp_to_jp_fn: Callable[[str, ndarray], dict[str, Any]], settle_time: float, move_segments: list[TCPMoveSegment], is_holding_object: bool = False, gripper_empty_threshold: float = 0.0, tcp_pos_err_threshold: float = inf, tcp_rot_err_threshold: float = inf)
Bases: MoveSequence
Action primitive that tracks a trajectory in task space. Waypoints are interpolated linearly in task space. The sequence is terminated after the cumulative duration of the move segments, plus the settling period.
Methods:
| Name | Description |
|---|---|
check_failure |
|
elapsed_time |
|
execute |
|
get_current_action |
|
get_current_phase |
|
get_current_target_pose |
|
reset |
|
Attributes:
Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
check_failure
¶Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
elapsed_time
¶ execute
¶Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
get_current_action
¶Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
get_current_phase
¶Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
get_current_target_pose
¶Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
curobo_open_close_planner_policy
¶
Classes:
| Name | Description |
|---|---|
CuroboOpenClosePlannerPolicy |
Curobo-based planner policy for open/close articulated object tasks. |
OpenClosePhase |
|
Attributes:
| Name | Type | Description |
|---|---|---|
log |
|
CuroboOpenClosePlannerPolicy
¶
CuroboOpenClosePlannerPolicy(config: MlSpacesExpConfig, task: BaseMujocoTask)
Bases: CuroboPlannerPolicy, OpenClosePlannerPolicy
Curobo-based planner policy for open/close articulated object tasks.
Inherits common motion planning functionality from CuroboPlannerPolicy and task-specific functionality from OpenClosePlannerPolicy. Planning requests are made to a remote CuroboPlanner server via CuroboClient.
Methods:
| Name | Description |
|---|---|
add_auxiliary_objects |
Add auxiliary objects to the scene that might be required for the policy. |
batch_plan_trajectory |
Plan trajectory in batches. |
check_feasible_ik |
|
clip_to_velocity_constraint |
Clip action to respect velocity constraints. |
create_policy_sensors |
Create a list of policy-specific sensors. |
get_action |
Decide on the action to take based on the current observation of the or environment. |
get_all_phases |
Return list of all phase names. |
get_info |
Get additional information from the policy. Called after episode ended. This method can be |
get_look_at_action |
Get action to look at a target. |
get_phase |
Returns: |
reset |
Reset the policy state. |
select_arm |
Select which arm to use and set up the planner (local or remote). |
solve_ik |
Solve IK and create an interpolated trajectory. |
visualize_world_config_mesh |
Visualize the world configuration as a mesh file. |
Attributes:
| Name | Type | Description |
|---|---|---|
action_idx |
|
|
action_primitives |
|
|
arm_end_idx |
int
|
|
arm_side |
str | None
|
|
arm_start_idx |
int
|
|
articulation_pose_index |
|
|
client |
CuroboClient | None
|
|
config |
|
|
current_gripper_command |
dict[str, float]
|
|
current_phase |
|
|
grasping_timesteps |
|
|
height_adjustment_steps |
|
|
ik_warmed_up |
|
|
is_done |
bool
|
Property to expose completion state for task checking. |
opening_timesteps |
|
|
planned_trajectory |
list[list[float]] | None
|
|
planner |
CuroboPlanner | None
|
|
planner_joint_ranges |
dict[str, tuple[int, int]]
|
|
planners |
dict
|
Return dictionary of planner instances. |
policy_config |
|
|
pre_grasp_poses |
|
|
profiler |
|
|
retry_count |
int
|
The number of retries the policy has taken. |
robot_view |
|
|
sequential_ik_failures |
|
|
settle_steps |
|
|
steps_spent_in_waypoint |
int
|
|
target_poses |
|
|
task |
|
|
trajectory_index |
int
|
|
Source code in molmo_spaces/policy/solvers/object_manipulation/curobo_open_close_planner_policy.py
add_auxiliary_objects
staticmethod
¶add_auxiliary_objects(config: MlSpacesExpConfig, spec: MjSpec) -> None
Add auxiliary objects to the scene that might be required for the policy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
MlSpacesExpConfig
|
The configuration for the policy. |
required |
spec
|
MjSpec
|
The experiment configuration. |
required |
Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
batch_plan_trajectory
¶Plan trajectory in batches.
Uses local planner or remote server depending on configuration. When using the server, lock joints and obstacles are passed atomically with each planning request to avoid races when multiple workers share the same server.
Source code in molmo_spaces/policy/solvers/object_manipulation/curobo_open_close_planner_policy.py
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 | |
check_feasible_ik
¶Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
clip_to_velocity_constraint
¶Clip action to respect velocity constraints.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
action
|
dict[str, Any]
|
Dictionary of commanded joint positions by move group. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Clipped action dictionary. |
Source code in molmo_spaces/policy/solvers/curobo_planner_policy.py
get_action
¶Decide on the action to take based on the current observation of the or environment. Information could be observations, goals in the case of an rl_agent, or it could be the full environment state in the case of a planner.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
observation
|
The current information about the task or environment. |
required |
Returns:
| Type | Description |
|---|---|
|
The action to take in response to the information. |
Source code in molmo_spaces/policy/solvers/object_manipulation/curobo_open_close_planner_policy.py
get_all_phases
¶ get_info
¶Get additional information from the policy. Called after episode ended. This method can be overridden by subclasses to provide extra information about the policy's state. Must be json serializable.
Returns:
| Type | Description |
|---|---|
dict
|
A dictionary containing additional information about the policy. |
Source code in molmo_spaces/policy/base_policy.py
get_look_at_action
¶Get action to look at a target.
Subclasses can override this to implement head tracking.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dictionary with head control commands, or empty dict. |
Source code in molmo_spaces/policy/solvers/curobo_planner_policy.py
get_phase
¶get_phase() -> OpenClosePhase
reset
¶Reset the policy state.
Source code in molmo_spaces/policy/solvers/object_manipulation/curobo_open_close_planner_policy.py
select_arm
¶Select which arm to use and set up the planner (local or remote).
Source code in molmo_spaces/policy/solvers/object_manipulation/curobo_open_close_planner_policy.py
solve_ik
¶Solve IK and create an interpolated trajectory.
Uses local planner or remote server depending on configuration. When using the server, lock joints and obstacles are passed atomically with the request to avoid races when multiple workers share the same server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target_pose
|
ndarray
|
4x4 transformation matrix for target end-effector pose in world frame. |
required |
Source code in molmo_spaces/policy/solvers/object_manipulation/curobo_open_close_planner_policy.py
visualize_world_config_mesh
¶Visualize the world configuration as a mesh file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
world_cfg
|
WorldConfig
|
Curobo WorldConfig to visualize. |
required |
Source code in molmo_spaces/policy/solvers/curobo_planner_policy.py
619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 | |
OpenClosePhase
¶
Bases: str, Enum
Attributes:
| Name | Type | Description |
|---|---|---|
ARTICULATE |
|
|
DONE |
|
|
GRASP |
|
|
HEIGHT_SELECTION |
|
|
POSTARTICULATE |
|
|
PREGRASP |
|
curobo_pick_and_place_planner_policy
¶
Classes:
| Name | Description |
|---|---|
CuroboPickAndPlacePlannerPolicy |
Curobo-based planner policy for pick and place tasks. |
PickAndPlacePhase |
|
Attributes:
| Name | Type | Description |
|---|---|---|
log |
|
CuroboPickAndPlacePlannerPolicy
¶
CuroboPickAndPlacePlannerPolicy(config: MlSpacesExpConfig, task: BaseMujocoTask)
Bases: CuroboPlannerPolicy, PickAndPlacePlannerPolicy
Curobo-based planner policy for pick and place tasks.
Inherits common motion planning functionality from CuroboPlannerPolicy and task-specific functionality from PickAndPlacePlannerPolicy. Planning requests are made to a remote CuroboPlanner server via CuroboClient.
Methods:
| Name | Description |
|---|---|
add_auxiliary_objects |
Add auxiliary objects to the scene that might be required for the policy. |
batch_plan_trajectory |
Plan trajectory in batches. |
check_feasible_ik |
|
clip_to_velocity_constraint |
Clip action to respect velocity constraints. |
create_policy_sensors |
Create a list of policy-specific sensors. |
get_action |
Decide on the action to take based on the current observation of the or environment. |
get_all_phases |
Return list of all phase names. |
get_info |
Get additional information from the policy. Called after episode ended. This method can be |
get_look_at_action |
Get action to look at a target. |
get_phase |
Returns: |
reset |
Reset the policy state. |
select_arm |
Select which arm to use and set up the planner (local or remote). |
solve_ik |
Solve IK and create an interpolated trajectory. |
visualize_world_config_mesh |
Visualize the world configuration as a mesh file. |
Attributes:
| Name | Type | Description |
|---|---|---|
action_idx |
|
|
action_primitives |
|
|
arm_end_idx |
int
|
|
arm_side |
str | None
|
|
arm_start_idx |
int
|
|
client |
CuroboClient | None
|
|
config |
|
|
current_gripper_command |
dict[str, float]
|
|
current_phase |
|
|
grasping_timesteps |
|
|
ik_warmed_up |
|
|
is_done |
bool
|
Property to expose completion state for task checking. |
opening_timesteps |
|
|
place_poses |
|
|
planned_trajectory |
list[list[float]] | None
|
|
planner |
CuroboPlanner | None
|
|
planner_joint_ranges |
dict[str, tuple[int, int]]
|
|
planners |
dict
|
Return dictionary of planner instances. |
policy_config |
|
|
pre_grasp_poses |
|
|
profiler |
|
|
retry_count |
int
|
The number of retries the policy has taken. |
robot_view |
|
|
sequential_ik_failures |
|
|
settle_steps |
|
|
steps_spent_in_waypoint |
int
|
|
target_poses |
|
|
task |
|
|
trajectory_index |
int
|
|
Source code in molmo_spaces/policy/solvers/object_manipulation/curobo_pick_and_place_planner_policy.py
add_auxiliary_objects
staticmethod
¶add_auxiliary_objects(config: MlSpacesExpConfig, spec: MjSpec) -> None
Add auxiliary objects to the scene that might be required for the policy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
MlSpacesExpConfig
|
The configuration for the policy. |
required |
spec
|
MjSpec
|
The experiment configuration. |
required |
Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
batch_plan_trajectory
¶Plan trajectory in batches.
Uses local planner or remote server depending on configuration. When using the server, obstacles are passed atomically with each planning request to avoid races when multiple workers share the same server.
Source code in molmo_spaces/policy/solvers/object_manipulation/curobo_pick_and_place_planner_policy.py
385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 | |
check_feasible_ik
¶Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
clip_to_velocity_constraint
¶Clip action to respect velocity constraints.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
action
|
dict[str, Any]
|
Dictionary of commanded joint positions by move group. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Clipped action dictionary. |
Source code in molmo_spaces/policy/solvers/curobo_planner_policy.py
get_action
¶Decide on the action to take based on the current observation of the or environment. Information could be observations, goals in the case of an rl_agent, or it could be the full environment state in the case of a planner.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
observation
|
The current information about the task or environment. |
required |
Returns:
| Type | Description |
|---|---|
|
The action to take in response to the information. |
Source code in molmo_spaces/policy/solvers/object_manipulation/curobo_pick_and_place_planner_policy.py
get_all_phases
¶ get_info
¶Get additional information from the policy. Called after episode ended. This method can be overridden by subclasses to provide extra information about the policy's state. Must be json serializable.
Returns:
| Type | Description |
|---|---|
dict
|
A dictionary containing additional information about the policy. |
Source code in molmo_spaces/policy/base_policy.py
get_look_at_action
¶Get action to look at a target.
Subclasses can override this to implement head tracking.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dictionary with head control commands, or empty dict. |
Source code in molmo_spaces/policy/solvers/curobo_planner_policy.py
get_phase
¶get_phase() -> PickAndPlacePhase
reset
¶Reset the policy state.
Source code in molmo_spaces/policy/solvers/object_manipulation/curobo_pick_and_place_planner_policy.py
select_arm
¶Select which arm to use and set up the planner (local or remote).
Source code in molmo_spaces/policy/solvers/object_manipulation/curobo_pick_and_place_planner_policy.py
solve_ik
¶Solve IK and create an interpolated trajectory.
Uses local planner or remote server depending on configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target_pose
|
ndarray
|
4x4 transformation matrix for target end-effector pose in world frame. |
required |
Source code in molmo_spaces/policy/solvers/object_manipulation/curobo_pick_and_place_planner_policy.py
visualize_world_config_mesh
¶Visualize the world configuration as a mesh file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
world_cfg
|
WorldConfig
|
Curobo WorldConfig to visualize. |
required |
Source code in molmo_spaces/policy/solvers/curobo_planner_policy.py
619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 | |
open_close_planner_policy
¶
Classes:
| Name | Description |
|---|---|
OpenClosePlannerPolicy |
|
Attributes:
| Name | Type | Description |
|---|---|---|
log |
|
OpenClosePlannerPolicy
¶
OpenClosePlannerPolicy(config: MlSpacesExpConfig, task: BaseMujocoTask)
Bases: BaseObjectManipulationPlannerPolicy
Methods:
| Name | Description |
|---|---|
add_auxiliary_objects |
Add auxiliary objects to the scene that might be required for the policy. |
check_feasible_ik |
|
create_policy_sensors |
Create a list of policy-specific sensors. |
get_action |
Decide on the action to take based on the current observation of the or environment. |
get_all_phases |
Returns: |
get_info |
Get additional information from the policy. Called after episode ended. This method can be |
get_phase |
Returns: |
reset |
Reset the policy's internal state. |
Attributes:
| Name | Type | Description |
|---|---|---|
action_idx |
|
|
action_primitives |
|
|
config |
|
|
ik_warmed_up |
|
|
planners |
Abstract property representing the list or dict of planner instances. |
|
policy_config |
|
|
retry_count |
int
|
The number of retries the policy has taken. |
robot_view |
|
|
sequential_ik_failures |
|
|
target_poses |
|
|
task |
|
Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
add_auxiliary_objects
staticmethod
¶add_auxiliary_objects(config: MlSpacesExpConfig, spec: MjSpec) -> None
Add auxiliary objects to the scene that might be required for the policy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
MlSpacesExpConfig
|
The configuration for the policy. |
required |
spec
|
MjSpec
|
The experiment configuration. |
required |
Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
check_feasible_ik
¶Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
get_action
¶Decide on the action to take based on the current observation of the or environment. Information could be observations, goals in the case of an rl_agent, or it could be the full environment state in the case of a planner.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
observation
|
The current information about the task or environment. |
required |
Returns:
| Type | Description |
|---|---|
|
The action to take in response to the information. |
Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
get_all_phases
¶Returns:
| Type | Description |
|---|---|
dict[str | int]
|
A dictionary of all possible policy phases |
Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
get_info
¶Get additional information from the policy. Called after episode ended. This method can be overridden by subclasses to provide extra information about the policy's state. Must be json serializable.
Returns:
| Type | Description |
|---|---|
dict
|
A dictionary containing additional information about the policy. |
Source code in molmo_spaces/policy/base_policy.py
get_phase
¶Returns:
| Type | Description |
|---|---|
str
|
The current policy phase |
Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
reset
¶Reset the policy's internal state.
This method should be implemented by each subclass to reset the policy's internal state. It is typically called at the beginning of each episode or task.
Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
pick_and_place_color_planner_policy
¶
Classes:
| Name | Description |
|---|---|
PickAndPlaceColorPlannerPolicy |
Planner policy for pick and place color task. |
PickAndPlaceColorPlannerPolicy
¶
PickAndPlaceColorPlannerPolicy(config: MlSpacesExpConfig, task: BaseMujocoTask)
Bases: PickAndPlacePlannerPolicy
Planner policy for pick and place color task.
Methods:
| Name | Description |
|---|---|
add_auxiliary_objects |
Add auxiliary objects to the scene that might be required for the policy. |
check_feasible_ik |
|
create_policy_sensors |
Create a list of policy-specific sensors. |
get_action |
Decide on the action to take based on the current observation of the or environment. |
get_all_phases |
Returns: |
get_info |
Get additional information from the policy. Called after episode ended. This method can be |
get_phase |
Returns: |
reset |
Reset the policy's internal state. |
Attributes:
| Name | Type | Description |
|---|---|---|
action_idx |
|
|
action_primitives |
|
|
config |
|
|
ik_warmed_up |
|
|
planners |
Abstract property representing the list or dict of planner instances. |
|
policy_config |
|
|
retry_count |
int
|
The number of retries the policy has taken. |
robot_view |
|
|
sequential_ik_failures |
|
|
target_poses |
|
|
task |
|
Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
add_auxiliary_objects
staticmethod
¶add_auxiliary_objects(config: MlSpacesExpConfig, spec: MjSpec) -> None
Add auxiliary objects to the scene that might be required for the policy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
MlSpacesExpConfig
|
The configuration for the policy. |
required |
spec
|
MjSpec
|
The experiment configuration. |
required |
Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
check_feasible_ik
¶Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
get_action
¶Decide on the action to take based on the current observation of the or environment. Information could be observations, goals in the case of an rl_agent, or it could be the full environment state in the case of a planner.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
observation
|
The current information about the task or environment. |
required |
Returns:
| Type | Description |
|---|---|
|
The action to take in response to the information. |
Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
get_all_phases
¶Returns:
| Type | Description |
|---|---|
dict[str | int]
|
A dictionary of all possible policy phases |
Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
get_info
¶Get additional information from the policy. Called after episode ended. This method can be overridden by subclasses to provide extra information about the policy's state. Must be json serializable.
Returns:
| Type | Description |
|---|---|
dict
|
A dictionary containing additional information about the policy. |
Source code in molmo_spaces/policy/base_policy.py
get_phase
¶Returns:
| Type | Description |
|---|---|
str
|
The current policy phase |
Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
reset
¶Reset the policy's internal state.
This method should be implemented by each subclass to reset the policy's internal state. It is typically called at the beginning of each episode or task.
Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
pick_and_place_next_to_planner_policy
¶
Classes:
| Name | Description |
|---|---|
PickAndPlaceNextToPlannerPolicy |
Planner policy for pick and place next to task. |
PickAndPlaceNextToPlannerPolicy
¶
PickAndPlaceNextToPlannerPolicy(config: MlSpacesExpConfig, task: BaseMujocoTask)
Bases: PickAndPlacePlannerPolicy
Planner policy for pick and place next to task.
Methods:
| Name | Description |
|---|---|
add_auxiliary_objects |
Add auxiliary objects to the scene that might be required for the policy. |
check_feasible_ik |
|
create_policy_sensors |
Create a list of policy-specific sensors. |
get_action |
Decide on the action to take based on the current observation of the or environment. |
get_all_phases |
Returns: |
get_info |
Get additional information from the policy. Called after episode ended. This method can be |
get_phase |
Returns: |
reset |
Reset the policy's internal state. |
Attributes:
| Name | Type | Description |
|---|---|---|
action_idx |
|
|
action_primitives |
|
|
config |
|
|
ik_warmed_up |
|
|
planners |
Abstract property representing the list or dict of planner instances. |
|
policy_config |
|
|
retry_count |
int
|
The number of retries the policy has taken. |
robot_view |
|
|
sequential_ik_failures |
|
|
target_poses |
|
|
task |
|
Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
add_auxiliary_objects
staticmethod
¶add_auxiliary_objects(config: MlSpacesExpConfig, spec: MjSpec) -> None
Add auxiliary objects to the scene that might be required for the policy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
MlSpacesExpConfig
|
The configuration for the policy. |
required |
spec
|
MjSpec
|
The experiment configuration. |
required |
Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
check_feasible_ik
¶Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
get_action
¶Decide on the action to take based on the current observation of the or environment. Information could be observations, goals in the case of an rl_agent, or it could be the full environment state in the case of a planner.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
observation
|
The current information about the task or environment. |
required |
Returns:
| Type | Description |
|---|---|
|
The action to take in response to the information. |
Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
get_all_phases
¶Returns:
| Type | Description |
|---|---|
dict[str | int]
|
A dictionary of all possible policy phases |
Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
get_info
¶Get additional information from the policy. Called after episode ended. This method can be overridden by subclasses to provide extra information about the policy's state. Must be json serializable.
Returns:
| Type | Description |
|---|---|
dict
|
A dictionary containing additional information about the policy. |
Source code in molmo_spaces/policy/base_policy.py
get_phase
¶Returns:
| Type | Description |
|---|---|
str
|
The current policy phase |
Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
reset
¶Reset the policy's internal state.
This method should be implemented by each subclass to reset the policy's internal state. It is typically called at the beginning of each episode or task.
Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
pick_and_place_planner_policy
¶
Classes:
| Name | Description |
|---|---|
PickAndPlacePlannerPolicy |
|
Attributes:
| Name | Type | Description |
|---|---|---|
log |
|
PickAndPlacePlannerPolicy
¶
PickAndPlacePlannerPolicy(config: MlSpacesExpConfig, task: BaseMujocoTask)
Bases: BaseObjectManipulationPlannerPolicy
Methods:
| Name | Description |
|---|---|
add_auxiliary_objects |
Add auxiliary objects to the scene that might be required for the policy. |
check_feasible_ik |
|
create_policy_sensors |
Create a list of policy-specific sensors. |
get_action |
Decide on the action to take based on the current observation of the or environment. |
get_all_phases |
Returns: |
get_info |
Get additional information from the policy. Called after episode ended. This method can be |
get_phase |
Returns: |
reset |
Reset the policy's internal state. |
Attributes:
| Name | Type | Description |
|---|---|---|
action_idx |
|
|
action_primitives |
|
|
config |
|
|
ik_warmed_up |
|
|
planners |
Abstract property representing the list or dict of planner instances. |
|
policy_config |
|
|
retry_count |
int
|
The number of retries the policy has taken. |
robot_view |
|
|
sequential_ik_failures |
|
|
target_poses |
|
|
task |
|
Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
add_auxiliary_objects
staticmethod
¶add_auxiliary_objects(config: MlSpacesExpConfig, spec: MjSpec) -> None
Add auxiliary objects to the scene that might be required for the policy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
MlSpacesExpConfig
|
The configuration for the policy. |
required |
spec
|
MjSpec
|
The experiment configuration. |
required |
Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
check_feasible_ik
¶Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
get_action
¶Decide on the action to take based on the current observation of the or environment. Information could be observations, goals in the case of an rl_agent, or it could be the full environment state in the case of a planner.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
observation
|
The current information about the task or environment. |
required |
Returns:
| Type | Description |
|---|---|
|
The action to take in response to the information. |
Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
get_all_phases
¶Returns:
| Type | Description |
|---|---|
dict[str | int]
|
A dictionary of all possible policy phases |
Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
get_info
¶Get additional information from the policy. Called after episode ended. This method can be overridden by subclasses to provide extra information about the policy's state. Must be json serializable.
Returns:
| Type | Description |
|---|---|
dict
|
A dictionary containing additional information about the policy. |
Source code in molmo_spaces/policy/base_policy.py
get_phase
¶Returns:
| Type | Description |
|---|---|
str
|
The current policy phase |
Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
reset
¶Reset the policy's internal state.
This method should be implemented by each subclass to reset the policy's internal state. It is typically called at the beginning of each episode or task.
Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
pick_planner_policy
¶
Classes:
| Name | Description |
|---|---|
PickPlannerPolicy |
|
Attributes:
| Name | Type | Description |
|---|---|---|
log |
|
PickPlannerPolicy
¶
PickPlannerPolicy(config: MlSpacesExpConfig, task: BaseMujocoTask)
Bases: BaseObjectManipulationPlannerPolicy
Methods:
| Name | Description |
|---|---|
add_auxiliary_objects |
Add auxiliary objects to the scene that might be required for the policy. |
check_feasible_ik |
|
create_policy_sensors |
Create a list of policy-specific sensors. |
get_action |
Decide on the action to take based on the current observation of the or environment. |
get_all_phases |
Returns: |
get_info |
Get additional information from the policy. Called after episode ended. This method can be |
get_phase |
Returns: |
reset |
Reset the policy's internal state. |
Attributes:
| Name | Type | Description |
|---|---|---|
action_idx |
|
|
action_primitives |
|
|
config |
|
|
ik_warmed_up |
|
|
planners |
Abstract property representing the list or dict of planner instances. |
|
policy_config |
|
|
retry_count |
int
|
The number of retries the policy has taken. |
robot_view |
|
|
sequential_ik_failures |
|
|
target_poses |
|
|
task |
|
Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
add_auxiliary_objects
staticmethod
¶add_auxiliary_objects(config: MlSpacesExpConfig, spec: MjSpec) -> None
Add auxiliary objects to the scene that might be required for the policy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
MlSpacesExpConfig
|
The configuration for the policy. |
required |
spec
|
MjSpec
|
The experiment configuration. |
required |
Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
check_feasible_ik
¶Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
get_action
¶Decide on the action to take based on the current observation of the or environment. Information could be observations, goals in the case of an rl_agent, or it could be the full environment state in the case of a planner.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
observation
|
The current information about the task or environment. |
required |
Returns:
| Type | Description |
|---|---|
|
The action to take in response to the information. |
Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
get_all_phases
¶Returns:
| Type | Description |
|---|---|
dict[str | int]
|
A dictionary of all possible policy phases |
Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
get_info
¶Get additional information from the policy. Called after episode ended. This method can be overridden by subclasses to provide extra information about the policy's state. Must be json serializable.
Returns:
| Type | Description |
|---|---|
dict
|
A dictionary containing additional information about the policy. |
Source code in molmo_spaces/policy/base_policy.py
get_phase
¶Returns:
| Type | Description |
|---|---|
str
|
The current policy phase |
Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
reset
¶Reset the policy's internal state.
This method should be implemented by each subclass to reset the policy's internal state. It is typically called at the beginning of each episode or task.
Source code in molmo_spaces/policy/solvers/object_manipulation/base_object_manipulation_planner_policy.py
opening_solver
¶
Classes:
| Name | Description |
|---|---|
DoorOpeningPhase |
Enumeration of door opening phases. |
DoorOpeningPlannerPolicy |
Planner policy for RBY1 door opening tasks using motion planning. |
Attributes:
| Name | Type | Description |
|---|---|---|
log |
|
DoorOpeningPhase
¶
Bases: IntEnum
Enumeration of door opening phases.
Attributes:
| Name | Type | Description |
|---|---|---|
COMPLETE |
|
|
GRASP_HANDLE |
|
|
NAVIGATE_TO_DOOR |
|
|
OPEN_DOOR |
|
|
REACH_GRASP |
|
|
REACH_PRE_GRASP |
|
|
RECOVERY |
|
|
RELEASE_HANDLE |
|
DoorOpeningPlannerPolicy
¶
DoorOpeningPlannerPolicy(config: MlSpacesExpConfig, task: DoorOpeningTask | None = None)
Bases: CuroboPlannerPolicy
Planner policy for RBY1 door opening tasks using motion planning.
Inherits common motion planning functionality from CuroboPlannerPolicy.
Methods:
| Name | Description |
|---|---|
add_auxiliary_objects |
Add auxiliary objects to the scene that might be required for the policy. |
batch_plan_trajectory |
Plan trajectory using batch motion planning. |
clip_to_velocity_constraint |
Clip action to respect velocity constraints. |
create_policy_sensors |
Create a list of policy-specific sensors. |
get_action |
Get the next action based on current task state and phase. |
get_all_phases |
Return a dictionary mapping all phase names to their enum values. |
get_info |
Get additional information from the policy. Called after episode ended. This method can be |
get_look_at_action |
Get action to look at a target. |
get_phase |
Return the current phase name as a string. |
reset |
Reset the policy state. |
select_arm |
Select which arm to use based on distance to pickup object. |
select_arm_for_opening |
Select the arm for opening the door. |
solve_ik |
Solve inverse kinematics for a target pose and create interpolated trajectory. |
visualize_world_config_mesh |
Visualize the world configuration as a mesh file. |
Attributes:
| Name | Type | Description |
|---|---|---|
arm_end_idx |
int
|
|
arm_side |
|
|
arm_start_idx |
int
|
|
articulate_deltas |
|
|
config |
|
|
curr_articulation_step |
|
|
current_gripper_command |
dict[str, float]
|
|
current_phase |
|
|
first_pushing_articulation_deltas |
|
|
grasping_timesteps |
|
|
is_done |
bool
|
Property to expose completion state for task checking. |
joint_position_tolerance |
|
|
left_motion_planner |
|
|
max_steps_per_waypoint |
|
|
num_steps_for_articulation |
|
|
phase_name |
str
|
Property to expose current phase name for task tracking. |
phase_value |
int
|
Property to expose current phase name for task tracking. |
planned_trajectory |
list[list[float]] | None
|
|
planner |
CuroboPlanner | None
|
|
planner_joint_ranges |
dict[str, tuple[int, int]]
|
|
planners |
dict[str, CuroboPlanner]
|
Return dictionary of planner instances. |
planning_failures |
|
|
pre_grasp_distance |
|
|
profiler |
|
|
recovery_step_count |
|
|
retry_count |
int
|
The number of retries the policy has taken. |
right_motion_planner |
|
|
steps_spent_in_waypoint |
int
|
|
task |
|
|
trajectory_index |
int
|
|
Source code in molmo_spaces/policy/solvers/opening_solver.py
first_pushing_articulation_deltas
instance-attribute
¶
left_motion_planner
instance-attribute
¶
right_motion_planner
instance-attribute
¶
add_auxiliary_objects
staticmethod
¶
add_auxiliary_objects(config: MlSpacesExpConfig, spec: MjSpec) -> None
Add auxiliary objects to the scene that might be required for the policy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
MlSpacesExpConfig
|
The configuration for the policy. |
required |
spec
|
MjSpec
|
The experiment configuration. |
required |
Source code in molmo_spaces/policy/base_policy.py
batch_plan_trajectory
¶
Plan trajectory using batch motion planning.
Uses the current phase to determine goal poses and plans trajectories in batches for efficiency. Sets self.planned_trajectory to the best trajectory found.
Source code in molmo_spaces/policy/solvers/curobo_planner_policy.py
499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 | |
clip_to_velocity_constraint
¶
Clip action to respect velocity constraints.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
action
|
dict[str, Any]
|
Dictionary of commanded joint positions by move group. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Clipped action dictionary. |
Source code in molmo_spaces/policy/solvers/curobo_planner_policy.py
create_policy_sensors
¶
create_policy_sensors() -> list[Sensor]
Create a list of policy-specific sensors.
Source code in molmo_spaces/policy/base_policy.py
get_action
¶
Get the next action based on current task state and phase.
Source code in molmo_spaces/policy/solvers/opening_solver.py
get_all_phases
¶
Return a dictionary mapping all phase names to their enum values.
get_info
¶
Get additional information from the policy. Called after episode ended. This method can be overridden by subclasses to provide extra information about the policy's state. Must be json serializable.
Returns:
| Type | Description |
|---|---|
dict
|
A dictionary containing additional information about the policy. |
Source code in molmo_spaces/policy/base_policy.py
get_look_at_action
¶
Get action to look at a target.
Subclasses can override this to implement head tracking.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dictionary with head control commands, or empty dict. |
get_phase
¶
reset
¶
Reset the policy state.
Source code in molmo_spaces/policy/solvers/opening_solver.py
select_arm
¶
Select which arm to use based on distance to pickup object.
Also instantiates the motion planner for the selected arm. This lazy initialization saves ~11GB of GPU memory by only loading one arm's planner.
Source code in molmo_spaces/policy/solvers/curobo_planner_policy.py
select_arm_for_opening
¶
Select the arm for opening the door.
Also sets self.arm_side and self.planner_joint_ranges for compatibility with base class methods.
Source code in molmo_spaces/policy/solvers/opening_solver.py
solve_ik
¶
Solve inverse kinematics for a target pose and create interpolated trajectory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target_pose
|
ndarray
|
4x4 transformation matrix for target end-effector pose in world frame. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If IK solution cannot be found. |
Source code in molmo_spaces/policy/solvers/curobo_planner_policy.py
visualize_world_config_mesh
¶
Visualize the world configuration as a mesh file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
world_cfg
|
WorldConfig
|
Curobo WorldConfig to visualize. |
required |
Source code in molmo_spaces/policy/solvers/curobo_planner_policy.py
619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 | |