CrackRobotics

You haven't finished Step 1: Joints, targets & PD control yet. This step builds on it.

Step 3

Inverse kinematics & straight-line motion

Turn positions into joint angles, then move the gripper along straight lines with smooth, jerk-free timing.

Running FK backwards

Tasks are usually stated in the world ("put the gripper here"), but motors only understand joint angles. Inverse kinematics (IK) solves for the configuration that places the gripper at a target p\mathbf{p}:

q=IK⁡(p)q = \operatorname{IK}(\mathbf{p})

For now you get a solver: arm.ik(p) returns joint angles that put the grasp point at p with the gripper pointing straight down. You'll write your own in the bonus step.

Joint space vs. Cartesian space

Interpolating the joint angles from qAq_A to qBq_B is simple, and it's what move_joints does. The gripper's path, however, comes out curved, because every joint turns at once. That's fine in open air. Near objects you want the gripper to travel in a predictable straight line.

Motion planners like MoveIt handle this with a Cartesian path: they sample points along the line and solve IK at every step.

p(t)=pA+s(t) (pB−pA),q(t)=IK⁡(p(t))\mathbf{p}(t) = \mathbf{p}_A + s(t)\,(\mathbf{p}_B - \mathbf{p}_A), \qquad q(t) = \operatorname{IK}(\mathbf{p}(t))

Timing: minimum jerk

If ss went linearly from 0 to 1, the gripper would start and stop instantly. That means infinite acceleration, which makes a real arm jolt. The classic fix is the minimum-jerk profile, with τ=t/T\tau = t/T:

s(τ)=10τ3−15τ4+6τ5s(\tau) = 10\tau^3 - 15\tau^4 + 6\tau^5

It starts and ends with zero velocity and zero acceleration.

Your task

The three yellow markers are waypoints (world.targets()). Implement min_jerk and move_linear, then trace the waypoints in order. Your path must stay within 2 cm of each straight segment between them.

The starter code uses move_joints. Run it first and look at the orange trail: the path bows away from the straight lines.

Send new joint targets every 10 ms, which is a typical control rate.

Goals

  • Program runs without errors
  • Visited all three waypoints in order (within 1.5 cm)
  • Straight lines between waypoints (within 2 cm)
  • Smooth motion (gripper never faster than 0.8 m/s)
Loading physics…
Loading 3D view…
0.0 / 0.0 s

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