## 2 Mathematical Model of a Drive-Anti-Drive System  
Backlash-free mechanisms ensure smooth running of any manipulator based mechanisms. In this paper, we propose a drive-anti-drive mechanism to compensate for the backlash. The drive-anti-drive mechanism utilizes two drives by applying torques in the opposite directions. Therefore, the controllers are designed to track the reference trajectories for various robotic applications. This mechanism works on the principle of applying torque in the opposite direction to ensure mesh in the gear trains remain intact. Whenever, the drive undergoes change in a direction, anti-drive provides the torque in the opposite direction to compensate for the backlash. The whole assembly is shown in Figure 1.  
The inverted pendulum is driven by dual drives; one of the generated torques in an inverted pendulum occurs under the action of gravity, pulling it downwards. The angular position and angular velocity of the pendulum are taken as state variables. The inverted pendulum is driven by two drives that work in switching modes: they will turn on either the drive or anti-drive. The dynamics of the pendulum are given by  
\[\dot{\theta}_{1}=\omega_{1}\]  
\[\dot{\omega}_{1}=\frac{g\sin\theta_{1}}{l}+\frac{\tau_{2}}{ml^{2}+J_{B}}+\frac {\tau_{s}}{ml^{2}+J_{s}}\]  
The resultant torque on the drive shaft is equal to the difference between the two torques. We can write the dynamics of the drive shaft as follows:  
\[J_{p}\dot{\theta}_{p}=\tau_{p}-\tau_{1}\]  
\[\dot{\theta}_{p}=\omega_{p}\]  
\[\dot{\omega}_{p}=\frac{\tau_{p}}{J_{p}}-\frac{\tau_{1}}{J_{p}}\]  
\[\dot{\omega}_{p}=\frac{\tau_{p}}{J_{p}}-\frac{\tau_{1}}{J_{p}}\]  
where \(\theta_{p}\) and \(\omega_{p}\) are the angular position and angular velocity of the drive motor, respectively. Figure 1: Inverted pendulum driven by the drive–anti-drive mechanism. The driving gear is designated as gear 1, whose angular displacement is given as \(\theta_{1}\). The driven gear is designated as gear 2, whose angular position is given as \(\theta_{p}\). Their operating pitch radii are given as \(r_{1}\) and \(r_{2}\), respectively. The gears are operated in three modes. When the driving gear moves with a slight displacement of rotation and two gears lose contact, then the gears are in backlash. When the driving and driven gears maintain perfect contact, the contact is established. In the contact mode, gears are modeled as a spring and damper system. When two gears come into contact, their teeth engage with each other. During this engagement, the impact forces result in relative motion and contact between the teeth. Therefore, it is modeled as a collision. The spring component represents the stiffness of the material of the gear teeth. When the teeth come into contact and experience an impact force, they deform slightly, analogously to compressing a spring. The stiffness coefficient is denoted as \(\bar{K}\). The larger the stiffness, the lesser the deformation of the spring. The damper component represents the damping action that dissipates energy due to the impact, subjecting to how energy is dissipated when compressing a spring with a shock absorber attached. The damping coefficient, denoted as \(\bar{C}\), is proportional to the relative velocity between the gear teeth. This means that, the faster the relative motion between the teeth, the greater the damping force opposing that motion. By modeling the gear teeth interaction during impact as a spring-mass-damper system, designers can better understand and predict the behavior of gear systems in real systems during collisions and improve their designs for efficiency and durability. Impact torques are described for the three modes as positive, negative, and backlash modes, as defined by [28]. Here, \(p=0\) refers to the positive contact of gears, \(p=1\) refers to backlash mode, and \(p=2\) refers to the negative contact of gears. \[r_{2}= \begin{cases}\bar{K}r_{3}+\bar{C}\dot{r}_{3},&\text{if }p=0\\ 0,&\text{if }p=1\\ \bar{K}r_{4}+\bar{C}\dot{r}_{4},&\text{if }p=2\end{cases}