embodichain.lab.sim.robots#
Overview#
This module exposes robot-specific configuration presets for simulation scenes.
Classes
CobotMagicCfg(uid: 'Union[str, None]' = <factory>, init_pos: 'tuple[float, float, float]' = <factory>, init_rot: 'tuple[float, float, float]' = <factory>, init_local_pose: 'np.ndarray | None' = <factory>, fpath: 'str' = <factory>, drive_pros: 'JointDrivePropertiesCfg' = <factory>, body_scale: 'Union[tuple, list]' = <factory>, attrs: 'RigidBodyAttributesCfg' = <factory>, link_attrs: 'dict[str, LinkPhysicsOverrideCfg] | None' = <factory>, fix_base: 'bool' = <factory>, disable_self_collision: 'bool' = <factory>, init_qpos: 'Union[torch.Tensor, np.ndarray, Sequence[float]]' = <factory>, sleep_threshold: 'float' = <factory>, min_position_iters: 'int' = <factory>, min_velocity_iters: 'int' = <factory>, build_pk_chain: 'bool' = <factory>, compute_uv: 'bool' = <factory>, use_usd_properties: 'bool' = <factory>, control_parts: 'Dict[str, List[str]] | None' = <factory>, urdf_cfg: 'URDFCfg' = <factory>, solver_cfg: "Dict[str, 'SolverCfg'] | None" = <factory>, _build_default_cfgs: function = <factory>) |
- class embodichain.lab.sim.robots.CobotMagicCfg[source]#
Bases:
RobotCfgCobotMagicCfg(uid: ‘Union[str, None]’ = <factory>, init_pos: ‘tuple[float, float, float]’ = <factory>, init_rot: ‘tuple[float, float, float]’ = <factory>, init_local_pose: ‘np.ndarray | None’ = <factory>, fpath: ‘str’ = <factory>, drive_pros: ‘JointDrivePropertiesCfg’ = <factory>, body_scale: ‘Union[tuple, list]’ = <factory>, attrs: ‘RigidBodyAttributesCfg’ = <factory>, link_attrs: ‘dict[str, LinkPhysicsOverrideCfg] | None’ = <factory>, fix_base: ‘bool’ = <factory>, disable_self_collision: ‘bool’ = <factory>, init_qpos: ‘Union[torch.Tensor, np.ndarray, Sequence[float]]’ = <factory>, sleep_threshold: ‘float’ = <factory>, min_position_iters: ‘int’ = <factory>, min_velocity_iters: ‘int’ = <factory>, build_pk_chain: ‘bool’ = <factory>, compute_uv: ‘bool’ = <factory>, use_usd_properties: ‘bool’ = <factory>, control_parts: ‘Dict[str, List[str]] | None’ = <factory>, urdf_cfg: ‘URDFCfg’ = <factory>, solver_cfg: “Dict[str, ‘SolverCfg’] | None” = <factory>, _build_default_cfgs: function = <factory>)
Classes:
Configuration for the kinematic solver used in the robot simulation.
Attributes:
Physical attributes for all links.
Scale of the articulation in the simulation world frame.
Whether to build pytorch-kinematics chain for forward kinematics and jacobian computation.
Whether to compute the UV mapping for the articulation link.
Control parts is the mapping from part name to joint names.
Whether to enable or disable self-collisions.
Properties to define the drive mechanism of a joint.
Whether to fix the base of the articulation.
Path to the articulation asset file.
4x4 transformation matrix of the root in local frame.
Position of the root in simulation world frame.
Initial joint positions of the articulation.
Euler angles (in degree) of the root in simulation world frame.
Named per-link physics override groups keyed by regex on link names.
[1,255].
[0,255].
[0, max_float32]
Solver is used to compute forward and inverse kinematics for the robot.
URDF assembly configuration which allows for assembling a robot from multiple URDF components.
Whether to use physical properties from USD file instead of config.
Methods:
build_pk_serial_chain([device])Build the serial chain from the URDF file.
from_dict(init_dict)Initialize the configuration from a dictionary.
- class SolverCfg#
Bases:
objectConfiguration for the kinematic solver used in the robot simulation.
Attributes:
The class type of the solver to be used.
The name of the end-effector link for the solver.
Weights for the inverse kinematics nearest calculation.
List of joint names for the solver.
The name of the root/base link for the solver.
The tool center point (TCP) position as a 4x4 homogeneous matrix.
The file path to the URDF model of the robot.
User defined Joint position limits [2, DOF] for the solver.
Methods:
from_dict(init_dict)Initialize the configuration from a dictionary.
-
class_type:
str# The class type of the solver to be used.
-
end_link_name:
str# The name of the end-effector link for the solver.
This defines the target link for forward/inverse kinematics calculations. Must match a link name in the URDF file.
- classmethod from_dict(init_dict)#
Initialize the configuration from a dictionary.
- Return type:
-
ik_nearest_weight:
Optional[List[float]]# Weights for the inverse kinematics nearest calculation.
The weights influence how the solver prioritizes closeness to the seed position when multiple solutions are available.
-
joint_names:
list[str] |None# List of joint names for the solver.
If None, all joints in the URDF will be used. If specified, only these named joints will be included in the kinematic chain.
-
root_link_name:
str# The name of the root/base link for the solver.
This defines the starting point of the kinematic chain. Must match a link name in the URDF file.
-
tcp:
Tensor|ndarray# The tool center point (TCP) position as a 4x4 homogeneous matrix.
This represents the position and orientation of the tool in the robot’s end-effector frame.
-
urdf_path:
str|None# The file path to the URDF model of the robot.
-
user_qpos_limits:
Optional[List[float]]# User defined Joint position limits [2, DOF] for the solver. If not provided (None), this value will replace by joint limits defined in urdf when solver init from robot. If provided, the solver will use the intersection of user defined limits and urdf limits as the final joint limits.
-
class_type:
- attrs: RigidBodyAttributesCfg#
Physical attributes for all links. We use default mass from the USD/URDF file if available. The mass and density in attrs will only be used if specified.
- body_scale: Union[tuple, list]#
Scale of the articulation in the simulation world frame.
- build_pk_chain: bool#
Whether to build pytorch-kinematics chain for forward kinematics and jacobian computation.
- build_pk_serial_chain(device=device(type='cpu'), **kwargs)[source]#
Build the serial chain from the URDF file.
Note
This method is usually used in imitation dataset saving (compute eef pose from qpos using FK) and model training (provide a differentiable FK layer or loss computation).
- Parameters:
device (torch.device) – The device to which the chain will be moved. Defaults to CPU.
**kwargs – Additional arguments for building the serial chain.
- Returns:
The serial chain of the robot for specified control part.
- Return type:
Dict[str, pk.SerialChain]
- compute_uv: bool#
Whether to compute the UV mapping for the articulation link.
Currently, the uv mapping is computed for each link with projection uv mapping method.
- control_parts: Dict[str, List[str]] | None#
Control parts is the mapping from part name to joint names.
For example, {‘left_arm’: [‘joint1’, ‘joint2’], ‘right_arm’: [‘joint3’, ‘joint4’]} If no control part is specified, the robot will use all joints as a single control part.
Note
- if control_parts is specified, solver_cfg must be a dict with part names as
keys corresponding to the control parts name.
- The joint names in the control parts support regular expressions, e.g., ‘joint[1-6]’.
After initialization of robot, the names will be expanded to a list of full joint names.
- Robot is a derived class of Articulation, with control parts support. So the drive_pros
in ArticulationCfg can use control part as key to specify the corresponding joint drive properties, which will be overridden if these joint names are already specified.
- disable_self_collision: bool#
Whether to enable or disable self-collisions.
- drive_pros: JointDrivePropertiesCfg#
Properties to define the drive mechanism of a joint.
- fix_base: bool#
Whether to fix the base of the articulation.
Set to True for articulations that should not move, such as a fixed base robot arm or a door. Set to False for articulations that should move freely, such as a mobile robot or a humanoid robot.
- fpath: str#
Path to the articulation asset file.
- classmethod from_dict(init_dict)[source]#
Initialize the configuration from a dictionary.
- Return type:
- init_local_pose: np.ndarray | None#
4x4 transformation matrix of the root in local frame. If specified, it will override init_pos and init_rot.
- init_pos: tuple[float, float, float]#
Position of the root in simulation world frame. Defaults to (0.0, 0.0, 0.0).
- init_qpos: Union[torch.Tensor, np.ndarray, Sequence[float]]#
Initial joint positions of the articulation.
If None, the joint positions will be set to zero. If provided, it should be a array of shape (num_joints,).
- init_rot: tuple[float, float, float]#
Euler angles (in degree) of the root in simulation world frame. Defaults to (0.0, 0.0, 0.0).
- link_attrs: dict[str, LinkPhysicsOverrideCfg] | None#
Named per-link physics override groups keyed by regex on link names.
Each group applies
LinkPhysicsOverrideCfg.attrson top ofattrsfor matched links only. A link must not match more than one group.
- min_position_iters: int#
[1,255].
- Type:
Number of position iterations the solver should perform for this articulation. Range
- min_velocity_iters: int#
[0,255].
- Type:
Number of velocity iterations the solver should perform for this articulation. Range
- sleep_threshold: float#
[0, max_float32]
- Type:
Energy below which the articulation may go to sleep. Range
- solver_cfg: Dict[str, 'SolverCfg'] | None#
Solver is used to compute forward and inverse kinematics for the robot.
- urdf_cfg: URDFCfg#
URDF assembly configuration which allows for assembling a robot from multiple URDF components.
- use_usd_properties: bool#
Whether to use physical properties from USD file instead of config.
When True: Keep all physical properties (drive, physics attrs, etc.) from USD file. When False (default): Override USD properties with config values (URDF behavior). Only effective for USD files, ignored for URDF files.