# VRep: How to get the dynamic parameters of the robots

V-REP has a lot of robot models already available to be used. However, when controlling a robot, it is useful to have its model, both kinematic and dynamic. In this tutorial, we are going to show how to get the dynamic model of a generic robot in V-REP.

An important thing to know is that each link of the robot has a coordinate frame, but this coordinate is different when considering the inertias. To better understand this, take a look at the following images. The left one shows the frame of one link, and the right one shows the frames of the inertias.

To see the inertia frames, one can right click with the mouse and then click on "View" and then in "Visualize inertias".

Once both coordinates are different, in order to get the inertia tensors, it is necessary to know the inertia coordinate frames. However, this information is not easy to find.

One way to get the inertia tensor of each link is looking at the V-REP interface. In the 'Rigid Body Dynamic Property' of the link, there is a part showing the mass, the center of mass and the principal moments of inertia. However, the principal moments of inertia are related to the inertia coordinate frames, and we use the link coordinate frame to do all the rest, as for example, do the kinematic model, or to create control laws. In that way, it is important to also know the moment of inertia related to the link frame. A way to do that is to see the 'Set inertia matrix and COM relative to absolute frame'. Once it is easy to get the relation between the absolute frame and the link frames, one can calculate the inertia matrices and COM related to the links' frames.

But as to get the values from the V-REP interface is an irksome manual work, a better way is to use the available commands. Unlike most of the V-REP commands, the command to get the inertia matrices, as well as the mass and the center of mass, is not available for Matlab, but it is in Lua. In this way, one can use this method inside V-REP, and then send the results to Matlab, using a child script.