controllers¶
controllers
¶
Modules:
| Name | Description |
|---|---|
abstract |
|
base_pose |
|
joint_pos |
|
joint_rel_pos |
|
joint_vel |
|
torso_height |
|
abstract
¶
Classes:
| Name | Description |
|---|---|
AbstractPositionController |
Base class for (absolute or relative) position controllers. |
Controller |
Implementation of a simple, non-blocking controller for the MolmoSpaces environments. |
AbstractPositionController
¶
AbstractPositionController(robot_move_group: MoveGroup)
Bases: Controller
Base class for (absolute or relative) position controllers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
robot_move_group
|
MoveGroup
|
The move group of the robot to be controlled |
required |
Methods:
| Name | Description |
|---|---|
compute_ctrl_inputs |
Compute the control inputs based on the current state and the target set by the user. |
reset |
Reset the controller to its initial state, clearing any internal state or targets. |
set_target |
Set the target state of the controller. |
set_to_stationary |
This method sets the robot to stationary mode and computes the targets to hold the |
Attributes:
| Name | Type | Description |
|---|---|---|
robot_move_group |
|
|
stationary |
Whether the controller is set to hold the robot stationary, for e.g. |
|
target |
The target state of the controller, set by the user of the controller. |
|
target_pos |
ndarray
|
The target absolute position of the controller, set by the user of the controller. |
Source code in molmo_spaces/controllers/abstract.py
stationary
abstractmethod
property
¶
Whether the controller is set to hold the robot stationary, for e.g. when the robot has to be stopped at a certain position and not drift.
target
abstractmethod
property
¶
The target state of the controller, set by the user of the controller.
target_pos
abstractmethod
property
¶
The target absolute position of the controller, set by the user of the controller.
compute_ctrl_inputs
abstractmethod
¶
Compute the control inputs based on the current state and the target set by the user. Returns: The control inputs to be applied to the robot actuators, eg. positions, torques etc.
Source code in molmo_spaces/controllers/abstract.py
reset
abstractmethod
¶
set_target
abstractmethod
¶
Set the target state of the controller. Args: target: The target state to be set, e.g. a joint position, base velocity, or any other state.
set_to_stationary
¶
This method sets the robot to stationary mode and computes the targets to hold the robot stationary. This is useful when the robot needs to be stopped at a certain position and not drift. NOTE: If the controller is already stationary, it does not change the target.
Source code in molmo_spaces/controllers/abstract.py
Controller
¶
Controller(robot_move_group: MoveGroup)
Implementation of a simple, non-blocking controller for the MolmoSpaces environments. This controller is meant to be simple, provide a control law based on stateful targets set by the user, and return the control inputs needed to achieve those targets.
The controller DOES NOT step the simulation, it only computes the control inputs based on the current state and the targets set by the user.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
robot_move_group
|
MoveGroup
|
The move group of the robot to be controlled |
required |
Methods:
| Name | Description |
|---|---|
compute_ctrl_inputs |
Compute the control inputs based on the current state and the target set by the user. |
reset |
Reset the controller to its initial state, clearing any internal state or targets. |
set_target |
Set the target state of the controller. |
set_to_stationary |
This method sets the robot to stationary mode and computes the targets to hold the |
Attributes:
| Name | Type | Description |
|---|---|---|
robot_move_group |
|
|
stationary |
Whether the controller is set to hold the robot stationary, for e.g. |
|
target |
The target state of the controller, set by the user of the controller. |
Source code in molmo_spaces/controllers/abstract.py
stationary
abstractmethod
property
¶
Whether the controller is set to hold the robot stationary, for e.g. when the robot has to be stopped at a certain position and not drift.
target
abstractmethod
property
¶
The target state of the controller, set by the user of the controller.
compute_ctrl_inputs
abstractmethod
¶
Compute the control inputs based on the current state and the target set by the user. Returns: The control inputs to be applied to the robot actuators, eg. positions, torques etc.
Source code in molmo_spaces/controllers/abstract.py
reset
abstractmethod
¶
set_target
abstractmethod
¶
Set the target state of the controller. Args: target: The target state to be set, e.g. a joint position, base velocity, or any other state.
set_to_stationary
¶
This method sets the robot to stationary mode and computes the targets to hold the robot stationary. This is useful when the robot needs to be stopped at a certain position and not drift. NOTE: If the controller is already stationary, it does not change the target.
Source code in molmo_spaces/controllers/abstract.py
base_pose
¶
Classes:
| Name | Description |
|---|---|
BasePoseController |
Abstract pose controller class for a simple 2D pose controller for a robot base. |
DiffDriveBasePoseController |
|
SwerveBasePoseController |
|
BasePoseController
¶
BasePoseController(robot_move_group: RobotBaseGroup)
Bases: Controller, ABC
Abstract pose controller class for a simple 2D pose controller for a robot base. Computes velocities for the robot base's actuators based on target pose, and clips to control limits. NOTE: Assumes base actuators (eg. wheels) use velocity inputs.
This class cannot be instantiated directly and must be subclassed with an implementation of the "compute_base_velocities" method.
Methods:
| Name | Description |
|---|---|
compute_base_velocities |
Abstract method to compute base velocities to achieve the target pose. |
compute_ctrl_inputs |
Compute the control inputs based on the current state and the target set by the user. |
reset |
Reset the controller to its initial state, clearing any internal state or targets |
set_target |
Set the target pose for the controller |
set_to_stationary |
This method sets the robot to stationary mode and computes the targets to hold the |
Attributes:
| Name | Type | Description |
|---|---|---|
ctrl_dim |
|
|
ctrl_range |
|
|
robot_move_group |
|
|
stationary |
Whether the controller is in stationary mode |
|
target |
The target pose for the controller |
Source code in molmo_spaces/controllers/base_pose.py
compute_base_velocities
abstractmethod
¶
Abstract method to compute base velocities to achieve the target pose. Must be implemented by subclasses. Methods could include: Differential-drive, Ackermann steering, Omni-wheel control etc.
Source code in molmo_spaces/controllers/base_pose.py
compute_ctrl_inputs
¶
Compute the control inputs based on the current state and the target set by the user. Returns: The control inputs to be applied to the robot actuators, in this case: positions
Source code in molmo_spaces/controllers/base_pose.py
reset
¶
Reset the controller to its initial state, clearing any internal state or targets
set_target
¶
Set the target pose for the controller
set_to_stationary
¶
This method sets the robot to stationary mode and computes the targets to hold the robot stationary. This is useful when the robot needs to be stopped at a certain position and not drift.
Source code in molmo_spaces/controllers/base_pose.py
DiffDriveBasePoseController
¶
DiffDriveBasePoseController(robot_config, robot_move_group: RobotBaseGroup)
Bases: BasePoseController
Differential drive base pose controller. Args: robot_config: The configuration of the robot, containing special information about the control robot_move_group: The move group of the robot base to be controlled
Methods:
| Name | Description |
|---|---|
compute_base_velocities |
Compute wheel velocities to drive the robot base to the target pose using a simple proportional controller. |
compute_ctrl_inputs |
Compute the control inputs based on the current state and the target set by the user. |
reset |
Reset the controller to its initial state, clearing any internal state or targets |
set_target |
Set the target pose for the controller |
set_to_stationary |
This method sets the robot to stationary mode and computes the targets to hold the |
Attributes:
| Name | Type | Description |
|---|---|---|
ctrl_dim |
|
|
ctrl_range |
|
|
robot_config |
|
|
robot_move_group |
|
|
stationary |
Whether the controller is in stationary mode |
|
target |
The target pose for the controller |
|
wheel_base |
|
|
wheel_radius |
|
Source code in molmo_spaces/controllers/base_pose.py
compute_base_velocities
¶
Compute wheel velocities to drive the robot base to the target pose using a simple proportional controller. Args: target_base_pose: Target [x, y, theta] pose in world frame. Returns: np.ndarray: [left_wheel_velocity, right_wheel_velocity]
Source code in molmo_spaces/controllers/base_pose.py
compute_ctrl_inputs
¶
Compute the control inputs based on the current state and the target set by the user. Returns: The control inputs to be applied to the robot actuators, in this case: positions
Source code in molmo_spaces/controllers/base_pose.py
reset
¶
Reset the controller to its initial state, clearing any internal state or targets
set_target
¶
Set the target pose for the controller
set_to_stationary
¶
This method sets the robot to stationary mode and computes the targets to hold the robot stationary. This is useful when the robot needs to be stopped at a certain position and not drift.
Source code in molmo_spaces/controllers/base_pose.py
SwerveBasePoseController
¶
SwerveBasePoseController(robot_config, robot_move_group: RobotBaseGroup)
Bases: BasePoseController
Swerve drive base pose controller. Args: robot_config: The configuration of the robot, containing special information about the control robot_move_group: The move group of the robot base to be controlled
Methods:
| Name | Description |
|---|---|
compute_base_velocities |
Compute wheel velocities and steer angles to drive the robot base to the target pose using a simple proportional controller. |
compute_ctrl_inputs |
Compute the control inputs based on the current state and the target set by the user. |
reset |
Reset the controller to its initial state, clearing any internal state or targets |
set_target |
Set the target pose for the controller |
set_to_stationary |
This method sets the robot to stationary mode and computes the targets to hold the |
Attributes:
| Name | Type | Description |
|---|---|---|
ctrl_dim |
|
|
ctrl_range |
|
|
current_steer_angles |
|
|
max_wheel_speed |
|
|
robot_config |
|
|
robot_move_group |
|
|
stationary |
Whether the controller is in stationary mode |
|
steer_angle_range |
|
|
steer_track |
|
|
target |
The target pose for the controller |
|
wheel_base |
|
|
wheel_radius |
|
Source code in molmo_spaces/controllers/base_pose.py
compute_base_velocities
¶
Compute wheel velocities and steer angles to drive the robot base to the target pose using a simple proportional controller. Args: target_base_pose: Target [x, y, theta] pose in world frame. Returns: np.ndarray: [front_left_steer_angle, front_right_steer_angle, back_left_steer_angle, back_right_steer_angle, front_left_wheel_velocity, front_right_wheel_velocity, back_left_wheel_velocity, back_right_wheel_velocity]
Assert local frame defination:
↑ x
|
fl | fr
o------|------o
| | |
| | |
| | |
| | |
y <----------o |
| |
| |
| |
| |
o-------------o
rl rr
Source code in molmo_spaces/controllers/base_pose.py
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 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | |
compute_ctrl_inputs
¶
Compute the control inputs based on the current state and the target set by the user. Returns: The control inputs to be applied to the robot actuators, in this case: positions
Source code in molmo_spaces/controllers/base_pose.py
reset
¶
Reset the controller to its initial state, clearing any internal state or targets
set_target
¶
Set the target pose for the controller
set_to_stationary
¶
This method sets the robot to stationary mode and computes the targets to hold the robot stationary. This is useful when the robot needs to be stopped at a certain position and not drift.
Source code in molmo_spaces/controllers/base_pose.py
joint_pos
¶
Classes:
| Name | Description |
|---|---|
JointPosController |
Generic joint position controller for a robot. |
JointPosController
¶
JointPosController(robot_move_group: MoveGroup)
Bases: AbstractPositionController
Generic joint position controller for a robot. Computes joint position targets for the joint's actuators, and clips to control limits. NOTE: Assumes joint actuators use position inputs.
Methods:
| Name | Description |
|---|---|
compute_ctrl_inputs |
Compute the control inputs based on the current state and the target set by the user. |
reset |
Reset the controller to its initial state, clearing any internal state or targets |
set_target |
Set the target joint positions for the controller |
set_to_stationary |
This method sets the robot to stationary mode and computes the targets to hold the |
Attributes:
| Name | Type | Description |
|---|---|---|
ctrl_dim |
|
|
ctrl_range |
|
|
robot_move_group |
|
|
stationary |
Returns whether the controller is in stationary mode |
|
target |
|
|
target_pos |
ndarray
|
|
Source code in molmo_spaces/controllers/joint_pos.py
compute_ctrl_inputs
¶
Compute the control inputs based on the current state and the target set by the user. Returns: The control inputs to be applied to the robot actuators, in this case: positions
Source code in molmo_spaces/controllers/joint_pos.py
reset
¶
Reset the controller to its initial state, clearing any internal state or targets
set_target
¶
Set the target joint positions for the controller
Source code in molmo_spaces/controllers/joint_pos.py
set_to_stationary
¶
This method sets the robot to stationary mode and computes the targets to hold the robot stationary. This is useful when the robot needs to be stopped at a certain position and not drift.
Source code in molmo_spaces/controllers/joint_pos.py
joint_rel_pos
¶
Classes:
| Name | Description |
|---|---|
JointRelPosController |
Generic joint position controller for a robot. |
JointRelPosController
¶
JointRelPosController(robot_move_group: MoveGroup)
Bases: AbstractPositionController
Generic joint position controller for a robot. Computes delta joint position targets for the joint's actuators, and clips to control limits.
Methods:
| Name | Description |
|---|---|
compute_ctrl_inputs |
Compute the control inputs based on the current state and the target set by the user. |
reset |
Reset the controller to its initial state, clearing any internal state or targets |
set_target |
Set the target joint positions for the controller. |
set_to_stationary |
This method sets the robot to stationary mode and computes the targets to hold the |
Attributes:
| Name | Type | Description |
|---|---|---|
ctrl_dim |
|
|
ctrl_range |
|
|
desired_joint_positions |
|
|
robot_move_group |
|
|
stationary |
Returns whether the controller is in stationary mode |
|
target |
|
|
target_pos |
ndarray
|
|
Source code in molmo_spaces/controllers/joint_rel_pos.py
compute_ctrl_inputs
¶
Compute the control inputs based on the current state and the target set by the user. Returns: The control inputs to be applied to the robot actuators, in this case: positions
Source code in molmo_spaces/controllers/joint_rel_pos.py
reset
¶
Reset the controller to its initial state, clearing any internal state or targets
set_target
¶
Set the target joint positions for the controller. NOTE: For this controller we assume that the controller will be set to stationary every time before the relative target has to be computed
Source code in molmo_spaces/controllers/joint_rel_pos.py
set_to_stationary
¶
This method sets the robot to stationary mode and computes the targets to hold the robot stationary. This is useful when the robot needs to be stopped at a certain position and not drift.
Source code in molmo_spaces/controllers/joint_rel_pos.py
joint_vel
¶
Classes:
| Name | Description |
|---|---|
JointVelController |
Generic joint velocity controller for a robot. |
JointVelController
¶
JointVelController(robot_config, robot_move_group: MoveGroup)
Bases: Controller
Generic joint velocity controller for a robot. Computes joint position targets for the joint's actuators after euler integration, and clips to control limits. NOTE: Assumes joint actuators use position inputs.
robot_config: The configuration of the robot, containing special information about the control, e.g., delta_t for integration (if applicable) etc. robot_move_group: The move group of the robot to be controlled
Methods:
| Name | Description |
|---|---|
compute_ctrl_inputs |
Compute the control inputs based on the current state and the target set by the user. |
reset |
Reset the controller to its initial state, clearing any internal state or targets |
set_target |
Set the target joint velocities for the controller |
set_to_stationary |
This method sets the robot to stationary mode and computes the targets to hold the |
Attributes:
| Name | Type | Description |
|---|---|---|
ctrl_dim |
|
|
ctrl_range |
|
|
euler_dt |
|
|
robot_config |
|
|
robot_move_group |
|
|
stationary |
Returns whether the controller is in stationary mode |
|
target |
Returns the current target joint velocities |
Source code in molmo_spaces/controllers/joint_vel.py
compute_ctrl_inputs
¶
Compute the control inputs based on the current state and the target set by the user. Returns: The control inputs to be applied to the robot actuators, in this case: positions
Source code in molmo_spaces/controllers/joint_vel.py
reset
¶
Reset the controller to its initial state, clearing any internal state or targets
set_target
¶
Set the target joint velocities for the controller
set_to_stationary
¶
This method sets the robot to stationary mode and computes the targets to hold the robot stationary. This is useful when the robot needs to be stopped at a certain position and not drift.
Source code in molmo_spaces/controllers/joint_vel.py
torso_height
¶
Classes:
| Name | Description |
|---|---|
TorsoHeightJointPosController |
Controls the RBY1 torso via a single height scalar. |
TorsoHeightJointPosController
¶
TorsoHeightJointPosController(robot_move_group: MoveGroup, max_height: float = 0.738)
Bases: AbstractPositionController
Controls the RBY1 torso via a single height scalar.
Accepts a 1-element command [h]; compute_ctrl_inputs() returns the
full 6-DOF joint position array produced by the constraint
torso_1 = torso_3 = h, torso_2 = -2*h.
Methods:
| Name | Description |
|---|---|
compute_ctrl_inputs |
Return the 6-DOF torso joint positions for the current target height. |
height_to_joints |
Return the 6-DOF torso joint positions for a given height scalar. |
hold_at_height |
Set the controller to hold at a specific height without reading current joints. |
joints_to_height |
Recover the height scalar from a 6-DOF torso joint position array. |
reset |
|
set_target |
|
set_to_stationary |
|
Attributes:
| Name | Type | Description |
|---|---|---|
max_height |
|
|
robot_move_group |
|
|
stationary |
bool
|
|
target |
ndarray
|
|
target_pos |
ndarray
|
|
Source code in molmo_spaces/controllers/torso_height.py
compute_ctrl_inputs
¶
Return the 6-DOF torso joint positions for the current target height.
height_to_joints
staticmethod
¶
Return the 6-DOF torso joint positions for a given height scalar.
torso[1] = height, torso[2] = -2*height, torso[3] = height. Indices 0, 4, 5 are left at zero.
Source code in molmo_spaces/controllers/torso_height.py
hold_at_height
¶
Set the controller to hold at a specific height without reading current joints.
Use this to lock the torso at a desired target after a height adjustment is complete, so that subsequent steps without an explicit torso command will maintain this height rather than drifting to the current joint position.