Project 6: Cartesian circle tracking

Level 8 (after Lessons 8.3 and 6.3) · Time 3 to 4 hours · Difficulty 3 of 5

Objective

Operational-space control of models/arm7.xml: the ee site follows a horizontal circle of radius 10 cm at 0.5 Hz, while a posture term in the null space of the task keeps the elbow where it started. Then give the controller a wrong model of the robot (every link’s mass and inertia halved) and measure what that costs.

Prerequisites

Starter code

Expected behaviour

The arm starts at the home keyframe and tracks for 6 s (three cycles). The error is measured after the first cycle.

A measurement trap. In a first version of this project’s own measurement script, the end-effector position was read right after mj_step. That position is the pre-step pose, one step of travel behind (0.314 m/s × 2 ms = 0.63 mm). It reported an RMS error of 0.61 mm, eight times the true 0.074 mm. The test calls mj_kinematics before reading.

Tests

MJC_IMPL=starter pytest projects/p06_osc_circle
pytest projects/p06_osc_circle

Four tests:

The common failures are mutants in mutants.json; python tools/mutate_project.py p06_osc_circle checks that each one fails a test.

Common failures

Extension challenges

  1. Add orientation control: keep the tool pointing down to within 1 degree around the whole circle.
  2. Close the mismatch gap without fixing the model: add an integral term or an online estimate of the gravity load, and report the error with halved masses again.
  3. Cartesian impedance: replace the circle with a wall at a known height and press on it with 10 N; measure the force from the contact.

Solution

solution.py, about 50 lines.