Implementation:Haosulab ManiSkill PDJointPosVelController
| Knowledge Sources | |
|---|---|
| Domains | Robotics, Simulation |
| Last Updated | 2026-02-15 08:00 GMT |
Overview
Concrete combined PD joint position and velocity controller that simultaneously sets both position and velocity drive targets in ManiSkill.
Description
PDJointPosVelController extends PDJointPosController to support simultaneous position and velocity drive targets. The action space is double the joint dimensions: the first half specifies position targets (absolute or delta, following the same logic as PDJointPosController) and the second half specifies velocity targets that are set directly via set_joint_drive_velocity_targets(). The controller sets both sets_target_qpos = True and sets_target_qvel = True. On reset, the velocity target is initialized to the current joint velocity (or zeros for reset environments in batched simulation).
Usage
Use PDJointPosVelControllerConfig for tasks that benefit from feedforward velocity commands alongside position targets, such as trajectory tracking or dynamic manipulation tasks. The combined position+velocity action provides finer-grained control compared to position-only controllers.
Code Reference
Source Location
- Repository: Haosulab_ManiSkill
- File: mani_skill/agents/controllers/pd_joint_pos_vel.py
- Lines: 1-71
Signature
class PDJointPosVelController(PDJointPosController):
config: "PDJointPosVelControllerConfig"
_target_qvel = None
sets_target_qpos = True
sets_target_qvel = True
@dataclass
class PDJointPosVelControllerConfig(PDJointPosControllerConfig):
controller_cls = PDJointPosVelController
vel_lower: Union[float, Sequence[float]] = -1.0
vel_upper: Union[float, Sequence[float]] = 1.0
Import
from mani_skill.agents.controllers.pd_joint_pos_vel import (
PDJointPosVelController,
PDJointPosVelControllerConfig,
)
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| action | np.ndarray | Yes | Action of shape (batch, 2 * num_joints). First half is position targets, second half is velocity targets. |
| vel_lower | float or Sequence[float] | No | Lower bound for velocity targets. Defaults to -1.0. |
| vel_upper | float or Sequence[float] | No | Upper bound for velocity targets. Defaults to 1.0. |
| (inherited) | All parameters from PDJointPosControllerConfig (lower, upper, stiffness, damping, etc.).
|
Outputs
| Name | Type | Description |
|---|---|---|
| _target_qpos | torch.Tensor | Computed position targets set as joint drive position targets. |
| _target_qvel | torch.Tensor | Velocity targets set as joint drive velocity targets. |
| action_space | spaces.Box | Box space of dimension 2 * num_joints, concatenating position and velocity bounds. |
Usage Examples
Basic Usage
from mani_skill.agents.controllers.pd_joint_pos_vel import PDJointPosVelControllerConfig
# Combined position + velocity control
config = PDJointPosVelControllerConfig(
joint_names=["joint1", "joint2", "joint3"],
lower=-3.14,
upper=3.14,
stiffness=100,
damping=10,
vel_lower=-1.0,
vel_upper=1.0,
use_delta=True,
normalize_action=True,
)
# Action space will be Box of shape (6,): [pos1, pos2, pos3, vel1, vel2, vel3]