Robot Arm Kinematics Back
Robotics

2-Link Robot Arm — Forward & Inverse Kinematics

Adjust joint angles for FK, or click the canvas to set an IK target and toggle between elbow-up and elbow-down configurations.

Mode
Link Parameters
Link 1 length L₁ 1.00 m
Link 2 length L₂ 0.80 m
Joint Angles (FK)
θ₁ (Joint 1) 45°
θ₂ (Joint 2) -60°
End-effector X
End-effector Y
Max Reach
Elbow (x,y)
Forward Kinematics:
$x = L_1\cos\theta_1 + L_2\cos(\theta_1+\theta_2)$
$y = L_1\sin\theta_1 + L_2\sin(\theta_1+\theta_2)$

Inverse Kinematics:
$\cos\theta_2 = \dfrac{x^2+y^2-L_1^2-L_2^2}{2L_1L_2}$
$\theta_1 = \mathrm{atan2}(y,x) - \mathrm{atan2}(L_2\sin\theta_2,\,L_1+L_2\cos\theta_2)$

What is Robot Arm Kinematics?

🧑‍🎓
What exactly is "forward kinematics"? It sounds complicated.
🎓
Basically, it's just figuring out where the robot's hand (the "end-effector") ends up when you tell its joints how much to bend. For this 2-link arm, you control two angles: $\theta_1$ for the shoulder and $\theta_2$ for the elbow. Try moving the $\theta_1$ and $\theta_2$ sliders above—you'll see the arm move and the X, Y position update instantly. That's forward kinematics in action!
🧑‍🎓
Wait, really? So if forward is "angles to position," is inverse kinematics just the opposite?
🎓
Exactly! Inverse kinematics (IK) answers: "What angles do I need to reach *this specific point*?" It's the real-world problem—like telling a robotic arm to pick up a cup at a known location. In the simulator, click the "Set Target" mode and drag the red target circle. The simulator solves the IK equations in real-time to figure out the possible arm configurations that can reach that point.
🧑‍🎓
I see two different arm poses sometimes when I move the target. Why are there two solutions?
🎓
Great observation! For a given target point, there are often two valid poses: an "elbow-up" and an "elbow-down" configuration. This is a key feature of IK—it's not always a single answer. The math gives us multiple solutions, and engineers choose based on what's more efficient or avoids obstacles. Try moving the target to the far right; you'll see the two solutions swap as one becomes impossible.

Physical Model & Key Equations

The core of forward kinematics is using trigonometry to add up the vectors of each arm segment. The position of the end-effector is the sum of the first link's tip and the second link attached to it.

$$ \begin{aligned}x &= L_1\cos\theta_1 + L_2\cos(\theta_1+\theta_2) \\[4pt] y &= L_1\sin\theta_1 + L_2\sin(\theta_1+\theta_2) \end{aligned}$$

Here, $L_1$ and $L_2$ are the link lengths, $\theta_1$ is the first joint angle (from the horizontal), and $\theta_2$ is the second joint angle (relative to the first link). The term $(\theta_1+\theta_2)$ is the absolute angle of the second link.

Inverse kinematics is derived using the law of cosines. Given a desired $(x, y)$ position, we solve backwards for the angles. The equation for $\theta_2$ comes from the triangle formed by the two links and the vector to the target.

$$ \cos\theta_2 = \frac{x^2 + y^2 - L_1^2 - L_2^2}{2 L_1 L_2} $$

From this, $\theta_2$ can be positive ("elbow-down") or negative ("elbow-up"), giving the two solutions. Once $\theta_2$ is known, $\theta_1$ is found using the arc tangent of the target position, adjusted for the geometry of the second link.

Real-World Applications

Industrial Assembly Robots: These arms, like those in car manufacturing, use inverse kinematics to precisely position welders or grippers at programmed locations on an assembly line. The solver must pick the fastest, most collision-free pose from multiple solutions.

Robotic Surgery: Surgical robotic arms, such as the da Vinci system, rely on highly accurate forward and inverse kinematics. The surgeon's hand movements are translated into target positions for the tools inside the patient, and the robot's control system solves the IK in real-time to achieve those positions.

Computer Animation & Gaming: When animating a character, an animator might place a character's hand on a doorknob. The IK system automatically calculates realistic elbow and shoulder angles, saving hours of manual posing. This is the same 2-link principle applied to a digital skeleton.

Prosthetics and Exoskeletons: Myoelectric prosthetic arms use sensor signals from the user's muscles as a desired movement intent. An onboard IK solver translates that intent into specific motor commands for the prosthetic joints, allowing for natural-looking reaching and grasping motions.

Common Misconceptions and Points to Note

