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.

#forward kinematics #inverse kinematics #payload #static torque #two-link arm #workspace

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 q1+q2q_1+q_2.

x=L1cos⁡q1+L2cos⁡(q1+q2),y=L1sin⁡q1+L2sin⁡(q1+q2).x=L_1\cos q_1+L_2\cos(q_1+q_2),\qquad y=L_1\sin q_1+L_2\sin(q_1+q_2).

For inverse kinematics, the cosine law gives C2=(x2+y2−L12−L22)/(2L1L2)C_2=(x^2+y^2-L_1^2-L_2^2)/(2L_1L_2). Directly using arccos⁡C2\arccos C_2 and L1+L2cos⁡q2L_1+L_2\cos q_2 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:
hf=(rmax⁡−r)(rmax⁡+r),ho=(r−rmin⁡)(r+rmin⁡),h_f=\sqrt{(r_{\max}-r)(r_{\max}+r)},\qquad h_o=\sqrt{(r-r_{\min})(r+r_{\min})},
q2=2atan2⁡(hf,ho),δ=atan2⁡ ⁣(hfho,r2+(L1−L2)rmax⁡),q_2=2\operatorname{atan2}(h_f,h_o),\qquad \delta=\operatorname{atan2}\!\left(h_fh_o,r^2+(L_1-L_2)r_{\max}\right),
q1,down=atan2⁡(y,x)−δ,q1,up=atan2⁡(y,x)+δ.q_{1,\mathrm{down}}=\operatorname{atan2}(y,x)-\delta,\qquad q_{1,\mathrm{up}}=\operatorname{atan2}(y,x)+\delta.
The up-branch elbow angle is −q2-q_2. Down is the positive-q2q_2 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. C2C_2 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 q1=0q_1=0 as an arbitrary representative; nearby nonzero targets do not inherit that convention. Nonzero inverse targets nearer than 10−1010^{-10} of total reach are rejected because degree-angle representation would otherwise limit relative precision. The radius condition is ∣L1−L2∣≤r≤L1+L2|L_1-L_2|\le r\le L_1+L_2, with a relative 10−1210^{-12} 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 ci=fiLic_i=f_iL_i:

A=g[m1c1+(m2+mp)L1],B=g(m2c2+mpL2),A=g[m_1c_1+(m_2+m_p)L_1],\quad B=g(m_2c_2+m_pL_2),
T2=Bcos⁡(q1+q2),T1=Acos⁡q1+T2.T_2=B\cos(q_1+q_2),\qquad T_1=A\cos q_1+T_2.

These are actuator holding torques, opposite to gravity's generalized torques. Unrestricted-workspace maxima are A+BA+B and BB. At the selected elbow angle, the shoulder envelope is A2+B2+2ABcos⁡q2\sqrt{A^2+B^2+2AB\cos q_2}. The Jacobian determinant for angles in radians is L1L2sin⁡q2L_1L_2\sin q_2; the normalized singularity indicator is ∣sin⁡q2∣|\sin q_2|.

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 ∣sin⁡q2∣<0.03|\sin q_2|<0.03 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

InputSymbolUnitDefault
Solve fromsolve_fromJoint angles → position
Shoulder-to-elbow lengthL1m0.5
Elbow-to-tool lengthL2m0.4
Shoulder angle (▶ to rotate)
Counterclockwise from horizontal +x. Playback illustrates a sequence of static poses.
q1deg25
Relative elbow angle
Measured from link 1 to link 2, positive counterclockwise. Zero is straight.
q2deg70
Target xx_targetm0.55
Target yy_targetm0.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.
branchElbow down (q₂ ≥ 0)
Link 1 mass
Include hardware carried rigidly by link 1. Shoulder-mounted hardware adds no arm moment.
m1kg2
Link 2 massm2kg1
Tool and payload mass at tipmpkg0.5
Link 1 COM distance / length
Fraction from the shoulder along link 1. Use 0.5 for a uniform link.
f10.5
Link 2 COM distance / length
Fraction from the elbow along link 2. Use 0.5 for a uniform link.
f20.5
Gravity magnitude
Acts vertically downward (−y). Joint axes are perpendicular to this vertical plane.
g0m/s^29.81

Results

With the default inputs above, the calc gives:

ResultValue
Tool x0.4183 m
Tool y0.6098 m
Shoulder angle25 deg
Relative elbow angle70 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 reach0.1 m
Maximum reach0.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.

ResultSourceThis calc
Tool x1.366 m1.366 m
Tool y1.366 m1.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.

ResultSourceThis calc
Elbow down: shoulder angle30 deg30 deg
Elbow down: relative angle30 deg30 deg
Elbow up: shoulder angle60 deg60 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.

ResultSourceThis calc
Elbow down: shoulder angle-16.819 deg-16.819 deg
Elbow down: relative angle134 deg134 deg
Elbow up: shoulder angle117.2 deg117.2 deg
Elbow up: relative angle-134 deg-134 deg
Tool x0.5 m0.5 m
Tool y0.6 m0.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.

ResultSourceThis calc
Shoulder holding torque (signed)20.6 ± 0.05 N·m20.599 N·m
Elbow holding torque (signed)1.5 ± 0.05 N·m1.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.

ResultSourceThis calc
Shoulder angle-90 deg-90 deg
Relative elbow angle180 deg180 deg
Shoulder holding torque (signed)1.717 × 10⁻⁸ N·m1.717 × 10⁻⁸ N·m
Elbow holding torque (signed)4.905 × 10⁻⁹ N·m4.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.

ResultSourceThis calc
Shoulder angle90 deg90 deg
Relative elbow angle-180 deg-180 deg
Shoulder holding torque (signed)1.717 × 10⁻⁸ N·m1.717 × 10⁻⁸ N·m
Elbow holding torque (signed)4.905 × 10⁻⁹ N·m4.905 × 10⁻⁹ N·m

Related Resources

Responses

Your email address will not be published. Required fields are marked *

L ading...