## 1 Introduction  
Servo drive systems are widely used from household appliances to industrial automatic facilities. Permanent magnet synchronous motors (PMSMs) especially play a key role in servo drive systems due to their high performance. Permanent magnets in PMSMs are adopted to provide the required air gap flux density with advantages such as high starting torque, high efficiency, and high power density. However, permanent magnets might cause reluctance variations in the air gap as rotation, and hence generate a periodic reluctance torque ripple called \"cogging torque\", which is a function of rotor position [1]. As a torque disturbance, the cogging torque may degrade the speed control performance in low speed and would undoubtedly limit the operational range of a PMSM.  
It can be found from the literature that there are two kinds of methods to reduce the cogging torque effect. The first one comes from the design of the machine itself. By reducing the reluctance variance between the slots and teeth [2; 3], or by skewing the rotor and stator to distract reluctance variance [4; 5], the cogging torque can be reduced effectively. However, altering the physical structure of a PMSM might be expensive and tedious, or degrade the motor performance. The other well-known approach is using control methods.  
As for the control methods, to achieve appropriate torque disturbance rejection, the method for accurate cogging torque estimation is critical. The MRDOB (model reference disturbance observer),originally from the Luenburger observer [6], can achieve flexible and instantaneous estimation. However, the lack of an internal model [7; 8] of the cogging torque in the control loop will limit the estimation performance of the observer in practice. From the literature, the PBRC (position-based repetitive controller) (i.e., spatial-based or angle-based) [9] can be employed as an internal model of the cogging torque in observer design. As shown in Figure 1, this paper combines the design of MRDOB and PBRC as a novel speed and torque observer to achieve accurate disturbance estimation. Based on the estimated torque, both online and offline compensation strategies are proposed for the suppression of cogging torque disturbance, which deteriorates the speed control accuracy, especially at low speed. The online compensation strategy is based on real-time spatial lookup table estimation, which is suitable to overcome the problem caused by the dynamic change of permanent magnets, such as predictive maintenance, fault detection, or the measurement of permanent magnets. Whereas, the offline strategy is used for applications in which permanent magnets is assumed to be static, and a fixed spatial lookup table is used to compensate cogging torque directly according to the rotor position.  
To clarify the design concept and implement details, the content of this paper is organized as follows. Section 2 will introduce the detail design and principle of proposed observer. Then, the practical realization process is specified. Two torque compensation structures are proposed: the online torque compensation with a spatial lookup table learning structure and the offline torque compensation structure by a fixed spatial lookup table. In Section 3, a HIL (Hardware-in-the-Loop) experiment is firstly used to evaluate the feasibility of the proposed observer and compensation strategies by an ideal emulation motor model, and afterwards, a practical experiment with real motor and dynamometer is conducted to verify the HIL experiment. Finally, Section 4 concludes the contributions in this paper and issues that needed to be handled in the future.