Experiments · simulation · VEX AIM

Code vs drivers, before the robot moves

Is our code better than us at driving? Now we can ask before the code ever touches the robot: run it hundreds of times in simulation, let simulated drivers play the same game, and compare.

Watch

Simulated. Top: the best sample routine and the best simulated driver. Bottom: the simplest routine and a rookie. Same table, same barrels, 45 seconds.

The game: sort the barrels

One VEX AIM robot, three orange and three blue barrels, a 6 × 4 ft table with an orange zone at one end and a blue zone at the other. Each barrel that ends up in the zone of its colour scores a point. Six points is perfect; there are 45 seconds.

The simulated AIM robot keeps to the real one’s limits: 200 mm/s at full speed, turns up to 150° a second, one barrel at a time on its magnet.

Verdict for the best routine: Better than the typical student driver by +1.3 points (95% range +1.1 to +1.6). Against the best simulated driver, Speedy Sloane, it's too close to call.

How it works

  1. 1

    Add the game once

    The field, the barrels, the zones and what scores, written down in one file. For a team's own game, we work it out from their code and a short description.

  2. 2

    Run the code, unchanged

    The team's VEXcode AIM Python runs against a simulated AIM robot: the same commands, the same speed limits, plus the wheel slip, camera noise and wobble that make every real run a little different.

  3. 3

    Let simulated drivers play

    Driver characters play the same game with a controller: each has a reaction time, steady or shaky steering, careful or rushed placing, good or bad choices, and the odd fumble.

  4. 4

    Get a verdict

    Every routine runs 20 times, every driver 12 times. Better, worse, or can't tell, with a range, so a lucky run can't decide it.

Four versions of the code, six drivers

Points out of 6 on layout dev-01. The verdict compares each routine with the typical student: the middle of a simulated class of 20 drivers, who averages 2.8 points.

RoutineIdeaAverageWorst / bestvs typical student
deadreckon_v1.pyA fixed plan with no sensors: drive to where each barrel should be, in the order they were measured.1.71 / 3Worse (-1.0, range -1.4 to -0.6)
vision_v2.pyAI Vision finds the nearest barrel and steers onto it; wheel counting gets it back to the zone.2.51 / 3Can't tell (-0.3, range -0.7 to 0.1)
vision_tags_v3.pyLike v2, then homes in on the AprilTag behind each zone for the last stretch.2.10 / 3Worse (-0.6, range -1.1 to -0.1)
planner_v4.pyPlans a smart order, drives at full speed, lets the camera do the last few centimetres, and spreads its drops across the zone.4.04 / 4Better (+1.3, range 1.1 to 1.6)

The simulated drivers

DriverWhat they’re likeReactionSpeed usedAveragevs planner_v4.py
Speedy SloaneFull speed everywhere. Fast when it works, messy when it doesn't.0.30 s100%4.1code is too close to call
Pro PriyaThe team's best driver: quick reactions, clean lines, smart order.0.22 s95%3.8code is too close to call
Average AlexA typical student driver after a few sessions.0.40 s70%2.8code is better
Nervous NoahKnows what to do but stops to think a lot.0.45 s60%2.3code is better
Steady SamSlow and careful. Rarely makes a mistake.0.35 s55%2.1code is better
Rookie RileyFirst week with the controller. Slow to react, overshoots, sometimes heads for the wrong barrel.0.55 s55%1.9code is better

What the simulation caught

  • Smart order beats clever sensing

    The tag-homing routine looks more advanced, but it spends its seconds turning to find the tag. Planning the order and driving at full speed did more.

  • Don’t drop on the same spot

    Routines that put every barrel in the middle of the zone drove into the one already there, and the magnet picked it back up. Spreading the drops fixed it.

  • 45 seconds is tight for AIM

    At 200 mm/s nobody, code or driver, sorts all six. The best runs score 4 or 5. Either the time limit grows, or “how many in 45 seconds” is the measure.

What this can and can’t tell you

  • It’s a simulation. It tells you which version of your code to try on the robot first, not how the robot will actually do. Real fields, batteries and barrels differ from any model.
  • The drivers are made-up characters chosen to span a classroom, not measurements of real students. Filming a few real runs per driver would let us tune them.
  • The AIM robot model uses the published speed limits; its size, acceleration, camera view and friction are our estimates.
  • The sample routines are ours, written to show the range. Your team’s code runs exactly the same way.

Try it with your own code: motionbench game verdict games/aim-sort --code my_routine.py. How games are defined and how the simulator works: docs/games.md.