CrackRobotics

Step 1

Forward kinematics

Chain one homogeneous transform per joint and link to get the gripper's full pose from the joint angles.

What it computes

Forward kinematics (FK) maps joint angles qq to the pose of the gripper: where it is and which way it points. Every other arm algorithm (IK, Jacobians, planning, control) calls it.

Homogeneous transforms

A pose is a 4×44 \times 4 matrix that holds a rotation RR and a position pp:

T=[Rp0  0  01]T = \begin{bmatrix} R & p \\ 0\;0\;0 & 1 \end{bmatrix}

Multiplying two transforms applies one after the other, each in the frame the previous one left you in. So FK of a serial arm is a product: one rotation per joint, and one translation per link.

This arm's chain

Start at the base on the table. The base joint turns about zz, and each pitch joint turns about the current yy axis. Every link runs along the current zz axis:

T(q)=Rz(q0)  Tz(h0)  Ry(q1)  Tz(L1)  Ry(q2)  Tz(L2)  Ry(q3)  Tz(L3)T(q) = R_z(q_0)\; T_z(h_0)\; R_y(q_1)\; T_z(L_1)\; R_y(q_2)\; T_z(L_2)\; R_y(q_3)\; T_z(L_3)
h0h_0L1L_1L2L_2L3L_3
metres0.120.300.250.12
Rz(a)=[cos⁡a−sin⁡a00sin⁡acos⁡a0000100001],Ry(a)=[cos⁡a0sin⁡a00100−sin⁡a0cos⁡a00001]R_z(a) = \begin{bmatrix} \cos a & -\sin a & 0 & 0 \\ \sin a & \cos a & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix}, \quad R_y(a) = \begin{bmatrix} \cos a & 0 & \sin a & 0 \\ 0 & 1 & 0 & 0 \\ -\sin a & 0 & \cos a & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix}

The last column of TT is the grasp point, and the third column of RR is the direction the gripper points.

See it in context

Pick & Place step 2 derives the same position with trigonometry. Transforms scale to any arm, and they give you the orientation for free.

Your task

Implement rot_z(a), rot_y(a) and fk(q), which returns the 4×44 \times 4 matrix T(q)T(q). The program then moves through three poses and draws your gripper frame at each one: x red, y green, z blue. The grader compares fk with the simulator on 30 random poses.

Goals

  • Program runs without errors
  • fk(q) returns the chain's 4×4 transform on 30 random poses
  • The position (within 1.0 mm) and gripper axis (within 0.5°) match the simulator on 30 random poses
Loading physics…
Loading 3D view…
0.0 / 0.0 s

Python is loading. It takes a few seconds the first time.