The yarn vibration causes the yarn tension value to fluctuate, causing a change in the amount of yarn feed, thus causing a deviation of the carpet pile height from the predetermined value. To solve this problem, the sliding mode control algorithm is used to design the sliding mode function and the sliding mode control law. And four variables in the yarn vibration system are controlled by the MATLAB software. For solving the chattering problem of the control law, the sliding mode control law is improved. The fuzzy sliding mode control algorithm based on the quasisliding mode is adopted. The results show that the sliding mode control algorithm is effective, but the sliding mode control force needs to be switched at high frequency and there is severe chattering. The fuzzy sliding mode control algorithm based on quasisliding mode is adopted to achieve better control effect with a smaller force. In addition, the control force does not have high‐frequency switching, and the change is relatively stable, which reduces the chattering phenomenon of sliding mode control.