How to reduce oscillations (rapid changes of control signal) when controlling a real system, which occur due to noise in measurement from sensors?

I have a real mechanical system (ball & beam) which I want to control. The system is approximated by the second order transfer function:

$$T(s) = \frac{b_0}{s^2+a_1s+a_2}$$

and in state-space form:

$$\dot{x_1} = x_2$$ $$\dot{x_2} = -a_1x_2-a_2x_2+b_0u$$

where the parameters $$\ b_0,a_1,a_2$$ have been identified, so they are known. I have designed two controllers. The first one is a full state feedback controller described by the equation:

$$u = -Kx+k_rr$$

where the term $$\ k_rr$$ is because I want input reference $$\ (r)$$ tracking. The other controller is a dynamic state feedback controller desctibed by the equations:

$$u = -Kx-k_iz$$ $$\dot{z} = x_1-r$$

Both controllers are doing well but the only problem I have is when the ball reaches the reference point there is a bit of oscillation of the system (the beam oscillates) in order to keep the ball at the desired point. I have found out that the oscillations occur due to the measurement of the ball's position and not because of the gains of the controllers because this happens even if I make these gains smaller. The sensor used to measure the ball's position on the beam is a linear potentiometer and it appears that the measurements include some unwanted noise which results to rapid changes of the control signal which leads to the oscillations. I have tried to reduce the noise by using a low pass filter with the below transfer function:

$$F(s) = \frac{15}{s+15}$$

The block diagram of the control loop is:

The oscillations have been reduced but not achieved a satisfactory level. Is there any way to modify these controllers in a way to affect these oscillations and reduce them ? Would a PID-controller perform better due to the existence of the derivative of the error ? Or should I design a better filter for the noise reduction which should also be fast (because the system is functioning in real time) enough ?

I place some plots for two different cases (PD-controller gains) where the actual position (output) is shown compared to the reference and the control signal. Note that the sudden changes to the real system's output are due to external disturbances I apply in order to check if the system goes back to the reference.

• First Case ($$\ K_p = 3.9352$$ & $$\ K_d = 2.248$$):

• Second Case ($$\ K_p = 2.3536$$ & $$\ K_d = 1.6423$$):

• Try a higher order lowpass filter. – useless-machine Mar 13 at 23:39
• You probably need an analog low pass filter to condition your sensor output before you digitize it. (Of course that can be as simple as a passive RC circuit) – alephzero Mar 14 at 1:33
• @alephzero Generally hardware is fixed. However, I tried implementing such a filter somewhere I could intervene but nothing changed. Thanks, anyway! – Teo Protoulis Mar 15 at 13:44
• Can you post any plots? A time history of the sensor reading? time history of the control effort at various gains? a block diagram of where in the loop you are putting your low pass filter? that might help you get better answers. – Daniel K Mar 16 at 10:59

Your current filter has a -3 dB reduction at 15 rad/s (~2.4 Hz) and decreases with a -1 slope every decade. This means that at 150 rad/s (~24 Hz) the amplification is still -10 dB (factor 0.1), which is not that much. Therefore you could change the order of the filter, e.g. $$F(s)=\frac{1}{(\tau\cdot s + 1)^n}$$ with $$\tau = \frac{1}{15}$$ and $$n$$ the desired order.