Two-Link Robot Arm Calculator: Inverse Kinematics & Torque
Solve forward and inverse kinematics for a planar two-link arm, compare elbow up/down, and calculate static joint torques from link masses and payload.
This two-link robot arm calculator helps students, makers and engineers connect a desired tool position with the angles and static loads of a planar robot. Use it when sketching a small manipulator, comparing link proportions, checking a robotics exercise or estimating the gravity load that a joint must hold.
Choose Joint angles → position to enter a shoulder angle and a relative elbow angle. The shoulder angle starts at the horizontal positive x direction, and positive angles turn counterclockwise. The elbow angle is measured relative to link 1: zero means a straight arm. Press ▶ beside the shoulder angle to rotate the arm and watch the endpoint and signed holding torques change. Playback shows successive static poses; its speed is not used to calculate inertial loads.
Choose Target position → joint angles to use the inverse kinematics calculator. Enter the target coordinates relative to the shoulder and select elbow down or elbow up. Here those names identify positive and negative relative elbow angles. They describe opposite sides of the shoulder-to-target ray, so the elbow does not always appear below or above the target on screen. The dashed arm and comparison table show the other solution.
The shaded workspace is the ideal geometric reach with unrestricted joints. Its outer radius is the sum of the link lengths; its inner radius is their absolute difference. A target outside that annulus cannot be reached. At a straight or fully folded configuration the two branches merge and the position Jacobian becomes singular. Equal links folded back to the shoulder admit infinitely many shoulder angles; the inverse calculation reports a conventional zero shoulder angle there.
For a robot arm torque calculator result, enter each link mass, its center-of-mass position as a fraction of its length, and the combined tool and payload mass at the tip. A uniform link uses a fraction of 0.5. The arm lies in a vertical plane, with gravity downward. The torque cards give actuator torques required to hold the pose, positive counterclockwise. Use their absolute values when comparing joint torque magnitudes. The chart sweeps the shoulder while keeping the selected elbow angle fixed. The workspace maximum cards give the largest gravity-only magnitudes possible with unrestricted joints.
Use the metric/US switch for input and result units. Drawing annotations retain explicitly stated SI units. These results exclude acceleration, friction, transmission losses, motor heating, joint stops, collision clearance and structural flexibility. They do not establish a motor rating or a safe working payload. A horizontal-plane arm with vertical joint axes needs a different gravity model. Full dynamics, including Panda identification parameters, requires a separate multibody calculation.
How it is calculated
The kinematic convention follows Ben-Ari and Mondada, Elements of Robotics, §16.1–16.2, printed pp. 269–273 (attached PDF pp. 273–277). The shoulder is at the origin; +x is right, +y is up, and both joint coordinates are positive counterclockwise. Link 2 has absolute orientation .
For inverse kinematics, the cosine law gives . Directly using and loses significant digits near the equal-link folded origin. The implementation therefore uses the algebraically equivalent, factored half-angle construction derived here from the same triangle:
The up-branch elbow angle is . Down is the positive- branch. The two square roots in each factor are evaluated separately; absolute values keep roundoff or rejected out-of-workspace inputs from generating complex values. The independent radius condition still rejects unreachable targets. remains an explanatory quantity, not the angle solver.
Shoulder angles can differ by a full turn without changing the pose. Only the exact equal-link folded origin uses as an arbitrary representative; nearby nonzero targets do not inherit that convention. Nonzero inverse targets nearer than of total reach are rejected because degree-angle representation would otherwise limit relative precision. The radius condition is , with a relative allowance for roundoff at workspace boundaries.
Static torques are derived here from moment balance / potential-energy differentiation, consistent with Mohammadijoo, Gravity Compensation, §9 and Problem 5. With :
These are actuator holding torques, opposite to gravity's generalized torques. Unrestricted-workspace maxima are and . At the selected elbow angle, the shoulder envelope is . The Jacobian determinant for angles in radians is ; the normalized singularity indicator is .
Assumptions
Two rigid, mass-bearing links with ideal revolute joints in a vertical plane. Gravity acts along −y. Each center of mass lies on its link centerline between its joints; 0.5 represents a uniform link. The tool and payload form a point mass at the end of link 2. Link masses may include attached hardware if the combined mass and center of mass are represented correctly. There are no joint limits or obstacles. Both joint torques are measured at the joint output, with no transmission model. Animation is a geometric sweep of static equilibria, not a dynamic simulation. The moment equations and workspace bounds are derived here; no Panda parameters are substituted into a planar model.
Where it applies
Use for planar reach studies and gravity-only joint loading, with positive link lengths, nonnegative masses and gravity, and center-of-mass fractions between 0 and 1. The warning within about 1.7° of a collinear pose uses as an educational indicator, not a robot controller limit. Unreachable targets are rejected rather than projected onto the workspace. At the exact equal-link folded origin the inverse shoulder angle is not unique. A nonzero inverse target must be at least 10⁻¹⁰ of total reach from the shoulder; smaller distances are rejected with a message instead of silently using the origin convention.
The displayed maximum torques cover unrestricted geometry and need not occur simultaneously with a specified target. Signed torques may cancel at particular poses. Friction, acceleration, Coriolis effects, motor/gear inertia, efficiency, backlash, compliance, tool offsets, cable forces, contact forces, thermal duty and safety margins are outside this model. Motor selection requires these additional loads and the manufacturer's continuous torque limits.
Gaz et al. (2019), DOI 10.1109/LRA.2019.2931248, identifies the full seven-joint Franka Panda model (attached PDF pp. 2–3 and 6–7); it is provided as further reading for a future dynamics calculation. This tool does not predict Panda dynamics. Diagrams keep SI annotations; numeric inputs, result cards, charts and tables use the catalog unit controls.
References
- Ben-Ari, M. and Mondada, F. (2018). Elements of Robotics, Chapter 16, Kinematics of a Robotic Manipulator, pp. 267–291. Open access. https://doi.org/10.1007/978-3-319-62533-1_16
- Carnegie Mellon University, Robotics for Creative Practice (Fall 2026), two-link-ik.py, sample output. Angles use −y as zero, requiring a −90° shoulder-coordinate conversion. https://courses.ideate.cmu.edu/16-375/f2026/text/python/lecture-samples/two-link-ik.html
- Mohammadijoo, A., Robot Control, Chapter 2 Lesson 3: Gravity Compensation, §9 and Problem 5. Published rounded gravity torque example. https://mohammadijoo.github.io/CaaT_Academy/Lectures/Robot_Control_Course/Chapter02/Lesson3.html
- Gaz, C., Cognetti, M., Oliva, A., Giordano, P. R. and De Luca, A. (2019). Dynamic Identification of the Franka Emika Panda Robot With Retrieval of Feasible Parameters Using Penalty-Based Optimization. IEEE RA-L 4(4), 4147–4154. Further reading only. https://doi.org/10.1109/LRA.2019.2931248 ; open repository: https://mural.maynoothuniversity.ie/15321/1/MC_dynamic.pdf
Inputs
| Input | Symbol | Unit | Default |
|---|---|---|---|
| Solve from | solve_from | Joint angles → position | |
| Shoulder-to-elbow length | L1 | m | 0.5 |
| Elbow-to-tool length | L2 | m | 0.4 |
| Shoulder angle (▶ to rotate) Counterclockwise from horizontal +x. Playback illustrates a sequence of static poses. | q1 | deg | 25 |
| Relative elbow angle Measured from link 1 to link 2, positive counterclockwise. Zero is straight. | q2 | deg | 70 |
| Target x | x_target | m | 0.55 |
| Target y | y_target | m | 0.25 |
| Elbow configuration Down/up means the elbow lies to the right/left of the directed shoulder-to-target ray, not always below/above it on screen. | branch | Elbow down (q₂ ≥ 0) | |
| Link 1 mass Include hardware carried rigidly by link 1. Shoulder-mounted hardware adds no arm moment. | m1 | kg | 2 |
| Link 2 mass | m2 | kg | 1 |
| Tool and payload mass at tip | mp | kg | 0.5 |
| Link 1 COM distance / length Fraction from the shoulder along link 1. Use 0.5 for a uniform link. | f1 | 0.5 | |
| Link 2 COM distance / length Fraction from the elbow along link 2. Use 0.5 for a uniform link. | f2 | 0.5 | |
| Gravity magnitude Acts vertically downward (−y). Joint axes are perpendicular to this vertical plane. | g0 | m/s^2 | 9.81 |
Results
With the default inputs above, the calc gives:
| Result | Value |
|---|---|
| Tool x | 0.4183 m |
| Tool y | 0.6098 m |
| Shoulder angle | 25 deg |
| Relative elbow angle | 70 deg |
| Shoulder holding torque (signed) | 10.7716 N·m |
| Elbow holding torque (signed) | -0.342 N·m |
| Workspace maximum |shoulder torque| | 16.1865 N·m |
| Workspace maximum |elbow torque| | 3.924 N·m |
| Minimum reach | 0.1 m |
| Maximum reach | 0.9 m |
Checked against sources
Each case below was calculated by this calc and agrees with the value from its source (within the tolerance where one is shown).
Textbook forward kinematics: 60°, −30°
Source: Ben-Ari and Mondada (2018), Elements of Robotics §16.1, printed p. 269, attached p. 273. Worked example gives x=y=(1+sqrt(3))/2 for L1=L2=1, q1=60°, q2=−30°. The SI length scale is taken as metres; angles follow the book.
Inputs: Shoulder-to-elbow length = 1 m; Elbow-to-tool length = 1 m; Shoulder angle (▶ to rotate) = 60 deg; Relative elbow angle = -30 deg; the others as above.
| Result | Source | This calc |
|---|---|---|
| Tool x | 1.366 m | 1.366 m |
| Tool y | 1.366 m | 1.366 m |
Textbook inverse kinematics: both branches
Source: Ben-Ari and Mondada (2018), §16.2, printed pp. 272–273, attached pp. 276–277. Independently published solutions (30°,30°) and (60°,−30°) at x=y=(1+sqrt(3))/2 with unit link lengths.
Inputs: Solve from = Target position → joint angles; Shoulder-to-elbow length = 1 m; Elbow-to-tool length = 1 m; Target x = 1.366 m; Target y = 1.366 m; the others as above.
| Result | Source | This calc |
|---|---|---|
| Elbow down: shoulder angle | 30 deg | 30 deg |
| Elbow down: relative angle | 30 deg | 30 deg |
| Elbow up: shoulder angle | 60 deg | 60 deg |
| Elbow up: relative angle | -30 deg | -30 deg |
CMU sample output in both elbow configurations
Source: CMU two-link-ik.py sample output, https://courses.ideate.cmu.edu/16-375/f2026/text/python/lecture-samples/two-link-ik.html . Published angles [1.27724626,2.33921623] and [3.61646249,−2.33921623] radians for equal unit links at [0.5,0.6]. The source uses −y as shoulder zero, so converted shoulder = rad2deg(source shoulder)−90°; elbow is only converted to degrees. Tolerance accounts for printed rounding.
Inputs: Solve from = Target position → joint angles; Shoulder-to-elbow length = 1 m; Elbow-to-tool length = 1 m; Target x = 0.5 m; Target y = 0.6 m; Elbow configuration = Elbow up (q₂ ≤ 0); the others as above.
| Result | Source | This calc |
|---|---|---|
| Elbow down: shoulder angle | -16.819 deg | -16.819 deg |
| Elbow down: relative angle | 134 deg | 134 deg |
| Elbow up: shoulder angle | 117.2 deg | 117.2 deg |
| Elbow up: relative angle | -134 deg | -134 deg |
| Tool x | 0.5 m | 0.5 m |
| Tool y | 0.6 m | 0.6 m |
Published two-link gravity compensation worked example
Source: Abolfazl Mohammadijoo, Gravity Compensation, Problem 5, https://mohammadijoo.github.io/CaaT_Academy/Lectures/Robot_Control_Course/Chapter02/Lesson3.html . Published example: m1=5kg, m2=3kg, L1=0.5m, L2=0.4m, q1=π/4, q2=π/6, g=9.81; gravity torques rounded to [20.6,1.5] N·m. Payload zero; uniform COM. Absolute tolerances reflect the one-decimal published rounding.
Inputs: Shoulder angle (▶ to rotate) = 45 deg; Relative elbow angle = 30 deg; Link 1 mass = 5 kg; Link 2 mass = 3 kg; Tool and payload mass at tip = 0 kg; the others as above.
| Result | Source | This calc |
|---|---|---|
| Shoulder holding torque (signed) | 20.6 ± 0.05 N·m | 20.599 N·m |
| Elbow holding torque (signed) | 1.5 ± 0.05 N·m | 1.523 N·m |
Review regression: near-folded equal links, elbow down
Source: Independent review of board subtask #794 supplied this target and incorrect/correct torque comparison (approximately 1.72e−8 and 4.91e−9 N*m). The tighter expectations are derived independently from equal-link isosceles symmetry: elbow x=r/2, cos(q1)=cos(q1+q2)=r/(2L)=1e−9, q1=−acos(r/(2L)), q2=2acos(r/(2L)). Direct weight moments give T1=17.1675e−9 and T2=4.905e−9 N*m. This is an analytical numerical-stability regression, not an additional published benchmark. Equal-link geometry is also described by Ben-Ari and Mondada §16.1, attached PDF p. 273.
Inputs: Solve from = Target position → joint angles; Elbow-to-tool length = 0.5 m; Target x = 1 × 10⁻⁹ m; Target y = 0 m; the others as above.
| Result | Source | This calc |
|---|---|---|
| Shoulder angle | -90 deg | -90 deg |
| Relative elbow angle | 180 deg | 180 deg |
| Shoulder holding torque (signed) | 1.717 × 10⁻⁸ N·m | 1.717 × 10⁻⁸ N·m |
| Elbow holding torque (signed) | 4.905 × 10⁻⁹ N·m | 4.905 × 10⁻⁹ N·m |
Review regression: near-folded equal links, elbow up
Source: Analytical mirrored branch of the independent review's near-folded regression for board subtask #794. Reflecting the down branch in the x axis reverses both joint angles while preserving all horizontal gravity lever arms, so holding torques remain 17.1675e−9 and 4.905e−9 N*m. Angles follow equal-link isosceles geometry, not the general half-angle implementation. This is a requested regression, not a published benchmark.
Inputs: Solve from = Target position → joint angles; Elbow-to-tool length = 0.5 m; Target x = 1 × 10⁻⁹ m; Target y = 0 m; Elbow configuration = Elbow up (q₂ ≤ 0); the others as above.
| Result | Source | This calc |
|---|---|---|
| Shoulder angle | 90 deg | 90 deg |
| Relative elbow angle | -180 deg | -180 deg |
| Shoulder holding torque (signed) | 1.717 × 10⁻⁸ N·m | 1.717 × 10⁻⁸ N·m |
| Elbow holding torque (signed) | 4.905 × 10⁻⁹ N·m | 4.905 × 10⁻⁹ N·m |







Responses