These equations are drawn from Principles of Robot Motion (Choset et al.) [2] and Real-Time Obstacle Avoidance for Manipulators and Mobile Robots (Khatib) [1], which derive the potential functions, their gradients, and how to obtain a velocity from those gradients.
The potential field produces a task-space wrench over the robot's end-effector pose, a linear force
with defaults
The potential functions are scalar fields in units of energy [Nm]. Their gradients are forces [N]. The gains
The attractive potential combines a quadratic near the goal (for smooth convergence) with a conical far from the goal (for a constant-magnitude pull that avoids high velocities). The transition occurs at distance
The gradient gives the attractive force directed toward the goal:
| Symbol | Description | Units |
|---|---|---|
| Attractive gain | Ns/m | |
| Goal pose | ||
| Euclidean distance from current pose to goal | m | |
| Threshold distance between quadratic and conical regimes | m |
Implementation note: The conical branch is currently disabled in
computeAttractiveForceLinear(pfield.cpp). The function returns the pure quadratic force$-\zeta(q - q_{goal})$ at all distances, because the conical branch was observed to cause oscillations. As a result,$\Gamma$ has no effect at runtime. See Issue #44 for the ongoing investigation.
Let
The attractive rotational torque is proportional to the geodesic angle, applied only when
| Symbol | Description | Units |
|---|---|---|
| Rotational attractive gain | Ns/rad | |
| Geodesic angle between current and goal orientations | rad | |
| Unit rotation axis from |
Repulsion increases with proximity to each obstacle and is zero beyond the influence distance
This is summed over all obstacles in the environment.
| Symbol | Description | Units |
|---|---|---|
| Repulsive gain | Ns/m | |
| Influence distance (repulsion is zero beyond this) | m | |
| Signed distance from the query point to the obstacle surface | m | |
| Outward unit normal of the obstacle surface at the closest point |
The total potential is the sum of attractive and all repulsive contributions. Its negative gradient gives the net force, which is combined with the rotational torque to form the wrench, then mapped to a twist:
A local minimum occurs when the attractive and repulsive forces exactly cancel, causing the planner to stall, most commonly when the robot is directly between a goal and an obstacle. To reduce sticking, the planner strips the repulsive component that directly opposes the attractive direction while keeping tangential components that encourage the robot to slide around the obstacle:
The
This library supports two planning methods with different trade-offs between computational cost and collision-avoidance coverage. Both follow the same conceptual strategy: at each step, evaluate the potential field, convert the gradient to a velocity, and integrate to advance the robot's state. The planner stops when the robot reaches the goal within a positional tolerance.
Forces and torques are evaluated at the end-effector in Cartesian space. The resulting twist is integrated directly in task space, and IK solves for the joint configuration at each waypoint.
Best suited for: uncluttered environments where precise end-effector path control matters more than link-level collision avoidance.
Steps:
- Wrench: sum attractive and repulsive contributions at the end-effector:
- Twist: apply admittance gains:
- Integrate: advance the end-effector pose with RK4 (see RK4 Integration):
Rather than a simple Euler step, the planner uses a constrained RK4 scheme for better accuracy and stability. Each of the four stages evaluates a constrained twist at an intermediate pose, applies velocity and acceleration limits, then the four stages are averaged for the final update.
Given current pose $q_i = (\mathbf{x}_i, \mathbf{R}i)$, previous applied twist $T{i-1}$, and step size
Stage 1: evaluate at the current pose: $$ \mathbf{k}1 = T_c\big(q_i,, T{i-1},, \Delta t\big), \qquad q_{i}^{(1/2)} = \Big(\mathbf{x}_i + \tfrac{\Delta t}{2}\mathbf{v}_1,; \mathbf{R}_i\exp!\big([\boldsymbol{\omega}1]\times \tfrac{\Delta t}{2}\big)\Big) $$
Stage 2: evaluate at the half-step pose from stage 1: $$ \mathbf{k}2 = T_c\big(q{i}^{(1/2)},, \mathbf{k}1,, \tfrac{\Delta t}{2}\big), \qquad q{i}^{(1/2)'} = \Big(\mathbf{x}_i + \tfrac{\Delta t}{2}\mathbf{v}_2,; \mathbf{R}_i\exp!\big([\boldsymbol{\omega}2]\times \tfrac{\Delta t}{2}\big)\Big) $$
Stage 3: evaluate at the half-step pose from stage 2: $$ \mathbf{k}3 = T_c\big(q{i}^{(1/2)'},, \mathbf{k}2,, \tfrac{\Delta t}{2}\big), \qquad q{i}^{(1)} = \Big(\mathbf{x}_i + \Delta t,\mathbf{v}_3,; \mathbf{R}_i\exp!\big([\boldsymbol{\omega}3]\times \Delta t\big)\Big) $$
Stage 4: evaluate at the full-step pose from stage 3: $$ \mathbf{k}4 = T_c\big(q{i}^{(1)},, \mathbf{k}_3,, \Delta t\big) $$
Weighted average of the four stage twists: $$ \bar{\mathbf{v}} = \frac{\mathbf{v}_1 + 2\mathbf{v}_2 + 2\mathbf{v}_3 + \mathbf{v}_4}{6}, \qquad \bar{\boldsymbol{\omega}} = \frac{\boldsymbol{\omega}_1 + 2\boldsymbol{\omega}_2 + 2\boldsymbol{\omega}_3 + \boldsymbol{\omega}_4}{6} $$
The averaged twist is re-limited (soft saturation and rate limits) before the final pose update: $$ \mathbf{x}_{i+1} = \mathbf{x}i + \bar{\mathbf{v}},\Delta t, \qquad \mathbf{R}{i+1} = \mathbf{R}i;\exp!\big([\bar{\boldsymbol{\omega}}]\times,\Delta t\big) $$
where
| Symbol | Description | Units |
|---|---|---|
| Constrained twist function: applies local-minima filtering, maps wrench to twist, enforces velocity and acceleration limits | ||
| Skew-symmetric matrix of |
||
| Integration timestep | s |
Note: Per-stage rate limits use the stage's effective step size (
$\Delta t$ for stages 1 and 4,$\Delta t/2$ for stages 2–3). After averaging, constraints are applied once more before the final integration step.
Before integrating each twist, linear and angular velocities are constrained in two passes:
Soft saturation: smoothly caps a vector's norm to
When
Rate limiting: bounds the change from the previous vector $\mathbf{v}{prev}$ to the current target by a maximum step $\Delta{max}$ (derived from acceleration limits over
Soft saturation is re-applied after rate limiting to ensure the final vector satisfies both constraints.
| Symbol | Description | Units |
|---|---|---|
| Maximum linear speed | m/s | |
| Maximum angular speed | rad/s | |
| Soft-saturation steepness parameter | ||
| Maximum allowed velocity change per step (acceleration limit |
m/s |
This method extends potential field planning to the full robot body by placing repulsive control points on every link, not just the end-effector. The approach follows §4.7.2–4.7.3 of Choset et al. [2].
Best suited for: cluttered environments where links and elbows risk colliding with obstacles. Every link of the arm contributes a repulsive force, so the robot naturally folds or repositions itself while driving the end-effector toward the goal.
Potential functions are easiest to define in the workspace (
A workspace force
Rather than integrating forces over the robot's volume, a finite set of control points
Floating control point: Fixed points at link origins or vertices may miss the true closest approach between a link and an obstacle. For example, the midpoint of a long link edge can be far closer to an obstacle than either endpoint. The textbook therefore introduces a floating control point
In this implementation, each link is approximated as a capsule fitted to the URDF mesh via PCA. The capsule's two endcap centers and shaft midpoint are the fixed candidate control points per link. For each link–obstacle pair, the candidate with the smallest clearance is selected as the floating control point, giving a smooth and geometrically tight clearance estimate as the configuration changes.
For control point
| Symbol | Description | Units |
|---|---|---|
| Control point |
||
| Shortest distance from control point |
m | |
| Influence distance for obstacle |
m | |
| Repulsive gain for control point |
Ns/m | |
| Outward unit normal of obstacle |
The total generalized force is the sum of end-effector attraction and whole-body repulsion, accumulated over all links and all obstacles. Crucially, this summation happens in configuration space, summing workspace forces directly would be incorrect because the same workspace force has different joint-torque implications depending on which link it acts on.
| Symbol | Description | Units |
|---|---|---|
| Jacobian at the end-effector | ||
| Attractive force toward the goal, evaluated at the end-effector | N | |
| Jacobian evaluated at the floating control point on link |
The total configuration space force
| Symbol | Description | Units |
|---|---|---|
| Admittance gain (scales configuration-space force to joint velocity) | ||
| Joint velocity vector | rad/s |
Note: The admittance mapping
$\dot{\mathbf{q}} = k_{\text{adm}},u(q)$ can be replaced by the full robot dynamics equation (using the mass matrix and Coriolis terms) for more physically accurate joint velocity commands (see Issue #23).
[1] Real-Time Obstacle Avoidance for Manipulators and Mobile Robots
O. Khatib, "Real-time obstacle avoidance for manipulators and mobile robots," in Proc. 1985 IEEE Int. Conf. Robotics and Automation, vol. 2, pp. 500–505, 1985, doi: 10.1109/ROBOT.1985.1087247.
[2] Principles of Robot Motion: Theory, Algorithms, and Implementations
H. Choset, K. M. Lynch, S. Hutchinson, G. A. Kantor, W. Burgard, L. E. Kavraki, and S. Thrun, Principles of Robot Motion: Theory, Algorithms, and Implementations. Cambridge, MA: MIT Press, 2005.