# Modeling and Control of a DC Motor Coupled to a Non-Rigid Joint
## 2 Proposed Models
### Control  
Taking into account its use for a robotic manipulator joint, it was then decided to use an motor with a worm gearbox, specifically the JGY-371 one. This motor has a rotary encoder, it is powered at 12 VDC and it was defined that the motor speed would be 20 rpm, which is the best solution for the purpose defined for the project. With this choice, despite the low maximum angular speed of the motor, the joints can benefit from more torque. The issue of the sudden changes in speed can shorten the life of the motor.  
Therefore, the decision of creating an acceleration ramp when the controller activate or deactivate was taken, having the system 3 sub profiles (acceleration, steady state, deceleration). Temporal divisions are called \(t_{0},t_{1},t_{2}\) and \(t_{f}\), dividing areas A, B and C of the profiles. To achieve this, there were created functions for the angular acceleration, velocity and position of the motor shaft. To obtain a smoother velocity ramp, it was decided to go with a profile with cubic function. Having decided this, it was necessary to produce a quadratic function for the angular acceleration, which is described below  
\[\alpha(t)=\begin{cases}-\frac{4\cdot\alpha_{m}}{t_{1}t_{2}}\cdot t\cdot(t-  
\[\omega(t)=\left\{\begin{array}{ll}\frac{2\cdot\alpha_{m}}{t_{1}}\cdot t^{2}- \frac{4}{3}\cdot\frac{\alpha_{m}}{t_{1}^{2}}\cdot t^{3}&\text{if }t_{0}<t<t_{1}\\ \omega_{m}&\text{if }t_{1}<t<t_{2}\\ -\frac{2\cdot\alpha_{m}}{t_{1}}\cdot t^{2}+\frac{4}{3}\cdot\frac{\alpha_{m}}{t _{1}^{2}}\cdot t^{3}&\text{if }t_{2}<t<t_{f}\end{array}\right.\]  
The previous equations represent the intended angular velocity profile. The nomenclature used is also presented in the acceleration equations, with the exception of the \(\omega(t)\) (\(rad/s\)), which represents the angular velocity.  
\[\theta(t)=\left\{\begin{array}{ll}\frac{2}{3}\cdot\frac{\alpha_{m}}{t_{1}} \cdot t^{3}-\frac{\alpha_{m}}{3\cdot{t_{1}}^{2}}\cdot t^{4}&\text{if }t_{0}<t<t_{1}\\ \omega_{m}\cdot t&\text{if }t_{1}<t<t_{2}\\ -\frac{2}{3}\cdot\frac{\alpha_{m}}{t_{1}}\cdot t^{3}+\frac{\alpha_{m}}{3 \cdot{t_{1}}^{2}}\cdot t^{4}&\text{if }t_{2}<t<t_{f}\end{array}\right.\]  
Finally, the equations for calculating the angular position of the motor shaft are presented above, with \(\theta(t)\) representing the angle (rad). Since the velocity profile reaches the wanted \(\omega\) when \(t=t_{1}\), \(\omega_{m}\) can be obtained through the equation  
\[\omega(t_{1})=\omega_{m}=\frac{2\cdot\alpha_{m}\cdot t_{1}}{3}\]  
and the instant \(t_{1}\) can be calculated through the formula presented next  
\[t_{1}=\frac{3}{2}\cdot\frac{\omega_{m}}{\alpha_{m}}\]  
Based on all the mentioned equations, and to become clearer what, theoretically, must be the motor behaviour, the profiles for angular acceleration, velocity and position are presented in Figure 2, in a graphical form. Figure 3 represents the profiles, already after the mentioned functions were implemented in programming, having obtained the graphics that are presented.  
As already mentioned, the controllers to be used will be PID controllers. Thus, in order to validate the developed models, a cascade controller was designed, with the use of a position and a speed controller. It was chosen to only introduce a block of Feed Forward in the latter, and the set was represented in the block diagram in Figure 4.  
Figure 2: Angular Acceleration, Velocity and Position Profiles.