# How do the joint angles of a 4-legged impact the body's position with respect to the world frame?

For a four-legged robot (like Big Dog or the one shown here) how are the joint angles and "feet" position related to the body's frame in the world/inertial frame? For example, if I know the body's position and orientation in the world frame, and the joint angles, how do I derive the relationship that tells me where the robots "feet" are?

For simplification, if I assume the legs can be represented as a planar 3R manipulator (where the end effector is the foot), it's easy enough to derive the relationship between the end effector and the angles. But the "base" is the robot's body, which will change position and orientation when the joint angles change. So do I have to find the matrix which relates the body to the world frame, then find the position of the foot with respect to the world? Or am I thinking of this the wrong way?

If you know all the joint angles, to fill in all the world frame information, all you need to know is the pose of something in the world frame.

You first ask how to find the feet position given the pose of the body and the joint angles. I'll explain that and then I'll explain how to find the body pose from a foot pose (and therefore the poses of all the other feet).

I'm going to assume you understand homogeneous transformation matrices for computing forward kinematics.

I'll be using the notation: \begin{equation}^AT_B\end{equation} To denote the transform from frame B to frame A. Or alternatively, the pose of B expressed in frame A.

### Body pose known

So we know the joint angles $\theta$ and the pose of the body in the world frame $^WT_B$.

By representing the the four legs as 3DOF arms where the feet are end-effectors and the body is the "base", we can calculate the position and orientation of each foot relative to the body. This is the same as saying that we have the poses of the feet expressed in the body frame as a function of the joint angles: \begin{equation} ^BT_{f_i}(\theta) \end{equation} Where $f_i$ represents each of the four feet.

We therefore can easily calculate the pose of each foot in the world frame by transforming the pose of the foot in the body frame into the world frame: \begin{equation} ^WT_{f_i}(\theta) = ^WT_B \cdot ^BT_{f_i}(\theta) \end{equation}

### A foot pose known

Now let's say we know the pose of a single foot in the world frame $^WT_{f_i}$ and all the joint angles.

Since you know the pose and not just the position, you can completely calculate the pose of the body based on that one foot. If this is not intuitive, think of the fact that for any set of joint angles, if you move the body in any way, the position and/or orientation of every foot will change, i.e. every combination of body and joint angles corresponds to a unique foot pose).

\begin{align} ^WT_B(\theta) &= ^WT_{f_i} \cdot ^BT_{f_i}^{-1}(\theta) \\ ^WT_B(\theta) &= ^WT_{f_i} \cdot ^{f_i}T_B(\theta) \end{align}