First, the simplistic dichotomy that "Forward Kinematics (FK) is easy, while Inverse Kinematics (IK) is hard" is dangerous. While the FK for a 2-link arm is indeed simple trigonometric sums, as the number of links increases, the FK equations themselves become complex depending on the joint configuration (rotational/prismatic) and the chosen coordinate frames. On the other hand, the IK for a planar 2-link arm, like the one handled by this tool, is a special case where a geometric "solution formula" exists. For many practical arms like 6-axis manipulators, such closed-form solutions often don't exist, and solutions are found via numerical computation (iterative methods). In these cases, the nature of the difficulty between FK and IK can even reverse.

Next, it's easy to think "once a solution is found, that's it," but a perspective for evaluating the "quality" of the solution is crucial. For example, when there are two solutions ("elbow up" and "elbow down") for the same target point, which one you choose depends on the application. If there are obstacles in the workspace, you would choose the posture that avoids them. If considering energy efficiency, you might choose a posture closer to the center of the joints' range of motion. Also, solutions near singular postures (e.g., where the arm is fully extended) can lead to unstable control because small changes in the target position cause drastic changes in joint angles. You can experience this sensation in this tool by setting L1 and L2 to the same length and placing the target point far away, nearly on the X-axis (y=0).

Finally, always be mindful of parameter units and reference directions. In this tool, angles are displayed in degrees, but internal calculations and many libraries use radians. Furthermore, the definition of the reference axis for θ1 (often the X-axis) and the positive rotation direction (generally counter-clockwise) can change depending on the coordinate system and right-hand/left-hand rule conventions. This is a critical item to verify first when interfacing with other systems. For instance, if a CAD system and a robot simulator have different coordinate system definitions, completely unexpected movements can occur.

Related Engineering Fields

The principles you learn with this tool are directly applied to various "multi-body system motion descriptions" beyond robotics. For example, in the analysis of automotive suspension mechanisms or the operation of hydraulic arms in construction machinery, the posture of systems composed of multiple links and joints is calculated precisely using forward kinematics concepts. In game development and CG animation, a character's skeletal model is essentially a collection of "joints and links," and IK is widely used to determine the position of the end effectors (hands and feet). IK technology is also core to applying motion capture data to characters with different body proportions.

Furthermore, it is deeply connected to "Mechanism Design" and "Robust Design" in design engineering. Did you observe how the reachable area (workspace) changes when you modify the link lengths L1 and L2 in this tool? This is fundamental for layout design in products, determining "whether this robot can perform tasks in this range." Also, when considering manufacturing tolerances and wear, the kinematic equations handled here become the starting point for sensitivity analysis, seeking link length ratios that minimize end-effector error even with some joint angle inaccuracies (so-called low "error sensitivity" design).

Another important field is Control Engineering. What IK provides is merely a "position command value"—the joint angles needed to reach the target position. To actually move a real robot, "servo control" is necessary to make each joint motor follow that command value quickly, accurately, and without vibration. Furthermore, when external forces act on the arm, such as when lifting an object, the discussion expands into "dynamics," which calculates the torque required to maintain posture. Kinematics provides the foundational "geometric" part for all of this.

For Further Learning

The next steps are "expansion into 3D space" and "experiencing numerical solutions". While the planar 2-link case could be solved geometrically, this isn't possible for a 3D 6-axis arm. For learning, understand "homogeneous transformation matrices," the foundation of 3D coordinate transformation. This is a powerful tool that represents joint rotations and translations with 4x4 matrices, expressing forward kinematics as matrix multiplication. For inverse kinematics, learn iterative numerical methods using the "Jacobian matrix," a representative example (e.g., the Newton-Raphson method). The Jacobian matrix relates joint velocities to end-effector velocity; inverting this relationship forms the basis for IK algorithms that iteratively update joint angles step-by-step toward the target.

If you wish to deepen the mathematical background, a review of linear algebra (vectors, matrices, eigenvalues) and multivariable calculus is essential. The operations of the aforementioned homogeneous transformation matrices and Jacobian matrices are all described in the language of linear algebra. Also, understanding derivatives is necessary for tackling "optimization problems" to select optimal postures and, when moving into dynamics, for handling "Lagrange's equations." As seen in the tool with the "elbow up/down" choice, IK typically has multiple solutions. Choosing the solution that minimizes energy or equalizes joint load among these is precisely a constrained optimization problem.

A recommended specific next topic is "Robot Arm Trajectory Planning". This field considers how to smoothly interpolate postures when moving the end-effector from point A to point B (e.g., by changing each joint angle via a cubic polynomial). After experiencing FK and IK with this tool, take the first step from "solving is the end" to the practical stage of "how to move it." Using simulation tools or programming languages (like Python's Robotics Toolbox) to write a simple script that generates a trajectory will significantly deepen your understanding.