Rigid Body Dynamics



We're going to look at the results of the recursive Newton-Euler algorithm again. But this time, we're going to do the operations symbolically using MATLAB’s computer algebra capability. 

The first thing we are going to do is to bring in a model of the two link robot, that’s the mdl_twolink with a suffix sym to indicate that it is a symbolic model. And once again, we have a serial link object created in our workspace called twolink. 

Because I am going to work with symbols rather than numbers, I need to actually define my variables in advance.  So, I'm going to define a symbolic variable called Q1 and Q2.  And Q1D and Q2D to represent the velocity of joints 1 and joint 2 and Q1DD to represent the acceleration of joint 1 and the acceleration of joint 2. 

Now that I have that, I can use the rne method just as I did last time and I'm going to parse in the joint angles which are the symbolic variables Q1 and Q2.  I am going to parse in the, joint velocities which are the symbolic variables Q1D and Q2D and I'm going to parse in the symbolic variables for the joint acceleration which is Q1DD and Q2DD. 

And, I'm going to save this into a variable called tau. Do that while I remember.  Here we go. Here is the result. 

So, if I look at the torque that is acting on the first joint, here we have a symbolic expression for that torque and it is a very long and complex expression.  We can see that there are a number of kinematic parameters in here like A1 and A2. We can see there are joint accelerations, joint velocities.  We can see G, the gravitational acceleration there are trigonometric terms. There are joint masses. There is all sorts of stuff.  It is a very long and very complicated expression for the torque acting on Joint 1 of our simple two link robot. 

The torque acting on Joint 2, that's the elbow joint robot, is a more concise expression.  There are less complex forces and torques acting on the second joint of robot.  We can see this very complex expression. Imagine what it will be like for a six-link robot. 

Now, it is possible to factorize and simplify those very complex expressions that we just looked at. In particular, if we express it in matrix form like this. Tau is a vector of the applied joint torques. Q, of course, is our joint coordinates, generally the joint angles of the serial link manipulator.  Q-dot, the joint velocities, the rates of change of the joint coordinates and Q-dot-dot is the joint acceleration.  G is a term which represents the torque that's due to the gravity acting on the robot manipulator and gravity is a function only of the joint coordinates Q.  M is the inertia matrix and it is a function only of the joint coordinates multiply by the joint accelerations. 

This gives us the torque that's required to accelerate our serial link manipulator.  C is referred to as the Coriolis and centripetal term and this represents the gyroscopic and other forces that act on the robot joints due to the rotation of other robot joints.


There is no code in this lesson.

We can factorise the joint torque expression into an elegant matrix equation with terms that describe the effects of inertia, Coriolis and centripetal and gravity effects.

Professor Peter Corke

Professor of Robotic Vision at QUT and Director of the Australian Centre for Robotic Vision (ACRV). Peter is also a Fellow of the IEEE, a senior Fellow of the Higher Education Academy, and on the editorial board of several robotics research journals.

Skill level

Undergraduate-level engineering

This content requires an understanding of undergraduate-level engineering; for example, dynamics, classical control theory - PID, poles, zeros, probability theory - random variables and Bayes’ rule.

Undergraduate-level mathematics

This content requires an understanding of undergraduate-level mathematics; for example, linear algebra - matrices, vectors, complex numbers, vector calculus and MATLAB programming.

More information...

Rate this lesson


Check your understanding


  1. Tamim says:

    Hi, I have been following the lectures and coding on Matlab also. But MATLAB does not recognize the function mdl_twolinksym function, I think that I have installed the appropriate toolboxes but it still does not work.

Leave a comment

Previous lesson Next lesson