I made the code of simple pendulum which is moved by trq.
However, depending on the amount of torque, it will continue to rotate.
When the pendulum makes one lap, I want to stop and repeat the control.
In other words, after one lap, it was reset to the initial state [0: 0] and the simulation started again.
Please someone help me.
AngularVelocity_Initial = 0;
Pendulum = classPendulum(Length,Mass,Theta_Initial,AngularVelocity_Initial,Ts);