# Impedance control

Impedance control is an approach to dynamic control relating force and position. It is often used in applications where a manipulator interacts with its environment and the force position relation is of concern. Examples of such applications include humans interacting with robots, where the force produced by the human relates to how fast the robot should move/stop. Simpler control methods, such as position control or torque control, perform poorly when the manipulator experiences contacts. Thus impedance control is commonly used in these settings.
Mechanical impedance is the ratio of force output to velocity input. This is analogous to electrical impedance, that is the ratio of voltage output to current input (e.g. resistance is voltage divided by current). A "spring constant" defines the force output for a displacement (extension or compression) of the spring. A "damping constant" defines the force output for a velocity input. If we control the impedance of a mechanism, we are controlling the force of resistance to external motions that are imposed by the environment.
Mechanical admittance is the inverse of impedance - it defines the motions that result from a force input. If a mechanism applies a force to the environment, the environment will move, or not move, depending on its properties and the force applied. For example, a marble sitting on a table will react very differently to a given force than will a log floating in a lake.
The key theory behind the method is to treat the environment as an admittance and the manipulator as an impedance. It assumes the postulate that "no controller can make the manipulator appear to the environment as anything other than a physical system." This rule of thumb can also be stated as: "in the most common case in which the environment is an admittance (e.g. a mass, possibly kinematically constrained) that relation should be an impedance, a function, possibly nonlinear, dynamic, or even discontinuous, specifying the force produced in response to a motion imposed by the environment."

## Principle

Impedance control doesn't simply regulate the force or position of a mechanism. Instead it regulates the relationship between force and position on the one hand, and velocity and acceleration on the other hand, i.e. the impedance of the mechanism. It requires a position (velocity or acceleration) as input and has a resulting force as output. The inverse of impedance is admittance. It imposes position. So actually the controller imposes a spring-mass-damper behavior on the mechanism by maintaining a dynamic relationship between force $({\boldsymbol {F}})$ and position, velocity and acceleration $({\boldsymbol {x}},{\boldsymbol {v}},{\boldsymbol {a}})$: ${\boldsymbol {F}}=M{\boldsymbol {a}}+C{\boldsymbol {v}}+K{\boldsymbol {x}}+{\boldsymbol {f}}+{\boldsymbol {s}}$, with ${\boldsymbol {f}}$ being friction and ${\boldsymbol {s}}$ being static force.
Masses ($M$) and springs (with stiffness $K$) are energy storing elements, whereas a damper (with damping $C$) is an energy dissipating device. If we can control impedance, we are able to control energy exchange during interaction, i.e. the work being done. So impedance control is interaction control.
Note that mechanical systems are inherently multi-dimensional - a typical robot arm can place an object in three dimensions ($(x,y,z)$ coordinates) and in three orientations (e.g. roll, pitch, yaw). In theory, an impedance controller can cause the mechanism to exhibit a multi-dimensional mechanical impedance. For example, the mechanism might act very stiff along one axis and very compliant along another. By compensating for the kinematics and inertias of the mechanism, we can orient those axes arbitrarily and in various coordinate systems. For example, we might cause a robotic part holder to be very stiff tangentially to a grinding wheel, while being very compliant (controlling force with little concern for position) in the radial axis of the wheel.

## Mathematical basics
### Joint space

An uncontrolled robot can be expressed in Lagrangian formulation as
| ${\boldsymbol {\tau }}={\boldsymbol {M}}({\boldsymbol {q}}){\ddot {\boldsymbol {q}}}+{\boldsymbol {c}}({\boldsymbol {q}},{\dot {\boldsymbol {q}}})+{\boldsymbol {g}}({\boldsymbol {q}})+{\boldsymbol {h}}({\boldsymbol {q}},{\dot {\boldsymbol {q}}})+{\boldsymbol {\tau }}_{\mathrm {ext} }$, | (1) |
where ${\boldsymbol {q}}$ denotes joint angular position, ${\boldsymbol {M}}$ is the symmetric and positive-definite inertia matrix, ${\boldsymbol {c}}$ the Coriolis and centrifugal torque, ${\boldsymbol {g}}$ the gravitational torque, ${\boldsymbol {h}}$ includes further torques from, e.g., inherent stiffness, friction, etc., and ${\boldsymbol {\tau }}_{\mathrm {ext} }$ summarizes all the external forces from the environment. The actuation torque ${\boldsymbol {\tau }}$ on the left side is the input variable to the robot.
One may propose a control law of the following form:
| ${\boldsymbol {\tau }}={\boldsymbol {K}}({\boldsymbol {q}}_{\mathrm {d} }-{\boldsymbol {q}})+{\boldsymbol {D}}({\dot {\boldsymbol {q}}}_{\mathrm {d} }-{\dot {\boldsymbol {q}}})+{\hat {\boldsymbol {M}}}({\boldsymbol {q}}){\ddot {\boldsymbol {q}}}_{\mathrm {d} }+{\hat {\boldsymbol {c}}}({\boldsymbol {q}},{\dot {\boldsymbol {q}}})+{\hat {\boldsymbol {g}}}({\boldsymbol {q}})+{\hat {\boldsymbol {h}}}({\boldsymbol {q}},{\dot {\boldsymbol {q}}}),$ | (2) |
where ${\boldsymbol {q}}_{\mathrm {d} }$ denotes the desired joint angular position, ${\boldsymbol {K}}$ and ${\boldsymbol {D}}$ are the control parameters, and ${\hat {\boldsymbol {M}}}$, ${\hat {\boldsymbol {c}}}$, ${\hat {\boldsymbol {g}}}$, and ${\hat {\boldsymbol {h}}}$ are the internal model of the corresponding mechanical terms.
Inserting (2) into (1) gives an equation of the closed-loop system (controlled robot):
${\boldsymbol {K}}({\boldsymbol {q}}_{\mathrm {d} }-{\boldsymbol {q}})+{\boldsymbol {D}}({\dot {\boldsymbol {q}}}_{\mathrm {d} }-{\dot {\boldsymbol {q}}})+{\boldsymbol {M}}({\boldsymbol {q}})({\ddot {\boldsymbol {q}}}_{\mathrm {d} }-{\ddot {\boldsymbol {q}}})={\boldsymbol {\tau }}_{\mathrm {ext} }.$
Let ${\boldsymbol {e}}={\boldsymbol {q}}_{\mathrm {d} }-{\boldsymbol {q}}$, one obtains
${\boldsymbol {K}}{\boldsymbol {e}}+{\boldsymbol {D}}{\dot {\boldsymbol {e}}}+{\boldsymbol {M}}{\ddot {\boldsymbol {e}}}={\boldsymbol {\tau }}_{\mathrm {ext} }$
Since the matrices ${\boldsymbol {K}}$ and ${\boldsymbol {D}}$ have the dimension of stiffness and damping, they are commonly referred to as stiffness and damping matrix, respectively. Clearly, the controlled robot is essentially a multi-dimensional mechanical impedance (mass-spring-damper) to the environment, which is addressed by ${\boldsymbol {\tau }}_{\mathrm {ext} }$.

