Ask Your Question

urdf to lagrangian equations of motion

asked 2012-11-14 05:57:13 -0600

mkillpack gravatar image

I'm looking for a nice programmatic way of generating Lagrange's equations of motion for a robot arm given a description like a urdf. This should be straightforward, however I haven't found code or libraries that already do this. The closest thing I've found is Pydy. Does anybody else have any suggestions before I derive it by hand or implement in code something that has already been done? thanks.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2013-01-15 18:20:57 -0600

Thomas gravatar image

updated 2013-11-20 17:37:20 -0600

Here is a review of the libraries I am aware of. I hope it will help you make your choice!

Robotics algorithms

  • Forward (or direct) geometry: from joint configuration to body position,
  • Forward (or direct) kinematics: from joint velocity to body velocity,
  • Inverse kinematics: from body velocity to joint velocity,
  • Forward (or direct) dynamics: from forces applied on a body compute the body acceleration,
  • Inverse dynamics: from body accelerations compute forces applied by the joints (RNEA).

For any of these algorithms, one may support or not:

  • floating-base (through the addition of a free-flyer joint as the root joint of the model)
  • particular structures such as trees (instead of chains) and closed-loops,
  • external forces (for dynamics related algorithms). For instance, it is useful to take into account external disturbances during motion.

More information:

Bullet (>= 2.82 / NEW)

Bullet Collision Detection & Physics SDK

Bullet is a Collision Detection and Rigid Body Dynamics Library. The Library is Open Source and free for commercial use, under the ZLib license.


  • Geometry: unknown
  • Kinematics: unkown
  • Dynamics: forward, inverse

Supported joints:

  • 1-DOF revolute and prismatic joints


  • License: ZLib
  • Underlying matrix library: none, uses its own types,
  • Frame representation: rotation matrix and translation vector,
  • Online model edition: unknown,
  • Tree support: yes,
  • Floating base support: yes,
  • URDF loading: NO


KDL (Orocos)

The Kinematics and Dynamics library used by ROS core packages. Notably the robot_model one.


Supported joints:

  • 1-dof: revolute (X or Y or Z), prismatic (X or Y or Z)


  • License: LGPL
  • Underlying matrix library: none, uses its own types,
  • Frame representation: rotation matrix and translation vector,
  • Online model edition: yes,
  • Tree support: NO,
  • Floating base support: NO (only 1-dof joints),
  • URDF loading: yes, separate ROS package kdl_parser, read only.



Metapod is a meta-programming dynamics computation library. The objective is to achieve high efficiency by assuming the robot model is known at compile-time. By doing so and by relying on advanced C++ techniques, dynamic allocation can be totally avoided and the compiler can achieve optimization that would not be possible in any other case.


  • Geometry: Direct[1]
  • Kinematics: Direct[1]
  • Dynamics: Inverse

[1] Those two algorithms are currently bound to the RNEA algorithm which means it is not possible currently to compute these quantities without computing the dynamics information.

Supported joints:

  • 1-dof: revolute (X or any arbitrary axis)
  • 6-dof: free-floating (three translation, three rotation)


  • License: LGPL3
  • Underlying matrix library: Eigen,
  • Frame representation: spatial algebra (rotation matrix and translation vector),
  • Online model edition: NO,
  • Tree support: yes,
  • Floating base support: yes,
  • URDF support: yes, experimental, read only[1].

[1] This Python script lives as a specific branch of robot_model_py for now. Due to Metapod specific design, loading an URDF model means in this context generating a C++ file which then will be compiled to use the robot-specific dynamic algorithm (RNEA).


OpenRAVE [C++, Python]

This motion planning library is able to provide kinematics and dynamics computation ... (more)

edit flag offensive delete link more


This is a very thorough review, great job! However, I should have been clearer that I wanted symbolic representations. The difference in this case is that many iterative methods (RNE, etc.) require a joint acceleration to evaluate the mass, Coriolis, etc. terms. Sympybotics does not. Thanks.

mkillpack gravatar image mkillpack  ( 2013-01-17 03:31:12 -0600 )edit

Also, although sympybotics uses numpy to generate the equations of motion, it outputs functions for both python and C to calculate the mass, Coriolis, gravity, etc. terms. These functions can then be integrated into any existing library.

mkillpack gravatar image mkillpack  ( 2013-01-25 02:30:04 -0600 )edit
isura gravatar image isura  ( 2013-03-24 14:23:22 -0600 )edit

Yes unfortunately it is simulated by 6 joints and not a real free floating joint which means that it is computationally inefficient...

Thomas gravatar image Thomas  ( 2013-03-24 16:04:57 -0600 )edit

I added Featherstone articulated body algorithm in the Bullet physics library, through btMultiBody. It supports fixed and "real" floating base, 1-DOF revolute and prismatic joints and contact constraints. It will be part of Bullet 2.82, Perhaps you can add it to your list?

erwincoumans gravatar image erwincoumans  ( 2013-10-02 07:18:46 -0600 )edit

Done. Is there IK in Bullet yet? I am still missing some information.

Thomas gravatar image Thomas  ( 2013-10-02 16:26:59 -0600 )edit

OpenRave URDF support should probably be modified to say that there exists an easy conversion from URDF to Collada:

Dave Coleman gravatar image Dave Coleman  ( 2013-11-20 10:38:49 -0600 )edit

Would be nice if you could add RBDL to your post. The upcoming 2.4.0 version has true 3-Dof joints of various sorts: TranslationXYZ, Spherical (a singularity free spherical joint that uses Quaternions), EulerZYX, EulerXYZ, EulerZYX, and uses those for floating base joints for faster URDF models.

Martin Felis gravatar image Martin Felis  ( 2014-09-09 08:05:55 -0600 )edit

answered 2013-01-15 09:43:28 -0600

mkillpack gravatar image

Hi all,

Since originally posting this question, I found the following python library:

It generates symbolic python and C code given a robot description in terms of standard DH parameters, mass and rotational inertia. I've compared it to results with the iterative methods used in Peter Corke's matlab toolbox and everything seems to match up for a simple 2 link planar robot as well as a 6 DOF Puma robot.

There's not a lot of documentation, but the author's included a nice demo script and I've found the code to be self explanatory and very useful. Thanks.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2012-11-14 05:57:13 -0600

Seen: 3,610 times

Last updated: Nov 20 '13