# massMatrix and inverseDynamics are something wrong....( Am I using wrong?)

16 views (last 30 days)
Sehun Kim on 6 Jun 2020
Edited: Taishin Chung on 10 Jul 2022
I've tested it by simple 2 DOF arm.
Then, I think massMatrix and inverseDynamics have some bugs..
In a 2 DOF arm, massMatrix gave me wrong inertia matrix...
(each length 1 [m], CoM : 0.5 [m], I = 0....... dynamics equations are already provided in the robotics textbook.)
InverseDynamics : summing inertia torque and coriolis torque and gravity torque may be something mistakes. Moreover, I can not believe calculated inertia torque values.
I am wondering if everyone is using mathworks's robot dynamics functions without problems.
Related documents need to be presented in more detail.
##### 2 CommentsShowHide 1 older comment
Taishin Chung on 10 Jul 2022
Edited: Taishin Chung on 10 Jul 2022
Hi Sehun,
Even if I agree with most of what Carlos mentioned, I still have found some problems in massMatrix.
After 'robot=importrobot('TwoLink.urdf',"urdf")' convert the inertia to the body attached frame, I found robot.massMatrix() function still using the inertia relative to center of mass rather than to the body attached frame, 'robot.Bodies{1,i+1}.Inertia'.
Using Solidworks and its urdf-export add-on which gives the moments of inertia both relative to the center of mass and to the body attached frame, I could verify this problem.
with regards,
Taishin

Boris Blagojevic on 22 Jun 2020
Hello Sehun,
i encountered a similiar problem. The Mass Matrix of a 5-DoF Robot, calculated with Lagrange and Newton-Euler manually, doesn't match the result of the built-in massMatrix function. It appears to have a constant offset for all joint configurations for some entries, while others are equal to the analytically derived values.
Gravity Torque and Velocity Product seem to be fine at least.
This is a serious problem with the ROS-Toolbox and requires a response from the staff, if you ask me. I won't trust this Toolbox any longer, until this issue is fixed.
Greetings
BB
Sajjad Monfared on 1 Dec 2020
Hi Boris,
I experienced similar issue with Mass Matrix having offset for some entries in the matrix for a high-DOF robot. I modeled the robot in multibody environment and exported it as a rigidBodyTree object. After examining the robot properties, it turned out that in robotics toolbox the inertia tensor is computed with respect to body frame rather than center of mass frame which causes an offset when traslating inertia tensor between the two frames.
Just make sure you are defining inertial properites of the robot in accordance with the toolbox conventions.
Best,

### Categories

Find more on Robot Models in Help Center and File Exchange

R2020a

### Community Treasure Hunt

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

Start Hunting!