kinematics¶
kinematics
¶
Modules:
| Name | Description |
|---|---|
bimanual_yam_kinematics |
Kinematics solver for the bimanual YAM robot. |
floating_rum_kinematics |
|
franka_kinematics |
|
i2rt_yam_kinematics |
Kinematics solver for the i2rt YAM robot. |
mujoco_kinematics |
This module provides forward and inverse kinematics functionality for robots in MuJoCo. |
rby1_kinematics |
|
stretch_kinematics |
|
bimanual_yam_kinematics
¶
Kinematics solver for the bimanual YAM robot.
Classes:
| Name | Description |
|---|---|
BimanualYamKinematics |
Kinematics solver for the bimanual YAM robot (two 6-DOF arms). |
Functions:
| Name | Description |
|---|---|
main |
|
BimanualYamKinematics
¶
BimanualYamKinematics(model: MjModel, data: MjData | None = None, namespace: str = '', robot_view_factory: RobotViewFactory = BimanualYamRobotView)
Bases: MlSpacesKinematics
Kinematics solver for the bimanual YAM robot (two 6-DOF arms).
Methods:
| Name | Description |
|---|---|
fk |
Compute forward kinematics for all move groups. |
ik |
Solve inverse kinematics to reach a target pose. |
twist_to_joint_vel |
Convert an end-effector twist to joint velocities. |
Source code in molmo_spaces/kinematics/bimanual_yam_kinematics.py
fk
¶
fk(move_group_qpos: dict[str, ndarray], base_pose: ndarray, rel_to_base: bool = False) -> dict[str, ndarray]
Compute forward kinematics for all move groups.
This method computes the pose of each move group's leaf frame given the joint positions. The poses can be returned either relative to the world frame or relative to the robot base.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
move_group_qpos
|
dict[str, ndarray]
|
Dictionary mapping move group IDs to their joint positions |
required |
base_pose
|
ndarray
|
4x4 pose matrix of the robot base. |
required |
rel_to_base
|
bool
|
If True, return poses relative to robot base. If False, return poses in world frame. |
False
|
Returns:
| Type | Description |
|---|---|
dict[str, ndarray]
|
Dictionary mapping move group IDs to their 4x4 pose matrices |
Source code in molmo_spaces/kinematics/mujoco_kinematics.py
ik
¶
ik(move_group_id: str, pose: ndarray, unlocked_move_group_ids: list[str], q0: dict[str, ndarray], base_pose: ndarray, rel_to_base: bool = False, eps: float = 0.0001, max_iter: int = 1000, damping: float = 1e-12, dt: float = 1.0)
Solve inverse kinematics to reach a target pose.
This method iteratively solves for joint positions that would place the end-effector at the target pose. It uses a damped least squares approach with velocity-based updates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
move_group_id
|
str
|
ID of the move group whose end-effector pose is specified |
required |
pose
|
ndarray
|
4x4 target pose matrix |
required |
unlocked_move_group_ids
|
list[str]
|
List of move group IDs whose joints can move |
required |
q0
|
dict[str, ndarray]
|
Dictionary mapping move group IDs to their initial joint positions |
required |
base_pose
|
ndarray
|
4x4 pose matrix of the robot base. |
required |
rel_to_base
|
bool
|
If True, target pose is relative to robot base. If False, pose is in world frame. |
False
|
eps
|
float
|
Convergence threshold for the error norm |
0.0001
|
max_iter
|
int
|
Maximum number of iterations |
1000
|
damping
|
float
|
Damping factor for the damped least squares solution |
1e-12
|
dt
|
float
|
Time step for velocity integration |
1.0
|
Returns:
| Type | Description |
|---|---|
|
Dictionary mapping move group IDs to their joint positions if successful, None if failed |
Raises:
| Type | Description |
|---|---|
ValueError
|
If q0 keys don't match move group IDs |
Source code in molmo_spaces/kinematics/mujoco_kinematics.py
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 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 | |
twist_to_joint_vel
¶
twist_to_joint_vel(move_group_id: str, twist: ndarray, unlocked_move_group_ids: list[str], q0: dict[str, ndarray], base_pose: ndarray, twist_frame: Literal['world', 'base', 'leaf'] = 'world', damping: float = 1e-12)
Convert an end-effector twist to joint velocities.
This method computes the joint velocities that would result in the specified end-effector twist. It uses damped least squares to handle singularities.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
move_group_id
|
str
|
ID of the move group whose end-effector twist is specified |
required |
twist
|
ndarray
|
6D twist vector (linear and angular velocities) |
required |
unlocked_move_group_ids
|
list[str]
|
List of move group IDs whose joints can move |
required |
q0
|
dict[str, ndarray]
|
Dictionary mapping move group IDs to their current joint positions |
required |
base_pose
|
ndarray
|
4x4 pose matrix of the robot base. |
required |
twist_frame
|
Literal['world', 'base', 'leaf']
|
Frame of the twist, either in the world frame, the robot base frame, or the leaf frame of the move group. |
'world'
|
damping
|
float
|
Damping factor for the damped least squares solution |
1e-12
|
Returns:
| Type | Description |
|---|---|
|
Array of joint velocities that would achieve the desired twist |
Raises:
| Type | Description |
|---|---|
ValueError
|
If q0 keys don't match move group IDs |
Source code in molmo_spaces/kinematics/mujoco_kinematics.py
main
¶
Source code in molmo_spaces/kinematics/bimanual_yam_kinematics.py
floating_rum_kinematics
¶
Classes:
| Name | Description |
|---|---|
FloatingRUMKinematics |
|
Functions:
| Name | Description |
|---|---|
main |
|
FloatingRUMKinematics
¶
FloatingRUMKinematics(model: MjModel, data: MjData | None = None, namespace: str = '', robot_view_factory: RobotViewFactory = FloatingRUMRobotView)
Bases: MlSpacesKinematics
Methods:
| Name | Description |
|---|---|
fk |
Compute forward kinematics for all move groups. |
ik |
|
twist_to_joint_vel |
Convert an end-effector twist to joint velocities. |
Source code in molmo_spaces/kinematics/floating_rum_kinematics.py
fk
¶
fk(move_group_qpos: dict[str, ndarray], base_pose: ndarray, rel_to_base: bool = False) -> dict[str, ndarray]
Compute forward kinematics for all move groups.
This method computes the pose of each move group's leaf frame given the joint positions. The poses can be returned either relative to the world frame or relative to the robot base.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
move_group_qpos
|
dict[str, ndarray]
|
Dictionary mapping move group IDs to their joint positions |
required |
base_pose
|
ndarray
|
4x4 pose matrix of the robot base. |
required |
rel_to_base
|
bool
|
If True, return poses relative to robot base. If False, return poses in world frame. |
False
|
Returns:
| Type | Description |
|---|---|
dict[str, ndarray]
|
Dictionary mapping move group IDs to their 4x4 pose matrices |
Source code in molmo_spaces/kinematics/mujoco_kinematics.py
ik
¶
ik(move_group_id: str, pose: ndarray, unlocked_move_group_ids: list[str], q0: dict[str, ndarray], base_pose: ndarray, rel_to_base: bool = False, eps: float = 0.0001, max_iter: int = 1000, damping: float = 1e-12, dt: float = 1.0)
Source code in molmo_spaces/kinematics/floating_rum_kinematics.py
twist_to_joint_vel
¶
twist_to_joint_vel(move_group_id: str, twist: ndarray, unlocked_move_group_ids: list[str], q0: dict[str, ndarray], base_pose: ndarray, twist_frame: Literal['world', 'base', 'leaf'] = 'world', damping: float = 1e-12)
Convert an end-effector twist to joint velocities.
This method computes the joint velocities that would result in the specified end-effector twist. It uses damped least squares to handle singularities.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
move_group_id
|
str
|
ID of the move group whose end-effector twist is specified |
required |
twist
|
ndarray
|
6D twist vector (linear and angular velocities) |
required |
unlocked_move_group_ids
|
list[str]
|
List of move group IDs whose joints can move |
required |
q0
|
dict[str, ndarray]
|
Dictionary mapping move group IDs to their current joint positions |
required |
base_pose
|
ndarray
|
4x4 pose matrix of the robot base. |
required |
twist_frame
|
Literal['world', 'base', 'leaf']
|
Frame of the twist, either in the world frame, the robot base frame, or the leaf frame of the move group. |
'world'
|
damping
|
float
|
Damping factor for the damped least squares solution |
1e-12
|
Returns:
| Type | Description |
|---|---|
|
Array of joint velocities that would achieve the desired twist |
Raises:
| Type | Description |
|---|---|
ValueError
|
If q0 keys don't match move group IDs |
Source code in molmo_spaces/kinematics/mujoco_kinematics.py
main
¶
Source code in molmo_spaces/kinematics/floating_rum_kinematics.py
franka_kinematics
¶
Classes:
| Name | Description |
|---|---|
FrankaKinematics |
|
Functions:
| Name | Description |
|---|---|
main |
|
FrankaKinematics
¶
FrankaKinematics(model: MjModel, data: MjData | None = None, namespace: str = '', robot_view_factory: RobotViewFactory = FrankaFR3RobotView)
Bases: MlSpacesKinematics
Methods:
| Name | Description |
|---|---|
fk |
Compute forward kinematics for all move groups. |
ik |
Solve inverse kinematics to reach a target pose. |
twist_to_joint_vel |
Convert an end-effector twist to joint velocities. |
Source code in molmo_spaces/kinematics/franka_kinematics.py
fk
¶
fk(move_group_qpos: dict[str, ndarray], base_pose: ndarray, rel_to_base: bool = False) -> dict[str, ndarray]
Compute forward kinematics for all move groups.
This method computes the pose of each move group's leaf frame given the joint positions. The poses can be returned either relative to the world frame or relative to the robot base.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
move_group_qpos
|
dict[str, ndarray]
|
Dictionary mapping move group IDs to their joint positions |
required |
base_pose
|
ndarray
|
4x4 pose matrix of the robot base. |
required |
rel_to_base
|
bool
|
If True, return poses relative to robot base. If False, return poses in world frame. |
False
|
Returns:
| Type | Description |
|---|---|
dict[str, ndarray]
|
Dictionary mapping move group IDs to their 4x4 pose matrices |
Source code in molmo_spaces/kinematics/mujoco_kinematics.py
ik
¶
ik(move_group_id: str, pose: ndarray, unlocked_move_group_ids: list[str], q0: dict[str, ndarray], base_pose: ndarray, rel_to_base: bool = False, eps: float = 0.0001, max_iter: int = 1000, damping: float = 1e-12, dt: float = 1.0)
Solve inverse kinematics to reach a target pose.
This method iteratively solves for joint positions that would place the end-effector at the target pose. It uses a damped least squares approach with velocity-based updates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
move_group_id
|
str
|
ID of the move group whose end-effector pose is specified |
required |
pose
|
ndarray
|
4x4 target pose matrix |
required |
unlocked_move_group_ids
|
list[str]
|
List of move group IDs whose joints can move |
required |
q0
|
dict[str, ndarray]
|
Dictionary mapping move group IDs to their initial joint positions |
required |
base_pose
|
ndarray
|
4x4 pose matrix of the robot base. |
required |
rel_to_base
|
bool
|
If True, target pose is relative to robot base. If False, pose is in world frame. |
False
|
eps
|
float
|
Convergence threshold for the error norm |
0.0001
|
max_iter
|
int
|
Maximum number of iterations |
1000
|
damping
|
float
|
Damping factor for the damped least squares solution |
1e-12
|
dt
|
float
|
Time step for velocity integration |
1.0
|
Returns:
| Type | Description |
|---|---|
|
Dictionary mapping move group IDs to their joint positions if successful, None if failed |
Raises:
| Type | Description |
|---|---|
ValueError
|
If q0 keys don't match move group IDs |
Source code in molmo_spaces/kinematics/mujoco_kinematics.py
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 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 | |
twist_to_joint_vel
¶
twist_to_joint_vel(move_group_id: str, twist: ndarray, unlocked_move_group_ids: list[str], q0: dict[str, ndarray], base_pose: ndarray, twist_frame: Literal['world', 'base', 'leaf'] = 'world', damping: float = 1e-12)
Convert an end-effector twist to joint velocities.
This method computes the joint velocities that would result in the specified end-effector twist. It uses damped least squares to handle singularities.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
move_group_id
|
str
|
ID of the move group whose end-effector twist is specified |
required |
twist
|
ndarray
|
6D twist vector (linear and angular velocities) |
required |
unlocked_move_group_ids
|
list[str]
|
List of move group IDs whose joints can move |
required |
q0
|
dict[str, ndarray]
|
Dictionary mapping move group IDs to their current joint positions |
required |
base_pose
|
ndarray
|
4x4 pose matrix of the robot base. |
required |
twist_frame
|
Literal['world', 'base', 'leaf']
|
Frame of the twist, either in the world frame, the robot base frame, or the leaf frame of the move group. |
'world'
|
damping
|
float
|
Damping factor for the damped least squares solution |
1e-12
|
Returns:
| Type | Description |
|---|---|
|
Array of joint velocities that would achieve the desired twist |
Raises:
| Type | Description |
|---|---|
ValueError
|
If q0 keys don't match move group IDs |
Source code in molmo_spaces/kinematics/mujoco_kinematics.py
main
¶
Source code in molmo_spaces/kinematics/franka_kinematics.py
i2rt_yam_kinematics
¶
Kinematics solver for the i2rt YAM robot.
Classes:
| Name | Description |
|---|---|
I2rtYamKinematics |
Kinematics solver for the i2rt YAM 6-DOF arm. |
Functions:
| Name | Description |
|---|---|
main |
|
I2rtYamKinematics
¶
I2rtYamKinematics(model: MjModel, data: MjData | None = None, namespace: str = '', robot_view_factory: RobotViewFactory = I2rtYamRobotView)
Bases: MlSpacesKinematics
Kinematics solver for the i2rt YAM 6-DOF arm.
Methods:
| Name | Description |
|---|---|
fk |
Compute forward kinematics for all move groups. |
ik |
Solve inverse kinematics to reach a target pose. |
twist_to_joint_vel |
Convert an end-effector twist to joint velocities. |
Source code in molmo_spaces/kinematics/i2rt_yam_kinematics.py
fk
¶
fk(move_group_qpos: dict[str, ndarray], base_pose: ndarray, rel_to_base: bool = False) -> dict[str, ndarray]
Compute forward kinematics for all move groups.
This method computes the pose of each move group's leaf frame given the joint positions. The poses can be returned either relative to the world frame or relative to the robot base.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
move_group_qpos
|
dict[str, ndarray]
|
Dictionary mapping move group IDs to their joint positions |
required |
base_pose
|
ndarray
|
4x4 pose matrix of the robot base. |
required |
rel_to_base
|
bool
|
If True, return poses relative to robot base. If False, return poses in world frame. |
False
|
Returns:
| Type | Description |
|---|---|
dict[str, ndarray]
|
Dictionary mapping move group IDs to their 4x4 pose matrices |
Source code in molmo_spaces/kinematics/mujoco_kinematics.py
ik
¶
ik(move_group_id: str, pose: ndarray, unlocked_move_group_ids: list[str], q0: dict[str, ndarray], base_pose: ndarray, rel_to_base: bool = False, eps: float = 0.0001, max_iter: int = 1000, damping: float = 1e-12, dt: float = 1.0)
Solve inverse kinematics to reach a target pose.
This method iteratively solves for joint positions that would place the end-effector at the target pose. It uses a damped least squares approach with velocity-based updates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
move_group_id
|
str
|
ID of the move group whose end-effector pose is specified |
required |
pose
|
ndarray
|
4x4 target pose matrix |
required |
unlocked_move_group_ids
|
list[str]
|
List of move group IDs whose joints can move |
required |
q0
|
dict[str, ndarray]
|
Dictionary mapping move group IDs to their initial joint positions |
required |
base_pose
|
ndarray
|
4x4 pose matrix of the robot base. |
required |
rel_to_base
|
bool
|
If True, target pose is relative to robot base. If False, pose is in world frame. |
False
|
eps
|
float
|
Convergence threshold for the error norm |
0.0001
|
max_iter
|
int
|
Maximum number of iterations |
1000
|
damping
|
float
|
Damping factor for the damped least squares solution |
1e-12
|
dt
|
float
|
Time step for velocity integration |
1.0
|
Returns:
| Type | Description |
|---|---|
|
Dictionary mapping move group IDs to their joint positions if successful, None if failed |
Raises:
| Type | Description |
|---|---|
ValueError
|
If q0 keys don't match move group IDs |
Source code in molmo_spaces/kinematics/mujoco_kinematics.py
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 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 | |
twist_to_joint_vel
¶
twist_to_joint_vel(move_group_id: str, twist: ndarray, unlocked_move_group_ids: list[str], q0: dict[str, ndarray], base_pose: ndarray, twist_frame: Literal['world', 'base', 'leaf'] = 'world', damping: float = 1e-12)
Convert an end-effector twist to joint velocities.
This method computes the joint velocities that would result in the specified end-effector twist. It uses damped least squares to handle singularities.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
move_group_id
|
str
|
ID of the move group whose end-effector twist is specified |
required |
twist
|
ndarray
|
6D twist vector (linear and angular velocities) |
required |
unlocked_move_group_ids
|
list[str]
|
List of move group IDs whose joints can move |
required |
q0
|
dict[str, ndarray]
|
Dictionary mapping move group IDs to their current joint positions |
required |
base_pose
|
ndarray
|
4x4 pose matrix of the robot base. |
required |
twist_frame
|
Literal['world', 'base', 'leaf']
|
Frame of the twist, either in the world frame, the robot base frame, or the leaf frame of the move group. |
'world'
|
damping
|
float
|
Damping factor for the damped least squares solution |
1e-12
|
Returns:
| Type | Description |
|---|---|
|
Array of joint velocities that would achieve the desired twist |
Raises:
| Type | Description |
|---|---|
ValueError
|
If q0 keys don't match move group IDs |
Source code in molmo_spaces/kinematics/mujoco_kinematics.py
main
¶
Source code in molmo_spaces/kinematics/i2rt_yam_kinematics.py
mujoco_kinematics
¶
This module provides forward and inverse kinematics functionality for robots in MuJoCo. It implements both forward kinematics (FK) and inverse kinematics (IK) solvers, as well as methods for converting between joint velocities and end-effector twists.
The main class, MujocoKinematics, provides a general-purpose interface for computing kinematic quantities for any robot that can be represented in MuJoCo. It works with the RobotView abstraction to handle different types of robots and their move groups.
Classes:
| Name | Description |
|---|---|
MlSpacesKinematics |
A general-purpose kinematics solver for robots in MuJoCo. |
MlSpacesKinematics
¶
MlSpacesKinematics(data: MjData, robot_view: RobotView)
A general-purpose kinematics solver for robots in MuJoCo.
This class provides methods for computing forward kinematics (FK), inverse kinematics (IK), and converting between joint velocities and end-effector twists. It works with any robot that can be represented in MuJoCo through the RobotView abstraction.
The class handles both world-frame and robot-base-frame relative poses and twists, making it flexible for different use cases.
Initialize the kinematics solver. This constructor will directly use the data and robot_view objects for internal computations. Subclasses can copy the passed-in data before invoking this super constructor to maintain a private copy of the data, so as to not conflict with client code.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
MjData
|
The simulation state. This object is directly used internally for kinematics computations. |
required |
robot_view
|
RobotView
|
A RobotView instance bound to data representing the robot to compute kinematics for |
required |
Methods:
| Name | Description |
|---|---|
fk |
Compute forward kinematics for all move groups. |
ik |
Solve inverse kinematics to reach a target pose. |
twist_to_joint_vel |
Convert an end-effector twist to joint velocities. |
Source code in molmo_spaces/kinematics/mujoco_kinematics.py
fk
¶
fk(move_group_qpos: dict[str, ndarray], base_pose: ndarray, rel_to_base: bool = False) -> dict[str, ndarray]
Compute forward kinematics for all move groups.
This method computes the pose of each move group's leaf frame given the joint positions. The poses can be returned either relative to the world frame or relative to the robot base.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
move_group_qpos
|
dict[str, ndarray]
|
Dictionary mapping move group IDs to their joint positions |
required |
base_pose
|
ndarray
|
4x4 pose matrix of the robot base. |
required |
rel_to_base
|
bool
|
If True, return poses relative to robot base. If False, return poses in world frame. |
False
|
Returns:
| Type | Description |
|---|---|
dict[str, ndarray]
|
Dictionary mapping move group IDs to their 4x4 pose matrices |
Source code in molmo_spaces/kinematics/mujoco_kinematics.py
ik
¶
ik(move_group_id: str, pose: ndarray, unlocked_move_group_ids: list[str], q0: dict[str, ndarray], base_pose: ndarray, rel_to_base: bool = False, eps: float = 0.0001, max_iter: int = 1000, damping: float = 1e-12, dt: float = 1.0)
Solve inverse kinematics to reach a target pose.
This method iteratively solves for joint positions that would place the end-effector at the target pose. It uses a damped least squares approach with velocity-based updates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
move_group_id
|
str
|
ID of the move group whose end-effector pose is specified |
required |
pose
|
ndarray
|
4x4 target pose matrix |
required |
unlocked_move_group_ids
|
list[str]
|
List of move group IDs whose joints can move |
required |
q0
|
dict[str, ndarray]
|
Dictionary mapping move group IDs to their initial joint positions |
required |
base_pose
|
ndarray
|
4x4 pose matrix of the robot base. |
required |
rel_to_base
|
bool
|
If True, target pose is relative to robot base. If False, pose is in world frame. |
False
|
eps
|
float
|
Convergence threshold for the error norm |
0.0001
|
max_iter
|
int
|
Maximum number of iterations |
1000
|
damping
|
float
|
Damping factor for the damped least squares solution |
1e-12
|
dt
|
float
|
Time step for velocity integration |
1.0
|
Returns:
| Type | Description |
|---|---|
|
Dictionary mapping move group IDs to their joint positions if successful, None if failed |
Raises:
| Type | Description |
|---|---|
ValueError
|
If q0 keys don't match move group IDs |
Source code in molmo_spaces/kinematics/mujoco_kinematics.py
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 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 | |
twist_to_joint_vel
¶
twist_to_joint_vel(move_group_id: str, twist: ndarray, unlocked_move_group_ids: list[str], q0: dict[str, ndarray], base_pose: ndarray, twist_frame: Literal['world', 'base', 'leaf'] = 'world', damping: float = 1e-12)
Convert an end-effector twist to joint velocities.
This method computes the joint velocities that would result in the specified end-effector twist. It uses damped least squares to handle singularities.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
move_group_id
|
str
|
ID of the move group whose end-effector twist is specified |
required |
twist
|
ndarray
|
6D twist vector (linear and angular velocities) |
required |
unlocked_move_group_ids
|
list[str]
|
List of move group IDs whose joints can move |
required |
q0
|
dict[str, ndarray]
|
Dictionary mapping move group IDs to their current joint positions |
required |
base_pose
|
ndarray
|
4x4 pose matrix of the robot base. |
required |
twist_frame
|
Literal['world', 'base', 'leaf']
|
Frame of the twist, either in the world frame, the robot base frame, or the leaf frame of the move group. |
'world'
|
damping
|
float
|
Damping factor for the damped least squares solution |
1e-12
|
Returns:
| Type | Description |
|---|---|
|
Array of joint velocities that would achieve the desired twist |
Raises:
| Type | Description |
|---|---|
ValueError
|
If q0 keys don't match move group IDs |
Source code in molmo_spaces/kinematics/mujoco_kinematics.py
rby1_kinematics
¶
Classes:
| Name | Description |
|---|---|
RBY1Kinematics |
|
Functions:
| Name | Description |
|---|---|
main |
|
RBY1Kinematics
¶
RBY1Kinematics(model: MjModel, data: MjData | None = None, namespace: str = '', holo_base: bool = False)
Bases: MlSpacesKinematics
Methods:
| Name | Description |
|---|---|
fk |
Compute forward kinematics for all move groups. |
ik |
Solve inverse kinematics to reach a target pose. |
twist_to_joint_vel |
Convert an end-effector twist to joint velocities. |
Source code in molmo_spaces/kinematics/rby1_kinematics.py
fk
¶
fk(move_group_qpos: dict[str, ndarray], base_pose: ndarray, rel_to_base: bool = False) -> dict[str, ndarray]
Compute forward kinematics for all move groups.
This method computes the pose of each move group's leaf frame given the joint positions. The poses can be returned either relative to the world frame or relative to the robot base.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
move_group_qpos
|
dict[str, ndarray]
|
Dictionary mapping move group IDs to their joint positions |
required |
base_pose
|
ndarray
|
4x4 pose matrix of the robot base. |
required |
rel_to_base
|
bool
|
If True, return poses relative to robot base. If False, return poses in world frame. |
False
|
Returns:
| Type | Description |
|---|---|
dict[str, ndarray]
|
Dictionary mapping move group IDs to their 4x4 pose matrices |
Source code in molmo_spaces/kinematics/mujoco_kinematics.py
ik
¶
ik(move_group_id: str, pose: ndarray, unlocked_move_group_ids: list[str], q0: dict[str, ndarray], base_pose: ndarray, rel_to_base: bool = False, eps: float = 0.0001, max_iter: int = 1000, damping: float = 1e-12, dt: float = 1.0)
Solve inverse kinematics to reach a target pose.
This method iteratively solves for joint positions that would place the end-effector at the target pose. It uses a damped least squares approach with velocity-based updates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
move_group_id
|
str
|
ID of the move group whose end-effector pose is specified |
required |
pose
|
ndarray
|
4x4 target pose matrix |
required |
unlocked_move_group_ids
|
list[str]
|
List of move group IDs whose joints can move |
required |
q0
|
dict[str, ndarray]
|
Dictionary mapping move group IDs to their initial joint positions |
required |
base_pose
|
ndarray
|
4x4 pose matrix of the robot base. |
required |
rel_to_base
|
bool
|
If True, target pose is relative to robot base. If False, pose is in world frame. |
False
|
eps
|
float
|
Convergence threshold for the error norm |
0.0001
|
max_iter
|
int
|
Maximum number of iterations |
1000
|
damping
|
float
|
Damping factor for the damped least squares solution |
1e-12
|
dt
|
float
|
Time step for velocity integration |
1.0
|
Returns:
| Type | Description |
|---|---|
|
Dictionary mapping move group IDs to their joint positions if successful, None if failed |
Raises:
| Type | Description |
|---|---|
ValueError
|
If q0 keys don't match move group IDs |
Source code in molmo_spaces/kinematics/mujoco_kinematics.py
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 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 | |
twist_to_joint_vel
¶
twist_to_joint_vel(move_group_id: str, twist: ndarray, unlocked_move_group_ids: list[str], q0: dict[str, ndarray], base_pose: ndarray, twist_frame: Literal['world', 'base', 'leaf'] = 'world', damping: float = 1e-12)
Convert an end-effector twist to joint velocities.
This method computes the joint velocities that would result in the specified end-effector twist. It uses damped least squares to handle singularities.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
move_group_id
|
str
|
ID of the move group whose end-effector twist is specified |
required |
twist
|
ndarray
|
6D twist vector (linear and angular velocities) |
required |
unlocked_move_group_ids
|
list[str]
|
List of move group IDs whose joints can move |
required |
q0
|
dict[str, ndarray]
|
Dictionary mapping move group IDs to their current joint positions |
required |
base_pose
|
ndarray
|
4x4 pose matrix of the robot base. |
required |
twist_frame
|
Literal['world', 'base', 'leaf']
|
Frame of the twist, either in the world frame, the robot base frame, or the leaf frame of the move group. |
'world'
|
damping
|
float
|
Damping factor for the damped least squares solution |
1e-12
|
Returns:
| Type | Description |
|---|---|
|
Array of joint velocities that would achieve the desired twist |
Raises:
| Type | Description |
|---|---|
ValueError
|
If q0 keys don't match move group IDs |