### Task space

The same principle also applies to task space. An uncontrolled robot has the following task-space representation in Lagrangian formulation:
${\boldsymbol {\mathcal {F}}}={\boldsymbol {\Lambda }}({\boldsymbol {q}}){\ddot {\boldsymbol {x}}}+{\boldsymbol {\mu }}({\boldsymbol {x}},{\dot {\boldsymbol {x}}})+{\boldsymbol {\gamma }}({\boldsymbol {q}})+{\boldsymbol {\eta }}({\boldsymbol {q}},{\dot {\boldsymbol {q}}})+{\boldsymbol {\mathcal {F}}}_{\mathrm {ext} }$,
where ${\boldsymbol {q}}$ denotes joint angular position, ${\boldsymbol {x}}$ task-space position, ${\boldsymbol {\Lambda }}$ the symmetric and positive-definite task-space inertia matrix. The terms ${\boldsymbol {\mu }}$, ${\boldsymbol {\gamma }}$, ${\boldsymbol {\eta }}$, and ${\boldsymbol {\mathcal {F}}}_{\mathrm {ext} }$ are the generalized force of the Coriolis and centrifugal term, the gravitation, further nonlinear terms, and environmental contacts. Note that this representation only applies to robots with redundant kinematics. The generalized force ${\boldsymbol {\mathcal {F}}}$ on the left side corresponds to the input torque of the robot.
Analogously, one may propose the following control law:
${\boldsymbol {\mathcal {F}}}={\boldsymbol {K}}_{\mathrm {x} }({\boldsymbol {x}}_{\mathrm {d} }-{\boldsymbol {x}})+{\boldsymbol {D}}_{\mathrm {x} }({\dot {\boldsymbol {x}}}_{\mathrm {d} }-{\dot {\boldsymbol {x}}})+{\hat {\boldsymbol {\Lambda }}}({\boldsymbol {q}}){\ddot {\boldsymbol {x}}}_{\mathrm {d} }+{\hat {\boldsymbol {\mu }}}({\boldsymbol {q}},{\dot {\boldsymbol {q}}})+{\hat {\boldsymbol {\gamma }}}({\boldsymbol {q}})+{\hat {\boldsymbol {\eta }}}({\boldsymbol {q}},{\dot {\boldsymbol {q}}}),$
where ${\boldsymbol {x}}_{\mathrm {d} }$ denotes the desired task-space position, ${\boldsymbol {K}}_{\mathrm {x} }$ and ${\boldsymbol {D}}_{\mathrm {x} }$ are the task-space stiffness and damping matrices, and ${\hat {\boldsymbol {\Lambda }}}$, ${\hat {\boldsymbol {\mu }}}$, ${\hat {\boldsymbol {\gamma }}}$, and ${\hat {\boldsymbol {\eta }}}$ are the internal model of the corresponding mechanical terms.
Similarly, one has
${\boldsymbol {e}}_{\mathrm {x} }={\boldsymbol {x}}_{\mathrm {d} }-{\boldsymbol {x}}$,
| ${\boldsymbol {K}}_{\mathrm {x} }{\boldsymbol {e}}_{\mathrm {x} }+{\boldsymbol {D}}_{\mathrm {x} }{\dot {\boldsymbol {e}}}_{\mathrm {x} }+{\boldsymbol {\Lambda }}{\ddot {\boldsymbol {e}}}_{\mathrm {x} }={\boldsymbol {\mathcal {F}}}_{\mathrm {ext} }$ | (3) |
as the closed-loop system, which is essentially a multi-dimensional mechanical impedance to the environment (${\boldsymbol {\mathcal {F}}}_{\mathrm {ext} }$) as well. Thus, one can choose desired impedance (mainly stiffness) in the task space. For example, one may want to make the controlled robot act very stiff along one direction while relatively compliant along others by setting
${\boldsymbol {K}}_{\mathrm {x} }={\begin{pmatrix}1&0&0\\0&1&0\\0&0&1000\end{pmatrix}}\mathrm {N/m} ,$
assuming the task space is a three-dimensional Euclidean space. The damping matrix ${\boldsymbol {D}}_{\mathrm {x} }$ is usually chosen such that the closed-loop system (3) is stable.

## Applications

Impedance control is used in applications such as robotics as a general strategy to send commands to a robotics arm and end effector that takes into account the non-linear kinematics and dynamics of the object being manipulated.