kinematics¶
kinematics
¶
Modules:
| Name | Description |
|---|---|
floating_rum_kinematics |
|
mujoco_kinematics |
General-purpose forward and inverse kinematics solver for robots in MuJoCo. |
test_robot_ik |
Interactive script to test a robot with the parallel and non-parallel IK solvers. |
floating_rum_kinematics
¶
Classes:
| Name | Description |
|---|---|
FloatingRUMKinematics |
Kinematics solver that provides a specialized implementation for the Floating RUM robot. |
Functions:
| Name | Description |
|---|---|
main |
|
FloatingRUMKinematics
¶
FloatingRUMKinematics(robot_config: BaseRobotConfig)
Bases: MlSpacesKinematics
Kinematics solver that provides a specialized implementation for the Floating RUM robot.
Create a kinematics solver for a robot.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
robot_config
|
BaseRobotConfig
|
The robot configuration. |
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
_constrain_state
¶
Constrain the current state to be within the joint limits.
This method clips all joint positions to their respective limits. It should be called after any operation that might move joints outside their valid ranges.
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] | None, 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] | None
|
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/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
_show_poses
¶
Source code in molmo_spaces/kinematics/floating_rum_kinematics.py
main
¶
Source code in molmo_spaces/kinematics/floating_rum_kinematics.py
mujoco_kinematics
¶
General-purpose forward and inverse kinematics solver for robots in MuJoCo. This solver is not parallelizable and runs on the CPU. While fairly fast, this is not suitable for large batches.
Classes:
| Name | Description |
|---|---|
MlSpacesKinematics |
A general-purpose kinematics solver for robots in MuJoCo. |
Attributes:
| Name | Type | Description |
|---|---|---|
log |
|
MlSpacesKinematics
¶
MlSpacesKinematics(robot_config: BaseRobotConfig)
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.
Create a kinematics solver for a robot.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
robot_config
|
BaseRobotConfig
|
The robot configuration. |
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
_constrain_state
¶
Constrain the current state to be within the joint limits.
This method clips all joint positions to their respective limits. It should be called after any operation that might move joints outside their valid ranges.
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] | None, 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] | None
|
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
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 | |
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
test_robot_ik
¶
Interactive script to test a robot with the parallel and non-parallel IK solvers.
On mac, run with mjpython.
Functions:
| Name | Description |
|---|---|
main |
|
main
¶
Source code in molmo_spaces/kinematics/test_robot_ik.py
parallel kinematics¶
parallel
¶
Modules:
| Name | Description |
|---|---|
dummy_parallel_kinematics |
|
parallel_kinematics |
|
warp_kinematics |
Provides a general-purpose, robot-agnostic, vectorized (and optionally GPU accelerated) kinematics solver. |
dummy_parallel_kinematics
¶
Classes:
| Name | Description |
|---|---|
DummyParallelKinematics |
Dummy parallel kinematics wrapper that sequentially calls :class: |
Attributes:
| Name | Type | Description |
|---|---|---|
logger |
|
DummyParallelKinematics
¶
DummyParallelKinematics(robot_config: BaseRobotConfig, kinematics: MlSpacesKinematics)
Bases: ParallelKinematics
Dummy parallel kinematics wrapper that sequentially calls :class:MlSpacesKinematics internally.
Methods:
| Name | Description |
|---|---|
fk |
Compute forward kinematics for all move groups. |
ik |
Finds joint positions that would place the end-effector at the target pose. |
warmup_ik |
Incur startup costs up-front to speed up subsequent calls to IK. |
Source code in molmo_spaces/kinematics/parallel/dummy_parallel_kinematics.py
fk
¶
fk(qpos_dicts: list[dict[str, ndarray]] | dict[str, ndarray], base_poses: ndarray, rel_to_base: bool = False) -> list[dict[str, ndarray]] | dict[str, ndarray]
Compute forward kinematics for all move groups.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
qpos_dicts
|
list[dict[str, ndarray]] | dict[str, ndarray]
|
The joint positions. |
required |
base_pose
|
The base pose(s) of the robots. Shape: (batch_size, 4, 4) or (4, 4) |
required | |
rel_to_base
|
bool
|
Whether the returned pose(s) should be relative to the base frame. |
False
|
Returns:
| Type | Description |
|---|---|
list[dict[str, ndarray]] | dict[str, ndarray]
|
A list of qpos dictionaries for each robot in the batch, or a single qpos dictionary if unbatched. |
Source code in molmo_spaces/kinematics/parallel/dummy_parallel_kinematics.py
ik
¶
ik(move_group_id: str, poses: ndarray, unlocked_move_group_ids: list[str] | None, q0_dicts: list[dict[str, ndarray]] | dict[str, ndarray], base_poses: ndarray, rel_to_base: bool = False, dt: float = 1.0, max_iter: int = 100, success_eps: float = 0.0001, **kwargs)
Finds joint positions that would place the end-effector at the target pose.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pose
|
The target pose(s) to reach. Shape: (batch_size, 4, 4) or (4, 4) |
required | |
q0_dicts
|
list[dict[str, ndarray]] | dict[str, ndarray]
|
The initial joint positions. |
required |
base_pose
|
The base pose(s) of the robots. Shape: (batch_size, 4, 4) or (4, 4) |
required | |
rel_to_base
|
bool
|
Whether the pose(s) are relative to the base frame. |
False
|
**kwargs
|
Any
|
Additional keyword arguments for the IK solver, defined by the concrete implementation. |
{}
|
Returns:
| Type | Description |
|---|---|
list[dict[str, ndarray] | None] | dict[str, ndarray] | None
|
A list of qpos dictionaries for each robot in the batch, or a single qpos dictionary if unbatched. If the solver fails to converge for a given robot, the corresponding qpos dictionary is None. |
Source code in molmo_spaces/kinematics/parallel/dummy_parallel_kinematics.py
warmup_ik
¶
Incur startup costs up-front to speed up subsequent calls to IK. The warmed up batch size may need to match that of the subsequent calls to IK.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
batch_size
|
int
|
The batch size to warmup. |
required |
parallel_kinematics
¶
Classes:
| Name | Description |
|---|---|
ParallelKinematics |
|
ParallelKinematics
¶
ParallelKinematics(robot_config: BaseRobotConfig)
Bases: ABC
Methods:
| Name | Description |
|---|---|
fk |
Compute forward kinematics for all move groups. |
ik |
Finds joint positions that would place the end-effector at the target pose. |
warmup_ik |
Incur startup costs up-front to speed up subsequent calls to IK. |
Source code in molmo_spaces/kinematics/parallel/parallel_kinematics.py
fk
abstractmethod
¶
fk(qpos_dicts: list[dict[str, ndarray]] | dict[str, ndarray], base_poses: ndarray, rel_to_base: bool = False) -> list[dict[str, ndarray]] | dict[str, ndarray]
Compute forward kinematics for all move groups.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
qpos_dicts
|
list[dict[str, ndarray]] | dict[str, ndarray]
|
The joint positions. |
required |
base_pose
|
The base pose(s) of the robots. Shape: (batch_size, 4, 4) or (4, 4) |
required | |
rel_to_base
|
bool
|
Whether the returned pose(s) should be relative to the base frame. |
False
|
Returns:
| Type | Description |
|---|---|
list[dict[str, ndarray]] | dict[str, ndarray]
|
A list of qpos dictionaries for each robot in the batch, or a single qpos dictionary if unbatched. |
Source code in molmo_spaces/kinematics/parallel/parallel_kinematics.py
ik
abstractmethod
¶
ik(move_group_id: str, poses: ndarray, unlocked_move_group_ids: list[str] | None, q0_dicts: list[dict[str, ndarray]] | dict[str, ndarray], base_poses: ndarray, rel_to_base: bool = False, **kwargs: Any) -> list[dict[str, ndarray] | None] | dict[str, ndarray] | None
Finds joint positions that would place the end-effector at the target pose.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pose
|
The target pose(s) to reach. Shape: (batch_size, 4, 4) or (4, 4) |
required | |
q0_dicts
|
list[dict[str, ndarray]] | dict[str, ndarray]
|
The initial joint positions. |
required |
base_pose
|
The base pose(s) of the robots. Shape: (batch_size, 4, 4) or (4, 4) |
required | |
rel_to_base
|
bool
|
Whether the pose(s) are relative to the base frame. |
False
|
**kwargs
|
Any
|
Additional keyword arguments for the IK solver, defined by the concrete implementation. |
{}
|
Returns:
| Type | Description |
|---|---|
list[dict[str, ndarray] | None] | dict[str, ndarray] | None
|
A list of qpos dictionaries for each robot in the batch, or a single qpos dictionary if unbatched. If the solver fails to converge for a given robot, the corresponding qpos dictionary is None. |
Source code in molmo_spaces/kinematics/parallel/parallel_kinematics.py
warmup_ik
abstractmethod
¶
Incur startup costs up-front to speed up subsequent calls to IK. The warmed up batch size may need to match that of the subsequent calls to IK.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
batch_size
|
int
|
The batch size to warmup. |
required |
Source code in molmo_spaces/kinematics/parallel/parallel_kinematics.py
warp_kinematics
¶
Provides a general-purpose, robot-agnostic, vectorized (and optionally GPU accelerated) kinematics solver.
Classes:
| Name | Description |
|---|---|
IKArgs |
Preallocated buffers for the IK solver arguments |
IKBuffers |
Preallocated buffers for the IK solver state |
SimpleWarpKinematics |
A warp-based general-purpose parallel inverse kinematics solver for robots. |
SolverData |
|
Functions:
| Name | Description |
|---|---|
cholesky_solve6 |
Solve Hx=b via Cholesky decomposition for 6x6 symmetric positive-definite matrix |
get_err |
Calculate the body-frame position and rotation error between the current and target poses |
get_jac_frame_info |
Get the position and body ID of the frame |
lm_step |
Single step of the Levenberg-Marquardt solver. |
mask_jacobian |
Apply a column-wise mask to a (3, nv) Jacobian matrix |
Attributes:
| Name | Type | Description |
|---|---|---|
logger |
|
|
mat66f |
|
|
vec6f |
|
IKArgs
dataclass
¶
IKArgs(poses: array(dtype=mat44f), leaf_frame_id: array(dtype=int), leaf_frame_type: array(dtype=int), damping: array(dtype=float32), dt: array(dtype=float32), jacobian_mask: array2d(dtype=int))
Preallocated buffers for the IK solver arguments
Attributes:
| Name | Type | Description |
|---|---|---|
damping |
array(dtype=float32)
|
|
dt |
array(dtype=float32)
|
|
jacobian_mask |
array2d(dtype=int)
|
|
leaf_frame_id |
array(dtype=int)
|
|
leaf_frame_type |
array(dtype=int)
|
|
poses |
array(dtype=mat44f)
|
|
IKBuffers
dataclass
¶
IKBuffers(pos_err: array(dtype=vec3f), rot_err: array(dtype=vec3f), jacp: array3d(dtype=float32), jacr: array3d(dtype=float32), q_dot: array2d(dtype=float32), frame_pos: array(dtype=vec3f), frame_mat: array(dtype=mat33f), frame_bodyid: array(dtype=int))
Preallocated buffers for the IK solver state
Attributes:
| Name | Type | Description |
|---|---|---|
frame_bodyid |
array(dtype=int)
|
|
frame_mat |
array(dtype=mat33f)
|
|
frame_pos |
array(dtype=vec3f)
|
|
jacp |
array3d(dtype=float32)
|
|
jacr |
array3d(dtype=float32)
|
|
pos_err |
array(dtype=vec3f)
|
|
q_dot |
array2d(dtype=float32)
|
|
rot_err |
array(dtype=vec3f)
|
|
SimpleWarpKinematics
¶
SimpleWarpKinematics(robot_config: BaseRobotConfig, device: str = 'cpu')
Bases: ParallelKinematics
A warp-based general-purpose parallel inverse kinematics solver for robots.
This solver only supports optimizing SimplyActuatedMoveGroups to reach a target pose for a given MJCFFrameMixin move group.
Most robots satisfy this assumption, but more complicated robots may need custom kinematics implementations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
robot_config
|
BaseRobotConfig
|
The robot configuration. |
required |
device
|
str
|
The warp device to use for the solver. |
'cpu'
|
Methods:
| Name | Description |
|---|---|
fk |
Compute forward kinematics for all simple move groups. |
ik |
Solve inverse kinematics to reach a target pose. |
warmup_ik |
Incur startup costs up-front to speed up subsequent calls to IK. |
Source code in molmo_spaces/kinematics/parallel/warp_kinematics.py
fk
¶
fk(qpos_dicts: list[dict[str, ndarray]] | dict[str, ndarray], base_poses: ndarray, rel_to_base: bool = False) -> list[dict[str, ndarray]] | dict[str, ndarray]
Compute forward kinematics for all simple move groups. Non MJCFFrameMixin move groups (e.g. bases) are not included in the output.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
qpos_dicts
|
list[dict[str, ndarray]] | dict[str, ndarray]
|
The joint positions. |
required |
base_poses
|
ndarray
|
The base pose(s) of the robots. Shape: (batch_size, 4, 4) or (4, 4) |
required |
rel_to_base
|
bool
|
Whether the returned pose(s) should be relative to the base frame. |
False
|
Returns:
| Type | Description |
|---|---|
list[dict[str, ndarray]] | dict[str, ndarray]
|
A list of qpos dictionaries for each robot in the batch, or a single qpos dictionary if unbatched. |
Source code in molmo_spaces/kinematics/parallel/warp_kinematics.py
ik
¶
ik(move_group_id: str, poses: ndarray, unlocked_move_group_ids: list[str] | None, q0_dicts: list[dict[str, ndarray]] | dict[str, ndarray], base_poses: ndarray, rel_to_base: bool = False, converge_eps: float = 0.001, success_eps: float = 0.0005, max_iter: int = 50, damping: float = 1e-12, dt: float = 1.0)
Solve inverse kinematics to reach a target pose.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
move_group_id
|
str
|
The ID of the move group to solve for. |
required |
poses
|
ndarray
|
The target poses. Shape: (batch_size, 4, 4) or (4, 4) |
required |
unlocked_move_group_ids
|
list[str] | None
|
The IDs of the move groups that are not locked. If None, all move groups are unlocked. |
required |
q0_dicts
|
list[dict[str, ndarray]] | dict[str, ndarray]
|
The initial joint positions. |
required |
base_poses
|
ndarray
|
The base poses. Shape: (batch_size, 4, 4) or (4, 4) |
required |
rel_to_base
|
bool
|
Whether the target poses are relative to the base frame. |
False
|
converge_eps
|
float
|
The convergence threshold in joint space. |
0.001
|
success_eps
|
float
|
The success threshold in twist space. |
0.0005
|
max_iter
|
int
|
The maximum number of iterations. |
50
|
damping
|
float
|
The damping factor for the Levenberg-Marquardt solver. |
1e-12
|
dt
|
float
|
The time step for velocity integration. |
1.0
|
Returns:
| Type | Description |
|---|---|
|
A list of qpos dictionaries for each robot in the batch, or a single qpos dictionary if unbatched. If the solver fails to converge for a given robot, the corresponding qpos dictionary is None. |
Source code in molmo_spaces/kinematics/parallel/warp_kinematics.py
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 606 607 608 609 610 611 612 613 614 615 616 617 618 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 | |
warmup_ik
¶
Incur startup costs up-front to speed up subsequent calls to IK. The warmed up batch size may need to match that of the subsequent calls to IK.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
batch_size
|
int
|
The batch size to warmup. |
required |
Source code in molmo_spaces/kinematics/parallel/warp_kinematics.py
SolverData
dataclass
¶
SolverData(data: Data, ik_buffers: IKBuffers, ik_args: IKArgs, ik_capture: ScopedCapture | None = None)
Attributes:
| Name | Type | Description |
|---|---|---|
data |
Data
|
|
ik_args |
IKArgs
|
|
ik_buffers |
IKBuffers
|
|
ik_capture |
ScopedCapture | None
|
|
cholesky_solve6
¶
Solve Hx=b via Cholesky decomposition for 6x6 symmetric positive-definite matrix
Source code in molmo_spaces/kinematics/parallel/warp_kinematics.py
get_err
¶
get_err(xpos: array(dtype=vec3f), xmat: array(dtype=mat33f), poses: array(dtype=mat44f), pos_err: array(dtype=vec3f), rot_err: array(dtype=vec3f))
Calculate the body-frame position and rotation error between the current and target poses
Source code in molmo_spaces/kinematics/parallel/warp_kinematics.py
get_jac_frame_info
¶
get_jac_frame_info(frame_id_: array(dtype=int), frame_type_: array(dtype=int), xpos: array2d(dtype=vec3f), xmat: array2d(dtype=mat33f), site_xpos: array2d(dtype=vec3f), site_xmat: array2d(dtype=mat33f), site_bodyid: array(dtype=int), frame_pos: array(dtype=vec3f), frame_mat: array(dtype=mat33f), frame_bodyid: array(dtype=int))
Get the position and body ID of the frame
Source code in molmo_spaces/kinematics/parallel/warp_kinematics.py
lm_step
¶
lm_step(jacp: array3d(dtype=float32), jacr: array3d(dtype=float32), pos_err: array(dtype=vec3f), rot_err: array(dtype=vec3f), damping: array(dtype=float32), dt: array(dtype=float32), nv: int, qpos: array2d(dtype=float32), q_dot: array2d(dtype=float32))
Single step of the Levenberg-Marquardt solver.
Source code in molmo_spaces/kinematics/parallel/warp_kinematics.py
mask_jacobian
¶
Apply a column-wise mask to a (3, nv) Jacobian matrix