Q:

Square shaped position error

I got a position error measured by a linear encoder like in the picture below.

Could anyone explain some possible reasons for this kind of shape to occur in control theory?
My system looks like table with four legs.
The four legs move up and down by using motors and have a linear encoder as control reference.
The table should stay in its position after moving up.
The four servo motors actuating the four legs control the position by using linear encoder signals, respectively.
But after moving the table up around 10 mm ~ 20 mm, a strange symptom has happened. One or two encoder signals look like square waves (sometimes one encoder signal, sometimes two, sometimes none).
A simple setup diagram is as below.

A:

Your system is not reaching the target value. Possibly this is due to static friction in the actuator mechanism, which causes it not to move until the force exceeds some threshold.
Assuming you are using a PID controller, the residual error will cause the I error term to accumulate slowly. This will cause the actuator force to increase until it is enough to cause actual movement. It seems that this movement will cause a small jerk, which will move the table further than intended and cause opposite error value.
The way you can test this is to change the target height in small steps (e.g. 1 µm) and see what is the smallest distance you can reliably move. You can then either choose to improve the actuator, or to set this as the deadband value in your controller.

