Task-Space Control¶
Task-space (operational-space) controllers command a link's Cartesian pose or velocity rather than individual joint angles. Two classical formulations are provided: CLIK (velocity-level) and OSF (torque-level).
Background: Jacobian and Task-Space Error¶
The geometric Jacobian \(J_i(q) \in \mathbb{R}^{6 \times n}\) maps joint velocities to the 6D spatial velocity of link \(i\):
For the Step and Cubic variants the controller needs a pose error \(e_x \in \mathbb{R}^6\):
where \(p\) is the current position, \(R\) is the current rotation matrix with column vectors \(r_k\), and \(R_d\) is the desired rotation matrix. This is the angle-axis–based orientation error that vanishes when \(R = R_d\).
CLIK — Closed-Loop Inverse Kinematics¶
CLIK maps task-space velocity commands to joint velocity commands using the Moore-Penrose pseudoinverse.
Core formula (CLIK)¶
Given desired task velocity \(\dot{x}^d_i\) for each link \(i\), the stacked Jacobian \(J \in \mathbb{R}^{6k \times n}\) is formed from all \(k\) controlled links and the joint velocity is:
| Term | Description |
|---|---|
| \(J^+\) | Pseudoinverse computed with Complete Orthogonal Decomposition (COD); robust near singularities |
| \((I - J^+ J)\) | Null-space projector; maps \(\dot{q}_{\text{null}}\) into the null space of \(J\) without disturbing task tracking |
| \(\dot{q}_{\text{null}}\) | Optional secondary joint-velocity objective (e.g. joint-limit centering, posture control) |
With pose feedback (CLIKStep)¶
Adds a proportional error term to close the kinematic loop and correct position drift:
Gain \(K_p \in \mathbb{R}^6\) is set with setIKGain.
Higher values converge faster but may amplify noise; a typical value is in the range \(1\)–\(10\) for position and orientation channels.
With cubic trajectory (CLIKCubic)¶
First generates a cubic polynomial reference trajectory (see Cubic polynomial):
then passes the result through CLIKStep.
Singularity and CLIK¶
At a kinematic singularity \(J\) becomes rank-deficient and \(J^+\) amplifies noise. For singularity-robust IK with hard joint limits and collision avoidance, prefer QPIK instead.
OSF — Operational Space Formulation¶
OSF operates at the torque level and accounts for robot dynamics. It is the natural torque-level complement to CLIK.
Task-space mass matrix¶
The key quantity is the task-space (operational-space) inertia matrix:
and the dynamically consistent pseudoinverse of \(J^T\):
Core formula (OSF)¶
Given desired task-space acceleration \(\ddot{x}^d\) and an optional null-space torque \(\tau_{\text{null}}\):
where the null-space projector is:
| Term | Description |
|---|---|
| \(J^T \Lambda\,\ddot{x}^d\) | Task-space force mapped to joint torques |
| \(N^T\,\tau_{\text{null}}\) | Null-space torque (e.g., joint damping or posture control) |
| \(g(q)\) | Gravity compensation — added automatically |
With pose feedback (OSFStep)¶
Computes the task-space acceleration command from position and velocity errors:
where the velocity error is \(e_{\dot{x},i} = \dot{x}^d_i - \dot{x}_i\).
Gains \(K_p, K_v \in \mathbb{R}^6\) are set with setIDGain.
With cubic trajectory (OSFCubic)¶
Generates a cubic reference trajectory then passes through OSFStep, identical in structure to CLIKCubic.
Choosing CLIK vs OSF vs QP¶
| Criterion | CLIK | OSF | QPIK / QPID |
|---|---|---|---|
| Command type | joint velocity | joint torque | joint velocity / torque |
| Dynamics-aware | no | yes | yes (QPID) |
| Joint limit enforcement | none | none | CBF constraints |
| Singularity avoidance | pseudoinverse only | pseudoinverse only | CBF constraint |
| Self-collision avoidance | none | none | CBF constraint |
| Multiple tasks | stacked Jacobian | stacked Jacobian | weighted or hierarchical |
| Computational cost | low | low | medium (QP solver) |
For applications where safety constraints matter, use QPIK or QPID.