FixTheRobot Explore Robotics / Navigation / M1 / M1-L2

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

Navigation · Navigation Foundations · M1-L2 · Beginner

Drive the Robot: Unicycle and Car-Like Models

07:12. The overnight simulation said Scout would reach the pharmacy with 10 cm to spare. On the real floor it ended up 40 cm to the left, and nobody can say whether the robot or the simulator is wrong. Facilities also want to know whether the new car-like tug can turn around in the east corridor, which is 2.0 m wide.

Both questions depend on the same thing: a correct model of how the robot moves. You will write the motion step for a differential-drive robot and for a car-like one, check them against hidden scenarios, and answer the corridor question with numbers.

Your task

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

    Plain Python with math and heapq. 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 the unicycle step. The simple version, which many first simulators use, keeps the old heading for the whole step and drifts off the circle the robot really follows. You replace it with the exact arc and handle the straight-line case, including a turn rate so small that the arc formula loses precision. Stage 2 is the bicycle model: the turn rate of a car-like robot comes from its speed, steering angle and wheelbase. Stage 3 turns the two models into a design question: how much corridor does a U-turn need for a robot that spins on the spot and for one with a steering limit?

    Grading is result-based: your function is run on the practice example and on freshly generated hidden steps, and compared with the exact answer. A step that is only right when the turn rate is zero, or only right when the time step is small, will be caught.

    Theory for this lab

    Navigation Foundations labs

    1. M1-L1: Read a Failed Run
    2. M1-L2: Drive the Robot: Unicycle and Car-Like Models: this lab.
    3. M1-L3: Score a Navigation Run

    Educational simplification: a flat floor, no wheel slip, constant speed and steering over each step, the rear axle as the reference point of the car-like model, and no overhang of the body beyond the wheels. The exact-arc step is exact only under those assumptions; real robots add slip, latency and acceleration limits (lessons M1-T3 and M5-T3).

    Get the next lab

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