Thanks for the great question!

A couple of notes:

I need to know how to estimate the inertia matrix for the brackets and links that I replaced. The parameters don't need to be very accurate, as long as they are accurate enough for the get_grav_comp function.

Since the "get grav comp" function returns the efforts required to maintain static equilibrium, the inertia is not used by this function. It is passed into the API as a placeholder for future capabilities (using this to provide more accurate dynamics for the "get dynamic comp efforts" function in the future, primarily), but is currently unused internally. You can pass the identity matrix, or use the values from the URDF file.

As you indicated, though, you will need the mass and center of mass properties. The URDF files are designed to match the frame conventions of the HRDF, so these values are safe to use. The xacro elements that create these URDFs are modeled using the same masses and inertias as our APIs set internally. The inertias for the APIs and URDF files are generated through assumptions of a sphere centered at the COM for the brackets and actuators, and a thin rod for the links. If you are interested in the exact dimensions used for the calculations there, I can share those, but it is only a rough approximation. Given the speeds the actuators move at, and considering the relative contribution of different forces, these estimates are probably enough for most applications. However, we haven't done significant tests to identify the actual inertia values here.

It seems like you have done this next set of steps, but I wanted to clarify this for other readers:

If you like, you can also query the properties of the HRDF via the "get masses" and "get forward kinematics" functions through the robot model class; this returns the mass of each body and the FK can be used to determine the COM. You can do this by:

(a) calling "get forward kinematics" with the "Input" frame type

(b) calling "get forward kinematics" with the "Center of Mass" frame type

(c) transforming the COM 4x4 transform by the inverse of the input frame 4x4 transform to get the COM relative to the input of that element.

The small difference you noted here is due to periodic adjustment of the masses and center of masses as we refine our estimates. For example, small hardware changes may result in tiny changes of the mass between subsequent revisions of the hardware, or we may determine a different average mass as we take more samples, for example. These changes are small (half of a millimeter, or less than 0.2%), and so should not affect the calculations. However, if I had to pick a ground truth I would go with the URDF estimates in your case, b/c that is where you are generating the dynamic model, and these are dynamic parameters.

Hope this helps!

Matt