>[!quote] In a Nutshell
>[[- Robotics, Mechanics and Control -|Feedback]] controllers that use a control input based on linear combination of system state errors, namely velocity and acceleration. For [[The Inverse Kinematics Problem|control in task space]], the laws may require [[Maps and Induced Structures - Functions, Pushforwards and Pullbacks|mapping]] via the [[Derivative, Gradient, Jacobian and Hessian|Jacobian]].
|**Controller**|**Pros**|**Cons**|
|---|---|---|
|**P-Controller**|Simple, fast response, low computational cost|Oscillations, steady-state error, lacks robustness|
|**PD-Controller**|Reduced oscillations, improved stability, faster settling|Steady-state error, sensitive to noise, difficult to tune|
|**PD-Controller with Gravity Compensation**|Gravity compensation reduces load on actuators, better stability|Requires accurate model, possible high gains and stiffness, complex|
|**PID-Controller**|Eliminates steady-state error, robust, good for steady-state systems|Risk of integral wind-up, slower|
---
#### **P-Controller**
>[!info] Proportional Controller
>Adjusts the control input based only on the **position error** (the difference between the desired and actual positions).$\mathbf{u}_t = \mathbf{K}_P (\mathbf{q}_d − \mathbf{q}_t)$Usually suitable for systems with relatively **small inertia and damping or where precision is not critical / external disturbances are minimal**.
>[!adv] Advantages
>- **Simplicity**: Easy to implement and computationally efficient.
>- **Fast Response**: Provides a quick reaction to changes in the desired position.
>- **Low Computational Cost**: No need for complex calculations or state measurements (e.g., velocity).
>[!danger] Disadvantages
>- **Oscillations**: A high KP\mathbf{K}_PKP can lead to overshooting and oscillations, as it does not consider the system's dynamics like velocity or damping.
>- **Steady-State Error**: It cannot eliminate steady-state errors (i.e., the system may never perfectly reach the desired position due to the lack of compensation for constant disturbances or system imperfections).
>- **Lack of Robustness**: It is susceptible to external disturbances, which can lead to sustained error.
---
#### **PD-Controller**
>[!info] Proportional-Derivative Controller
>Extends the **P-Controller** by adding a **derivative term** that is based on the **velocity error**$\mathbf{u}_t = \mathbf{K}_P (\mathbf{q}_d − \mathbf{q}_t ) +\mathbf{K}_D (\mathbf{q̇}_d − \mathbf{q̇}_t ).$The derivative term helps reduce oscillations and improve the system's damping, making it more stable than a P-Controller. Usually suitable for systems with **speed and dynamic response demand**s.
>[!adv] Advantages
>- **Reduced Oscillations**: The derivative term helps smooth the system's response by accounting for the rate of change of the position (velocity), reducing overshoot and oscillations.
>- **Faster Settling Time**: By including velocity feedback, the controller is able to respond to dynamic changes more effectively.
>[!danger] Disadvantages
>- **Steady-State Error**: Like the P-Controller, the PD-Controller does not eliminate **steady-state error**. The system may still be unable to reach the desired position, especially in the presence of external disturbances or constant forces.
>- **Sensitivity to Noise**: The derivative term is sensitive to high-frequency noise, which can cause the controller to react to small, rapid fluctuations in the system's velocity, leading to instability if not properly filtered.
>- **Tuning Complexity**: Finding the correct balance between the $\mathbf{K}_P$ and $\mathbf{K}_D$ gains is crucial for achieving a stable and responsive system.
---
#### PD-Controller with Gravity Compensation
>[!info] **PD-Controller with Gravity Compensation**
>Improves the basic PD controller by adding a compensation term that accounts for the robot's **gravitational forces**, reducing the need for additional torque to counterbalance the weight of the robot$\mathbf{u}_t = \mathbf{K}_P (\mathbf{q}_d − \mathbf{q}_t ) +\mathbf{K}_D (\mathbf{q̇}_d − \mathbf{q̇}_t )+\mathbf{g}(\mathbf{q}).$Suitable for systems with **heavy payloads**.
>[!adv] Advantages
>- **Gravity Compensation**: The inclusion of the gravity compensation term makes the controller capable of handling the robot's weight, reducing the load on the actuators and improving efficiency.
>- **Improved Stability**: With the inclusion of the gravitational term, the robot is better able to maintain stable positions in the presence of gravity, especially for large or heavy robots.
>- **Reduced Actuator Load**: By compensating for the gravitational forces, the controller reduces the need for high torque inputs to maintain the robot's posture.
>[!danger] Disadvantages
>- **Requires Accurate Model**: The compensation term $\mathbf{g}(\mathbf{q})$ requires an accurate model of the robot's dynamics (specifically, its gravitational forces). If the model is inaccurate or incomplete, the controller will not function optimally.
>- **High Gains and Stiffness**: In some cases, small errors in estimating the gravitational forces or system dynamics can require large gains in the controller, making the system stiff and potentially costly to implement.
>- **Complexity**: More complex than a simple PD controller due to the need for precise modeling of the gravitational components.
---
#### PID-Controller
>[!info] Proportional-Integral-Derivative Controller
>Adds integral term to eliminate constant deviation (offset) from the desired position$\mathbf{u} = \mathbf{K}_P (\mathbf{q}_d − \mathbf{q}) + \mathbf{K}_D (\mathbf{q̇}_d − \mathbf{q̇}) + \mathbf{K}_I\int_{- \infty}^{\tau} (\mathbf{q}_d − \mathbf{q}) dτ$Useful for systems that need steady state accuracy, such as CNC machines, industrial robots or temperature regulators or with persistent disturbances such as high friction.
>[!adv] Advantages
>- **Eliminates Steady-State Error**: The integral term ensures that the system will eventually eliminate any persistent error or offset, even in the presence of constant disturbances.
>- **Good for Steady-State Systems**: Very effective in systems that require precise steady-state control, where long-term accuracy is more important than fast transient responses.
>- **Robustness**: Well-suited for systems with unknown or varying dynamics, especially when there is no precise model.
>[!danger] Disadvantages
>- **Risk of Over-Compensation (Wind-Up)**: If the system accumulates too much error in the integral term, it can cause **integral wind-up**, where the control signal becomes excessively large, leading to overshoot and instability.
>- **Slower Response**: The integral action introduces a delay in the system's response because it is based on accumulated error, leading to slower convergence compared to PD controllers.
>- **Difficult to Tune**: Finding the right balance between the proportional, derivative, and integral gains requires careful tuning and can be difficult, especially in non-linear systems.
---
#### Cartesian Control Laws
If we require asymptotic stabilization of the end-effector ($\dot{\mathbf{x}}_{d}=0$ and $\dot{\mathbf{q}}_{d}=0$), we can use an approach based on [[Linear Controllers|linear control]] via $\mathbf{u}=\mathbf{J}^{T}(\mathbf{q})K_{P}(\mathbf{x}_{d}-\mathbf{x})-K_{D}\dot{\mathbf{q}} + \mathbf{g}(\mathbf{q}),$with $K_P,K_D$ [[Matrices|symmetric]].
Alternatively, if the joint velocities aren't available, the all cartesian PD control with gravity compensation can be employed via $\mathbf{u}=\mathbf{J}^{T}(\mathbf{q})[K_{P}(\mathbf{x}_{d}-\mathbf{x})-K_{D}\dot{\mathbf{x}}] + \mathbf{g}(\mathbf{q}),$with $K_P,K_D$ [[Matrices|symmetric]].