FixTheRobot Explore Robotics / Linear Algebra / M7 / M7-L1

This lab works on phones, but writing code is much easier on a laptop.

Linear Algebra · Rotations and Rigid-Body Transformations · M7-L1 · Intermediate

Robot Coordinate Frame Explorer

Robot scenario

Scout's LiDAR says a pole stands 3.2 m away at a bearing of 20°. The map says the pole is at the green flag. Both are right: they just speak different coordinate frames, and the robot has to translate between them hundreds of times a second.

You will find where the robot must stand for the two statements to agree, see how swapping two matrices puts the pole metres away, and then write the two routines every robot contains: a sensor-to-world chain in the plane and a 3D chain with an exact inverse.

Your task

    Simulation
    solution.pyLoading Python…
    Ctrl+Enter runs
    What Python can I use?

    Plain Python with math and lakit (import lakit as la: vectors, matmul, solve, qr, svd, eigh, lstsq, pinv and more; NumPy is not available in the browser). Your code runs in a background worker: an endless loop is stopped after a few seconds and the page stays usable. It runs in your browser and is never sent anywhere.

    Hints

    What this lab teaches

    Stage 1 is hands-on: robot position and heading are draggable, and the measured pole is carried through the sensor mount and the pose. Stage 2 is the diagnosis: T_BS T_WB versus T_WB T_BS agree only at the origin. Stage 3 is the first fix you write: sensor_to_world builds the homogeneous transforms and multiplies them in the right order. Stage 4 generalises to 3D with frame_tools: a chain of 4 × 4 transforms, the exact inverse and a point in the sensor frame.

    Grading is result-based. Your functions run on the example and on freshly generated hidden poses, mounts and chains, and are compared with exact results to six decimal places. The hidden chains use random 3D rotations, because axis-aligned test cases hide most ordering and inversion bugs.

    You can use plain Python, math, and the small linear algebra library lakit (import lakit as la): la.matmul, la.matvec, la.transpose, la.eye and more. It runs in your browser; NumPy is not available there.

    Theory for this lab

    Rotations and Rigid-Body Transformations labs

    1. M7-L1: Robot Coordinate Frame Explorer: this lab.

    Educational simplification: exact rigid frames, no calibration error, time delay or motion distortion. Stages 1 to 3 are planar; stage 4 is full 3D with rotations built from axis and angle.

    Get the next lab

    Get notified when new robotics labs are released. One email per new lab, nothing else.