Articulation#
The Articulation class represents the fundamental physics entity for articulated objects (e.g., robots, grippers, cabinets, doors) in EmbodiChain.
Configuration#
Articulations are configured using the ArticulationCfg dataclass.
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
Path to the asset file (URDF/MJCF). |
|
|
|
Initial root position |
|
|
|
Initial root rotation |
|
|
|
Whether to fix the base of the articulation. |
|
|
|
Default drive properties. |
Drive Configuration#
The drive_props parameter controls the joint physics behavior. It is defined using the JointDrivePropertiesCfg class.
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
Stiffness (P-gain) of the joint drive. Unit: $N/m$ or $Nm/rad$. |
|
|
|
Damping (D-gain) of the joint drive. Unit: $Ns/m$ or $Nms/rad$. |
|
|
|
Maximum effort (force/torque) the joint can exert. |
|
|
|
Maximum velocity allowed for the joint ($m/s$ or $rad/s$). |
|
|
|
Joint friction coefficient. |
|
|
|
Drive mode: |
Setup & Initialization#
import torch
from embodichain.lab.sim import SimulationManager, SimulationManagerCfg
from embodichain.lab.sim.objects import Articulation, ArticulationCfg
# 1. Initialize Simulation
device = "cuda" if torch.cuda.is_available() else "cpu"
sim_cfg = SimulationManagerCfg(sim_device=device)
sim = SimulationManager(sim_config=sim_cfg)
# 2. Configure Articulation
art_cfg = ArticulationCfg(
fpath="assets/robots/franka/franka.urdf",
init_pos=(0, 0, 0.5),
fix_base=True
)
# 3. Spawn Articulation
# Note: The method is 'add_articulation'
articulation: Articulation = sim.add_articulation(cfg=art_cfg)
# 4. Initialize Physics
sim.reset_objects_state()
Articulation Class#
State Data (Observation) State data is accessed via getter methods that return batched tensors.
Property |
Shape |
Description |
|---|---|---|
|
|
Root link pose |
|
|
Joint positions. |
|
|
Joint velocities. |
# Example: Accessing state
# Note: Use methods (with brackets) instead of properties
print(f"Current Joint Positions: {articulation.get_qpos()}")
print(f"Root Pose: {articulation.get_local_pose()}")
Control & Dynamics#
You can control the articulation by setting joint targets.
Joint Control#
# Set joint position targets (PD Control)
# Get current qpos to create a target tensor of correct shape
current_qpos = articulation.get_qpos()
target_qpos = torch.zeros_like(current_qpos)
# Set target position
# target=True: Sets the drive target. The physics engine applies forces to reach this position.
# target=False: Instantly resets/teleports joints to this position (ignoring physics).
articulation.set_qpos(target_qpos, target=True)
# Important: Step simulation to apply control
sim.update()
Drive Configuration#
Dynamically adjust drive properties.
# Set stiffness for all joints
articulation.set_drive(
stiffness=torch.tensor([100.0], device=device),
damping=torch.tensor([10.0], device=device)
)
Kinematics#
Supports differentiable Forward Kinematics (FK) and Jacobian computation.
# Compute Forward Kinematics
# Note: Ensure 'build_pk_chain=True' in cfg
if getattr(art_cfg, 'build_pk_chain', False):
ee_pose = articulation.compute_fk(
qpos=articulation.get_qpos(), # Use method call
end_link_name="ee_link" # Replace with actual link name
)