In this video we use the inverse dynamics of a rigid body that we derived in the last video to derive the Newton-Euler inverse dynamics algorithm for an open-chain robot. Consider an n-link robot with an end-effector. Each link is a rigid body, and the center of mass of each link is shown. We assign frames {1} through {n} at the centers of mass of the n links, as well as a frame {n+1} at the end-effector and a frame {0} fixed in the world. We define V_i to be the twist of link i expressed in frame {i}. With these definitions, I'll quickly summarize the algorithm. We'll come back to the details later. First, we perform the forward iterations, which calculate the configuration, twist, and acceleration of each link, starting from link 1 and moving outward. Given the vectors of joint positions, velocities, and accelerations, and starting from link 1, we calculate the twist V_i of link i as the sum of the twist of link i-minus-1, but expressed in the {i} frame, and the added velocity due to the joint velocity theta_i-dot. Then we calculate the acceleration of link i as the sum of the acceleration of link i-minus-1, but expressed in the {i} frame, plus the added acceleration due to the joint acceleration theta_i-double-dot, plus a velocity-product term due to theta_i-dot and the twist V_i. After the forward iterations are completed, we have the configuration, twist, and acceleration of each link. Now we perform the backward iterations, calculating the required joint forces and torques starting from joint n and moving back to joint 1. First we calculate the wrench F_i required for link i as the sum of the wrench F_i-plus-1, which is the wrench needed at link i-plus-1 but expressed in the {i} frame, plus the wrench needed to accelerate link i, using the inverse dynamics of a rigid body derived in the previous video. Then we calculate tau_i as the component of the wrench F_i along the joint screw axis. Only that portion of the wrench has to be applied by the joint motor; the rest of the wrench is provided passively by the mechanical structure of the joint, such as the bearings. At the end of the backward iterations, we have calculated all the joint forces and torques needed to create the desired joint accelerations at the current joint positions and velocities. That is all there is to it; the rest of this video is just filling in the details. So, formally, the recursive Newton-Euler inverse dynamics algorithm calculates tau given the joint positions, velocities, and accelerations, as well as the wrench F_tip that the robot end-effector applies to the environment. We define M_i, i minus 1 to be the transform defining the frame {i-1} relative to frame {i} when joint i is at its zero position. We define A_i to be the screw axis of joint i expressed in the frame {i}. We define the wrench F_n-plus-1 to be the wrench F_tip applied by the end-effector. Finally, to model gravity, we define the acceleration of the base of the robot, V_zero-dot, to be a linear acceleration opposite the gravity vector. This is because gravity is indistinguishable from upward acceleration. With these definitions, the forward iterations, from frame {1} to frame {n}, can be written as follows: First, the configuration of frame {i-1} relative to frame {i} is given by the formula shown here. Next, the twist of link i is the sum of the twist of link i-minus-1, but expressed in the frame {i} using the matrix adjoint of T_i,i-minus-1 calculated in the first step, plus the added twist due to the joint velocity theta_i-dot times the joint screw axis A_i. Finally, the acceleration of link i is the sum of the acceleration of link i_minus-1 expressed in the {i} frame, plus an acceleration due to a velocity-product term consisting of the Lie bracket of the twist V_i from the previous step and the joint velocity times the joint screw axis A_i, plus an added acceleration of the joint acceleration times the joint screw axis A_i. The derivations of these equations can be found in the book. At the end of the forward iterations, we have the configurations, twists, and accelerations of all the links. The twists and accelerations are expressed in the center-of-mass frames {i}. Now we begin the backward iterations, from frame {n} to frame {1}. First we calculate the wrench F_i required by link {i} as the sum of the wrench required by link {i+1}, but expressed in frame {i}, plus the wrench required by link {i} according to the inverse dynamics of a rigid body we derived in the previous video. Finally, we calculate the joint torque tau_i by projecting the wrench F_i on to the screw axis A_i. We now have the vector tau of all joint forces and torques needed for a given theta, theta-dot, theta-double-dot, and end-effector wrench F_tip. One advantage of this algorithm is that it involves no differentiation. Another is that it is computationally efficient due to its recursive nature, where calculation of link i's twist and acceleration uses link i-minus-1's twist and acceleration, and calculation of link i's wrench and joint torque uses link i-plus-1's wrench and joint torque. The inverse dynamics are useful for robot control. For simulation, however, we need to solve the forward dynamics. In the next video, I will demonstrate one way to use the Newton-Euler inverse dynamics algorithm to solve the forward dynamics.