Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inertia representation #39

Closed
DimitriEckert137 opened this issue Jul 4, 2020 · 5 comments
Closed

Inertia representation #39

DimitriEckert137 opened this issue Jul 4, 2020 · 5 comments

Comments

@DimitriEckert137
Copy link

Hi
I am using kdl_parser 1.13.1. I am creating a tree from a urdf file in order to afterwards convert it to a chain with the getChain() function of kdl (because I didn't find a direct way to create a chain from a urdf file). My question is are the Inertia in the URDF file supposed to be with respect to the centre of gravity of the respective segment? Or with respect to the tip of the segment? Or with respect to the joint? I could not really understand how the Inertias are treated in the kdl_parser.

@traversaro
Copy link
Contributor

traversaro commented Jul 4, 2020

My question is are the Inertia in the URDF file supposed to be with respect to the centre of gravity of the respective segment?

As far as I remember, the 3D inertia in the URDF file are expressed in the center of gravity of the link, that in the URDF context is sometime referred to "inertia" frame (not to be confused to the "inertial" frame of classical mechanics).
See https://github.com/ros/kdl_parser/blob/2.4.0/kdl_parser/src/kdl_parser.cpp#L106 for the related code. Old related PR : ros/robot_model#66 .

@DimitriEckert137
Copy link
Author

Thank you! That is what I somwhat expected froom the code, but I wasn't sure if I got it right. But does that mean I can represent it in the URDF file with respect to the CoM and kdl will take care of it or do I have to do something so that the inertias are represented right? (Some context: I use the chain afterwards for the ChainIdSolver_RNE to calculate the torques. The torques are off what gazebo is telling me they should be, so I thought maybe there is something wrong with the Inertias)

@traversaro
Copy link
Contributor

But does that mean I can represent it in the URDF file with respect to the CoM and kdl will take care of it or do I have to do something so that the inertias are represented right?

Unless there is something wrong, the kdl_parser should convert the inertia in the representation expected by KDL.

(Some context: I use the chain afterwards for the ChainIdSolver_RNE to calculate the torques. The torques are off what gazebo is telling me they should be, so I thought maybe there is something wrong with the Inertias)

Depending on the precise physics engine, physics parameters and how you are computing the torque in Gazebo (if it includes friction, etc etc) then there may be several factors that may give you mismatching result. I personally would suggest to start with a really simple model (a single pendulum) for which you can compute analyitical the dynamics, and then validate both KDL and Gazebo with your analytical solution. Once you know that everything is consistent for a simple example, then you can try to get consistent results from a more complex mechanism.

@DimitriEckert137
Copy link
Author

Unless there is something wrong, the kdl_parser should convert the inertia in the representation expected by KDL.

Ok great

I personally would suggest to start with a really simple model (a single pendulum) for which you can compute analyitical the dynamics, and then validate both KDL and Gazebo with your analytical solution.

That sounds like a good plan. Thank you for your time!

@clalancette
Copy link
Collaborator

Since I believe this is a question (and not something to change), I'm going to go ahead and close this. Please feel free to reopen if you think there is a bug/problem in kdl_parser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants