# Singularity error encountered when calculating inverse dynamics of a elastic joint.

1 view (last 30 days)
Ryan Zhang on 9 Sep 2021
Answered: Steve Miller on 4 Oct 2021
Hi all,
I built a model of a robot joint with torsional elasticity connecting a rigid beam in simscape multibody. In the model, I used 2 revolute joints to act as the 2 rotational degrees of motor and torsional elasticity, which are coaxial, just like the real physical model. When the motor joint is supplied with actuation，ie. calculating the forward kinematics and dynamics, the simulation runs well.
But a singularity error occurred when I tried to calculate the inverse dynamics. I set the motor joint's 2 actuation items both as automatically calculated, the elastic joint's actuation torque as none and motion as auto, provided desired motion to the beam's end tip. In such a case, the inverse dynamics model has one unique solution in the real physical model if the initial condition is set, and the solution also exists in other simulation environment like Modelica. However, in the simscape multibody, the inverse dynamics cannot be calculated. I guess it's because the inverse kinematics is calculated first and singularity problem occurred.
So is there any way to calculate the inverse dynamics of the above model? After all, the joint elasticity is a important property to the robot model, especially in some high speed motion control problems. Thanks a lot!
The model I built and error message can be seen as below, the .slx file is also attached. Ryan Zhang on 22 Sep 2021
Hi @Steve Miller, is there any way to solve such singularity problems of inverse dynamics calculation of coaxial joints in Simscape? Is it possible to get the inverse dynamics calculated by write a user-defined torsional spring block? Or is there a inverse model block, which can exchange the inputs and outputs of a model, just like in Modelica?
Thanks very much.

J Chen on 13 Sep 2021
Probably better to specify the desired angle at the output port (F port) of the Torsional elastiticity & damping block. You can add a revolute joint between the F port and the ground through a Rigid Transformation block. In additional, the Actuation tab for the Motor block need to be changed to Torque-None and Motion-Automatically Computeed.
Ryan Zhang on 15 Sep 2021
Thanks for the suggestion .
But I Tried to set the actuation tabs of both revolute joints to Torque-None, then an error of "lacking joint degree of freedom with auto computed force" occured as below, Like I said to Steve, If I comment out the "Torsional elasticity & damping" joint, and keep the actuation tab of Motor block to be Torque-Auto and Motion-Auto, the model runs perfectly.

Steve Miller on 4 Oct 2021
Hi Ryan,
The model as provided was missing the stiffness and damping in the Internal Mechanics settings of the Torsional elasicity & damping block. Setting those to non-zero values is critical to having a valid model.
I adjusted the model to use an ideal actuator on the motor and put in a PID controller to set the torque so that the output angle would match the target.
I did not find a way to calculate the solution the way you wanted to do it. Only one angle is provided (output angle) but two angles are unknown (motor angle, flexible shaft angle) and no initial velocities were provided. It may be if you specify more of the initial state consistently (initial velocities of the motor and flexible shaft) that you may get the answer you're looking for.
--Steve

R2020a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!