CrackRobotics

Step 1

Velocity kinematics

Measure how the gripper moves when each joint moves alone, and build the Jacobian one column at a time.

From positions to velocities

In Pick & Place you used forward kinematics, p=fk(q)p = \mathrm{fk}(q), to find the gripper from the joint angles. Controllers often need the next question: if the joints turn at speeds q˙\dot q, how fast does the gripper move?

Differentiate FK with the chain rule and a matrix appears, the Jacobian:

p˙=J(q) q˙,Jij=∂pi∂qj\dot p = J(q)\,\dot q, \qquad J_{ij} = \frac{\partial p_i}{\partial q_j}

The gripper moves in 3-D and the arm has 4 joints, so JJ is 3×43\times4. Column jj is the gripper velocity you get when joint jj turns at 1 rad/s and the others stay still. It depends on qq: the same joint speed moves the gripper differently in different poses.

Measuring a column

You don't need calculus to get JJ. Nudge one joint by a small hh both ways and see how the gripper moves:

J:,j≈fk(q+h ej)−fk(q−h ej)2hJ_{:,j} \approx \frac{\mathrm{fk}(q + h\,e_j) - \mathrm{fk}(q - h\,e_j)}{2h}

Here eje_j is 1 in slot jj and 0 elsewhere. This central difference has an error of order h2h^2, so a smaller hh is better, up to a point. Make hh too small and you subtract two almost equal numbers, and floating-point round-off takes over. h≈10−5h \approx 10^{-5} rad balances the two.

arm.fk(q) is unlocked in this lesson. It returns the grasp point for any q without moving the arm.

Your task

Implement jacobian_fd(q) so it returns a 3×43\times4 np.array.

The starter program sweeps every joint with a sine wave. In the Plots tab it compares two gripper speeds: one measured from arm.ee_position(), one predicted as ∥J(q) q˙∥\lVert J(q)\,\dot q\rVert using the joint velocities arm.qd. When your Jacobian is right, the curves lie on top of each other.

The grader compares your function with the exact Jacobian on 20 random configurations.

Goals

  • Program runs without errors
  • jacobian_fd(q) matches the exact Jacobian within 1e-3 (20 random poses)
  • Bonus: every entry within 1e-7 (choose h well)
Loading physics…
Loading 3D view…
0.0 / 0.0 s

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