# Open-Loop Model-Based Control for Actuated Mass-Spring-Damper Systems

## Background

In mechanical motion control, overshooting – leading to damped oscillations (sometimes called ringing) – is a common phenomenon that can be caused by springiness and flexing of motion components. This phenomenon can be modeled using mass-spring-damper mechanics.

A simple model illustrating the phenomenon is represented by figure 1. We see that every time the motion changes, the end effector will initially lag behind the commanded position. The lag results in a spring force that pulls the end effector towards the target, causing overshooting and oscillation.

We can model this as follows. Two forces act on the end effector: a spring force with a magnitude determined by the difference between the commanded position and the actual position , and a damping force with a magnitude determined by the end effector velocity .

where is the spring function and the damping function. For simplicity, we can often model these as linear functions,

with being the spring constant and the damping coefficient.

## A Model-Based Control Method

Given the above model, could we devise a control strategy to make the end effector more closely follow the target profile? One key insight is that the end effector can be treated as an inertial mass in space, with its position and velocity affected only by the external forces acting on it. These external forces are exactly the spring and damping forces from the equations above. So if we knew the mass, current position and current velocity of the end effector, we could calculate the exact resultant force required to keep the end effector following a commanded motion profile. If we further knew the damping parameters of the system, we could calculate the current damping force. The difference between the resultant force and the damping force is the additional force that we’d need to add to keep the end effector following its target motion profile.

The second key insight is that we can directly create this force by adding tension to the spring in the system by commanding the end effector to a position away from its current desired position. To calculate the required displacement, , for a given target spring force, , we’d need to know the system’s spring function, , or rather its inverse, . For a linear spring, the equation is simply , where is the spring constant from above.

Assuming that we have a way of estimating the system mass, spring and damping parameters, how do we determine the exact position and velocity of the end effector that we need to realize this? The final insight is that we actually don’t need to directly measure these quantities. We can instead optimistically assume that we already have a perfect control system where the end effector position and velocity are exactly what we command them to be. As will be demonstrated later, this assumption is in fact robust to minor modeling errors. The system is naturally integrating and on average the set point and actual position will be the same.

So we start by making the optimistic assumption that the end effector is at the desired location , following the desired velocity and acceleration . We can then calculate the damping force . From Newtonian physics we know that , and subtracting the damping force gives the required spring force . This force can now be realized by adding an offset to the commanded position , where .

Assuming linear spring and damper models, we can write the equations as follows.

Expanding the equation for the displacement gives

We can further eliminate the mass by performing the following substitutions.

where is the undamped natural angular frequency (radians/s) and is the damping ratio (ranging from being fully undamped through being underdamped (i.e. overshooting), critically damped, and overdamped). The angular frequency can further be converted to the ordinary *undamped natural frequency* (Hz) by

With this, we get the following simple equation for the displacement with the model parameters and

(1)

or as parametrized by the undamped natural frequency and the damping ratio

(2)

Figure 2 shows the effect of plugging this displacement term into the control signal of the original simulation.

## Sensitivity Analysis

The simulation in figure 2 assumes that we know the system parameters perfectly. In reality there will always be a modeling error. Figure 3 shows the result of simulating a 5% modeling error of the natural frequency and a 10% modeling error of the damping factor . Even though some overshooting is now present, the system still behaves substantially better than the uncorrected system in figure 1 indicating some robustness to modeling errors. Figure 4 further shows the sensitivity to incorrectly estimated modeling parameters.

## Parameter Estimation

The green curve in figure 4 shows the estimation sensitivity to errors in when we assume . Here it’s worth noting that the optimal value for is independent of the estimate of . This allows for a simple strategy to estimate the parameters sequentially when is small. Starting with setting to zero, we can sweep across , pick the value that minimizes the overshoot error, and follow that by sweeping across values until the true minimum is found. Once this is done, the estimation process can optionally be repeated once, since the sensitivity to should have increased substantially providing for a more accurate estimation the second round.

## Limitations

In all examples above, the target profile is -continuous, meaning that it has a continuous acceleration profile . A discontinuous acceleration profile would create a step change in the correction term (see eq. 1–2) which in many systems is not physically possible. More generally, constraints on the setpoint dynamics will constrain the possible target profile. For example if the setpoint is limited by a maximum change rate or speed (), it would impose a limit on the magnitude of the target profile’s third derivative (“jerk”) .

For systems where a continuous acceleration profile () isn’t desired or possible and an instantaneous change of the setpoint is also not possible, we can’t perfectly satisfy the requirements of the correction model. We can however approximate the target profile by introducing a constrained profile designed to follow as close as possible while satisfying a specified maximum speed limit. In its simplest form we can simply let lag behind any time there is a commanded instantaneous position change, while moving to catch up as fast as possible within the given speed limits. Figure 5 shows an example simulation of this where the maximum setpoint speed is set to be 2 times the maximum speed of the end effector motion profile . While this doesn’t perfectly eliminate the ringing, it still offers a substantial suppression compared to the uncompensated case. It should be noted though that this is from an ideal simulation. In real-life applications discontinuous acceleration profiles will lead to highly varying correction signals and these may have a significant risk of exposing additional modeling errors.

## Extensions

The approach described above can easily be extended to different and more complex models with for example non-linear springs and other damper dynamics. Serially chained articulated structures can straightforwardly be modeled by compounding multiple spring-damper systems, but the continuity requirements would also compound, meaning that a compounded system with spring-dampers would require a -continuous target profile for a continuous control signal. Parallel structures can often be modeled independently without a compounding continuity constraint. Even though all examples above show underdamped system , the approach can also be applied to overdamped systems .

## RGT says:

Thank you for the clear descriptions and awesome images.

Does this mean that 8-bit boards could have resonance compensation using GCode?

## Oskar Linde says:

For an 8-bit board you probably want to run a pre-processor for most of the calculations. You can probably approximate with with a simpler impulse-based correction too.