<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
    <title>storagebits · #robotics</title>
    <subtitle>Firmware, TV apps, a homelab, built at night with an organization of AI agents. And blok, the workshop notebook.</subtitle>
    <link rel="self" type="application/atom+xml" href="https://blok.storagebits.workers.dev/tags/robotics/atom.xml"/>
    <link rel="alternate" type="text/html" href="https://blok.storagebits.workers.dev"/>
    <generator uri="https://www.getzola.org/">Zola</generator>
    <updated>2026-11-15T17:33:27-05:00</updated>
    <id>https://blok.storagebits.workers.dev/tags/robotics/atom.xml</id>
    <entry xml:lang="en">
        <title>Two micro:bit robots play cat and mouse, built in one evening</title>
        <published>2026-11-15T17:33:27-05:00</published>
        <updated>2026-11-15T17:33:27-05:00</updated>
        <author><name>François</name></author>
        <link rel="alternate" type="text/html" href="https://blok.storagebits.workers.dev/blog/microbrawl/"/>
        <id>https://blok.storagebits.workers.dev/blog/microbrawl/</id>
        <summary type="html">Two micro:bit robots bought during Covid, a Raspberry Pi, a camera on the ceiling and ArUco markers printed on paper: in one evening, a robotics POC you drive from the web.</summary>
        <content type="html" xml:base="https://blok.storagebits.workers.dev/blog/microbrawl/">&lt;p&gt;I bought these two robots during Covid, to do a bit of electronics. I liked the idea behind the &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://microbit.org/&quot;&gt;micro:bit&lt;/a&gt;, especially with &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://makecode.microbit.org/&quot;&gt;MakeCode&lt;/a&gt; and its visual programming, and I wanted to get my kids into it. Then came Kitronik’s &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://kitronik.co.uk/products/5652-move-mini-mk2-buggy-kit-excl-microbit&quot;&gt;:MOVE mini&lt;/a&gt; chassis, so the boards could move around. We had already done a small project to drive them with arcade controllers. It was nice, but it took me several months of weekends.&lt;/p&gt;
&lt;p&gt;On Saturday, I took them out again. With AI, I built a far more advanced POC in one evening: two robots playing cat and mouse on a table, tracked by a camera on the ceiling, driven from a web page by any visitor, or by an AI when nobody shows up. The brief went out at 5:53 pm, the demo was filmed at 11:30 pm. In between came flashing the robots, spatial detection, and a library I had never heard of: ArUco, the marker one.&lt;/p&gt;
&lt;figure class=&quot;video&quot;&gt;&lt;video controls muted playsinline preload=&quot;metadata&quot; poster=&quot;demo-poster.jpg&quot;&gt;&lt;source src=&quot;demo.mp4&quot; type=&quot;video/mp4&quot;&gt;&lt;/video&gt;&lt;figcaption&gt;The demo edit, 33 seconds without sound: AI against AI, seen from the track, the stand and the sky, with the slow-motion replay of a tag.&lt;/figcaption&gt;&lt;/figure&gt;
&lt;h2 id=&quot;the-setup&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#the-setup&quot; aria-label=&quot;Anchor link for: the-setup&quot;&gt;#&lt;/a&gt;
The setup&lt;/h2&gt;
&lt;p&gt;At the start, there is a Raspberry Pi 4 with 2 GB, a USB webcam fixed at the end of a plank above a white table, and the two robots. My brief fit in one dictated message: a web interface with SpaceX-style telemetry, a first game where one robot has to touch the other, a queue for visitors, driving with the arrow keys or ZQSD, and AI somewhere. The code would live on my Mac and run on the Pi.&lt;/p&gt;
&lt;figure class=&quot;portrait&quot;&gt;&lt;img src=&quot;scene.webp&quot; alt=&quot;A corner of a home office: a shelf with an old Tandon PC and its monitor, the Raspberry Pi&#39;s screen below, a plank sticking out of the shelf with a webcam at its end, above a white table where the two small robots wait.&quot; width=&quot;1050&quot; height=&quot;1490&quot; loading=&quot;lazy&quot;&gt;&lt;figcaption&gt;The setup at the start: the USB webcam at the end of its plank, the white table that serves as the arena, and the Pi&#39;s screen at the bottom left.&lt;/figcaption&gt;&lt;/figure&gt;
&lt;p&gt;Twenty minutes later, the first commit held the complete system: firmware, server, vision, referee, AI opponent and interface. Nothing had run on a real robot yet.&lt;/p&gt;
&lt;h2 id=&quot;the-architecture&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#the-architecture&quot; aria-label=&quot;Anchor link for: the-architecture&quot;&gt;#&lt;/a&gt;
The architecture&lt;/h2&gt;
&lt;figure class=&quot;sys sys-archi&quot;&gt;&lt;div class=&quot;defile&quot; tabindex=&quot;0&quot; role=&quot;region&quot; aria-label=&quot;micro:brawl architecture, scrollable horizontally&quot;&gt;&lt;svg viewBox=&quot;0 0 760 350&quot; role=&quot;img&quot; aria-labelledby=&quot;ar-t ar-d&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;title id=&quot;ar-t&quot;&gt;micro:brawl architecture&lt;/title&gt;&lt;desc id=&quot;ar-d&quot;&gt;Two micro:bit robots talk to the Raspberry Pi 4 over Bluetooth Low Energy: wheel commands at 20 Hz one way, telemetry the other. Three cameras send their MJPEG stream to the Pi: a phone on the ceiling for tracking, a USB webcam and an old laptop at table level for the show. On the Pi, a FastAPI server runs the Bluetooth link, ArUco vision, the referee and the AI, and the replays. The browser receives the state ten times a second over WebSocket and the video as MJPEG, and sends back the driver&#39;s keys.&lt;/desc&gt;&lt;defs&gt;&lt;marker id=&quot;ar-fl&quot; viewBox=&quot;0 0 10 10&quot; refX=&quot;9&quot; refY=&quot;5&quot; markerWidth=&quot;7&quot; markerHeight=&quot;7&quot; orient=&quot;auto-start-reverse&quot;&gt;&lt;path class=&quot;sys-pointe&quot; d=&quot;M0,0 L10,5 L0,10 z&quot;/&gt;&lt;/marker&gt;&lt;/defs&gt;
&lt;rect class=&quot;sys-boite&quot; x=&quot;170&quot; y=&quot;10&quot; width=&quot;140&quot; height=&quot;58&quot; rx=&quot;6&quot;/&gt;&lt;text x=&quot;240&quot; y=&quot;31&quot; class=&quot;sys-titre&quot; text-anchor=&quot;middle&quot;&gt;Phone on the ceiling&lt;/text&gt;&lt;text x=&quot;240&quot; y=&quot;48&quot; class=&quot;sys-detail&quot; text-anchor=&quot;middle&quot;&gt;sky view, 720p&lt;/text&gt;&lt;text x=&quot;240&quot; y=&quot;61&quot; class=&quot;sys-detail&quot; text-anchor=&quot;middle&quot;&gt;used for tracking&lt;/text&gt;
&lt;rect class=&quot;sys-boite&quot; x=&quot;320&quot; y=&quot;10&quot; width=&quot;140&quot; height=&quot;58&quot; rx=&quot;6&quot;/&gt;&lt;text x=&quot;390&quot; y=&quot;31&quot; class=&quot;sys-titre&quot; text-anchor=&quot;middle&quot;&gt;Webcam USB&lt;/text&gt;&lt;text x=&quot;390&quot; y=&quot;48&quot; class=&quot;sys-detail&quot; text-anchor=&quot;middle&quot;&gt;track view&lt;/text&gt;&lt;text x=&quot;390&quot; y=&quot;61&quot; class=&quot;sys-detail&quot; text-anchor=&quot;middle&quot;&gt;show and replays&lt;/text&gt;
&lt;rect class=&quot;sys-boite&quot; x=&quot;470&quot; y=&quot;10&quot; width=&quot;140&quot; height=&quot;58&quot; rx=&quot;6&quot;/&gt;&lt;text x=&quot;540&quot; y=&quot;31&quot; class=&quot;sys-titre&quot; text-anchor=&quot;middle&quot;&gt;Old laptop&lt;/text&gt;&lt;text x=&quot;540&quot; y=&quot;48&quot; class=&quot;sys-detail&quot; text-anchor=&quot;middle&quot;&gt;stand view, low angle&lt;/text&gt;&lt;text x=&quot;540&quot; y=&quot;61&quot; class=&quot;sys-detail&quot; text-anchor=&quot;middle&quot;&gt;streams on demand&lt;/text&gt;
&lt;line class=&quot;sys-fil&quot; x1=&quot;240&quot; y1=&quot;68&quot; x2=&quot;320&quot; y2=&quot;118&quot; marker-end=&quot;url(#ar-fl)&quot;/&gt;&lt;line class=&quot;sys-fil&quot; x1=&quot;390&quot; y1=&quot;68&quot; x2=&quot;385&quot; y2=&quot;118&quot; marker-end=&quot;url(#ar-fl)&quot;/&gt;&lt;line class=&quot;sys-fil&quot; x1=&quot;540&quot; y1=&quot;68&quot; x2=&quot;450&quot; y2=&quot;118&quot; marker-end=&quot;url(#ar-fl)&quot;/&gt;&lt;text x=&quot;470&quot; y=&quot;100&quot; class=&quot;sys-etiquette&quot;&gt;MJPEG&lt;/text&gt;
&lt;rect class=&quot;sys-boite&quot; x=&quot;10&quot; y=&quot;130&quot; width=&quot;160&quot; height=&quot;80&quot; rx=&quot;6&quot;/&gt;&lt;text x=&quot;90&quot; y=&quot;152&quot; class=&quot;sys-titre&quot; text-anchor=&quot;middle&quot;&gt;Robot A&lt;/text&gt;&lt;text x=&quot;90&quot; y=&quot;171&quot; class=&quot;sys-detail&quot; text-anchor=&quot;middle&quot;&gt;micro:bit V1.5 + :MOVE mini&lt;/text&gt;&lt;text x=&quot;90&quot; y=&quot;186&quot; class=&quot;sys-detail&quot; text-anchor=&quot;middle&quot;&gt;MakeCode firmware&lt;/text&gt;&lt;text x=&quot;90&quot; y=&quot;201&quot; class=&quot;sys-detail&quot; text-anchor=&quot;middle&quot;&gt;wheels stop after 400 ms&lt;/text&gt;
&lt;rect class=&quot;sys-boite&quot; x=&quot;10&quot; y=&quot;240&quot; width=&quot;160&quot; height=&quot;80&quot; rx=&quot;6&quot;/&gt;&lt;text x=&quot;90&quot; y=&quot;262&quot; class=&quot;sys-titre&quot; text-anchor=&quot;middle&quot;&gt;Robot B&lt;/text&gt;&lt;text x=&quot;90&quot; y=&quot;281&quot; class=&quot;sys-detail&quot; text-anchor=&quot;middle&quot;&gt;micro:bit V1.5 + :MOVE mini&lt;/text&gt;&lt;text x=&quot;90&quot; y=&quot;296&quot; class=&quot;sys-detail&quot; text-anchor=&quot;middle&quot;&gt;MakeCode firmware&lt;/text&gt;&lt;text x=&quot;90&quot; y=&quot;311&quot; class=&quot;sys-detail&quot; text-anchor=&quot;middle&quot;&gt;wheels stop after 400 ms&lt;/text&gt;
&lt;line class=&quot;sys-fil&quot; x1=&quot;172&quot; y1=&quot;170&quot; x2=&quot;268&quot; y2=&quot;190&quot; marker-start=&quot;url(#ar-fl)&quot; marker-end=&quot;url(#ar-fl)&quot;/&gt;&lt;line class=&quot;sys-fil&quot; x1=&quot;172&quot; y1=&quot;280&quot; x2=&quot;268&quot; y2=&quot;260&quot; marker-start=&quot;url(#ar-fl)&quot; marker-end=&quot;url(#ar-fl)&quot;/&gt;&lt;text x=&quot;220&quot; y=&quot;222&quot; class=&quot;sys-etiquette&quot; text-anchor=&quot;middle&quot;&gt;Bluetooth LE&lt;/text&gt;&lt;text x=&quot;220&quot; y=&quot;237&quot; class=&quot;sys-detail&quot; text-anchor=&quot;middle&quot;&gt;wheels 20 Hz →&lt;/text&gt;&lt;text x=&quot;220&quot; y=&quot;250&quot; class=&quot;sys-detail&quot; text-anchor=&quot;middle&quot;&gt;← accel, temp.&lt;/text&gt;
&lt;rect class=&quot;sys-boite&quot; x=&quot;270&quot; y=&quot;120&quot; width=&quot;220&quot; height=&quot;210&quot; rx=&quot;6&quot;/&gt;&lt;text x=&quot;380&quot; y=&quot;143&quot; class=&quot;sys-titre&quot; text-anchor=&quot;middle&quot;&gt;Raspberry Pi 4 · 2 GB&lt;/text&gt;&lt;text x=&quot;380&quot; y=&quot;160&quot; class=&quot;sys-detail&quot; text-anchor=&quot;middle&quot;&gt;one FastAPI server&lt;/text&gt;
&lt;text x=&quot;290&quot; y=&quot;190&quot; class=&quot;sys-code&quot;&gt;robots.py&lt;/text&gt;&lt;text x=&quot;372&quot; y=&quot;190&quot; class=&quot;sys-detail&quot;&gt;BLE link, reconnects&lt;/text&gt;
&lt;text x=&quot;290&quot; y=&quot;218&quot; class=&quot;sys-code&quot;&gt;vision.py&lt;/text&gt;&lt;text x=&quot;372&quot; y=&quot;218&quot; class=&quot;sys-detail&quot;&gt;ArUco → cm&lt;/text&gt;
&lt;text x=&quot;290&quot; y=&quot;246&quot; class=&quot;sys-code&quot;&gt;game.py&lt;/text&gt;&lt;text x=&quot;372&quot; y=&quot;246&quot; class=&quot;sys-detail&quot;&gt;referee and AI, 20 Hz&lt;/text&gt;
&lt;text x=&quot;290&quot; y=&quot;274&quot; class=&quot;sys-code&quot;&gt;replay.py&lt;/text&gt;&lt;text x=&quot;372&quot; y=&quot;274&quot; class=&quot;sys-detail&quot;&gt;replays of tags&lt;/text&gt;
&lt;text x=&quot;290&quot; y=&quot;302&quot; class=&quot;sys-code&quot;&gt;web/&lt;/text&gt;&lt;text x=&quot;372&quot; y=&quot;302&quot; class=&quot;sys-detail&quot;&gt;the telemetry page&lt;/text&gt;
&lt;rect class=&quot;sys-boite&quot; x=&quot;600&quot; y=&quot;160&quot; width=&quot;150&quot; height=&quot;110&quot; rx=&quot;6&quot;/&gt;&lt;text x=&quot;675&quot; y=&quot;183&quot; class=&quot;sys-titre&quot; text-anchor=&quot;middle&quot;&gt;Browser&lt;/text&gt;&lt;text x=&quot;675&quot; y=&quot;203&quot; class=&quot;sys-detail&quot; text-anchor=&quot;middle&quot;&gt;telemetry, video,&lt;/text&gt;&lt;text x=&quot;675&quot; y=&quot;218&quot; class=&quot;sys-detail&quot; text-anchor=&quot;middle&quot;&gt;queue&lt;/text&gt;&lt;text x=&quot;675&quot; y=&quot;240&quot; class=&quot;sys-detail&quot; text-anchor=&quot;middle&quot;&gt;arrows, ZQSD or WASD&lt;/text&gt;&lt;text x=&quot;675&quot; y=&quot;255&quot; class=&quot;sys-detail&quot; text-anchor=&quot;middle&quot;&gt;to drive&lt;/text&gt;
&lt;line class=&quot;sys-fil&quot; x1=&quot;492&quot; y1=&quot;190&quot; x2=&quot;598&quot; y2=&quot;190&quot; marker-end=&quot;url(#ar-fl)&quot;/&gt;&lt;text x=&quot;545&quot; y=&quot;182&quot; class=&quot;sys-detail&quot; text-anchor=&quot;middle&quot;&gt;state, 10 Hz&lt;/text&gt;&lt;line class=&quot;sys-fil&quot; x1=&quot;492&quot; y1=&quot;222&quot; x2=&quot;598&quot; y2=&quot;222&quot; marker-end=&quot;url(#ar-fl)&quot;/&gt;&lt;text x=&quot;545&quot; y=&quot;214&quot; class=&quot;sys-detail&quot; text-anchor=&quot;middle&quot;&gt;MJPEG video&lt;/text&gt;&lt;line class=&quot;sys-fil&quot; x1=&quot;598&quot; y1=&quot;254&quot; x2=&quot;492&quot; y2=&quot;254&quot; marker-end=&quot;url(#ar-fl)&quot;/&gt;&lt;text x=&quot;545&quot; y=&quot;246&quot; class=&quot;sys-detail&quot; text-anchor=&quot;middle&quot;&gt;keys&lt;/text&gt;&lt;text x=&quot;545&quot; y=&quot;272&quot; class=&quot;sys-etiquette&quot; text-anchor=&quot;middle&quot;&gt;WebSocket&lt;/text&gt;
&lt;/svg&gt;&lt;/div&gt;&lt;figcaption&gt;Everything goes through the Pi: one connection per camera, however many spectators there are. Only the sky view is used for tracking; the other two do the show and the replays.&lt;/figcaption&gt;&lt;/figure&gt;
&lt;p&gt;The Pi does everything. It talks to both micro:bits over Bluetooth Low Energy, with &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://github.com/hbldh/bleak&quot;&gt;bleak&lt;/a&gt;: it sends the wheel speeds 20 times a second and receives acceleration, shocks and temperature. It reads the cameras, referees the game, runs the AI and serves the interface, a &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://fastapi.tiangolo.com/&quot;&gt;FastAPI&lt;/a&gt; application. The browser receives the game state ten times a second over WebSocket, and the video as MJPEG.&lt;/p&gt;
&lt;p&gt;The firmware knows nothing about left, right or calibration: it applies raw speeds to the two servos. The Pi does the translation, so a robot can be tuned without reflashing it. If no command arrives for 400 ms, the wheels stop.&lt;/p&gt;
&lt;h2 id=&quot;flashing-a-sad-face-and-020&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#flashing-a-sad-face-and-020&quot; aria-label=&quot;Anchor link for: flashing-a-sad-face-and-020&quot;&gt;#&lt;/a&gt;
Flashing: a sad face and “020”&lt;/h2&gt;
&lt;p&gt;The first flash failed. The micro:bit showed a 0, a 2 and a sad face: error 020, out of memory. My boards are V1.5s, with 16 KB of RAM, and the MakeCode Bluetooth stack does not fit with all its services. The agent turned off the ones that served no purpose here: over-the-air updates, events, device information and partial flashing. The program started.&lt;/p&gt;
&lt;p&gt;The flashing itself needs nothing from me. A script waits for the board to show up on the Mac as a USB drive, copies the compiled firmware onto it, waits for it to remount and checks that it reports no error. During the evening, one of the micro:bits ended up with a blank screen: reflashing it took twenty seconds.&lt;/p&gt;
&lt;p&gt;The rest of the lost time was physical. The robots would no longer switch on, and I went out to buy batteries.&lt;/p&gt;
&lt;h2 id=&quot;aruco-the-library-i-did-not-know&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#aruco-the-library-i-did-not-know&quot; aria-label=&quot;Anchor link for: aruco-the-library-i-did-not-know&quot;&gt;#&lt;/a&gt;
ArUco, the library I did not know&lt;/h2&gt;
&lt;p&gt;To know where the robots are, the agent suggested &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://www.uco.es/investiga/grupos/ava/portfolio/aruco/&quot;&gt;ArUco&lt;/a&gt;, square black-and-white markers whose detection is built into &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://docs.opencv.org/4.x/d5/dae/tutorial_aruco_detection.html&quot;&gt;OpenCV&lt;/a&gt;. I did not know it at all. It does exactly what I needed: identify each robot, know which way it is heading, and locate it in space, very fast.&lt;/p&gt;
&lt;p&gt;A marker is a 4 × 4 grid inside a black border. The pattern gives an identifier, 1 for robot A and 2 for B, and the order of the four corners gives the orientation: the top edge of the marker is the front of the robot. What remains is going from pixels to centimetres. I click the four corners of the table once in the interface, and a homography projects every point of the image onto an 84 × 55 cm rectangle.&lt;/p&gt;
&lt;figure class=&quot;sys sys-vision&quot;&gt;&lt;div class=&quot;defile&quot; tabindex=&quot;0&quot; role=&quot;region&quot; aria-label=&quot;From the ArUco marker to a position in centimetres, scrollable horizontally&quot;&gt;&lt;svg viewBox=&quot;0 0 760 330&quot; role=&quot;img&quot; aria-labelledby=&quot;vi-t vi-d&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;title id=&quot;vi-t&quot;&gt;From the ArUco marker to a position in centimetres&lt;/title&gt;&lt;desc id=&quot;vi-d&quot;&gt;Each 1280 by 720 frame from the ceiling camera is decoded straight to half size, in grey. OpenCV looks for markers from the 4x4_50 dictionary: identifier 1 is robot A, 2 is robot B, and each marker found gives its four corners in order. A homography, computed from the four table corners clicked once in the interface, turns those image points into centimetres on an 84 by 55 cm table. The marker&#39;s centre gives the position, the middle of its top edge gives the robot&#39;s front, hence its heading.&lt;/desc&gt;&lt;defs&gt;&lt;marker id=&quot;vi-fl&quot; viewBox=&quot;0 0 10 10&quot; refX=&quot;9&quot; refY=&quot;5&quot; markerWidth=&quot;7&quot; markerHeight=&quot;7&quot; orient=&quot;auto-start-reverse&quot;&gt;&lt;path class=&quot;sys-pointe&quot; d=&quot;M0,0 L10,5 L0,10 z&quot;/&gt;&lt;/marker&gt;&lt;marker id=&quot;vi-fl2&quot; viewBox=&quot;0 0 10 10&quot; refX=&quot;9&quot; refY=&quot;5&quot; markerWidth=&quot;6&quot; markerHeight=&quot;6&quot; orient=&quot;auto&quot;&gt;&lt;path style=&quot;fill:var(--sys-sain)&quot; d=&quot;M0,0 L10,5 L0,10 z&quot;/&gt;&lt;/marker&gt;&lt;/defs&gt;
&lt;rect class=&quot;sys-boite&quot; x=&quot;10&quot; y=&quot;20&quot; width=&quot;132&quot; height=&quot;96&quot; rx=&quot;6&quot;/&gt;&lt;text x=&quot;76&quot; y=&quot;42&quot; class=&quot;sys-titre&quot; text-anchor=&quot;middle&quot;&gt;Ceiling frame&lt;/text&gt;&lt;text x=&quot;76&quot; y=&quot;70&quot; class=&quot;sys-valeur&quot; text-anchor=&quot;middle&quot;&gt;1280×720&lt;/text&gt;&lt;text x=&quot;76&quot; y=&quot;94&quot; class=&quot;sys-detail&quot; text-anchor=&quot;middle&quot;&gt;MJPEG from the phone&lt;/text&gt;
&lt;rect class=&quot;sys-boite&quot; x=&quot;162&quot; y=&quot;20&quot; width=&quot;132&quot; height=&quot;96&quot; rx=&quot;6&quot;/&gt;&lt;text x=&quot;228&quot; y=&quot;42&quot; class=&quot;sys-titre&quot; text-anchor=&quot;middle&quot;&gt;Decode at ½&lt;/text&gt;&lt;text x=&quot;228&quot; y=&quot;70&quot; class=&quot;sys-valeur&quot; text-anchor=&quot;middle&quot;&gt;640×360&lt;/text&gt;&lt;text x=&quot;228&quot; y=&quot;94&quot; class=&quot;sys-detail&quot; text-anchor=&quot;middle&quot;&gt;grey, from the JPEG&lt;/text&gt;
&lt;rect class=&quot;sys-boite&quot; x=&quot;314&quot; y=&quot;20&quot; width=&quot;132&quot; height=&quot;96&quot; rx=&quot;6&quot;/&gt;&lt;text x=&quot;380&quot; y=&quot;42&quot; class=&quot;sys-code&quot; text-anchor=&quot;middle&quot;&gt;detectMarkers&lt;/text&gt;&lt;text x=&quot;380&quot; y=&quot;70&quot; class=&quot;sys-valeur&quot; text-anchor=&quot;middle&quot;&gt;15 ms&lt;/text&gt;&lt;text x=&quot;380&quot; y=&quot;94&quot; class=&quot;sys-detail&quot; text-anchor=&quot;middle&quot;&gt;id 1 = A, id 2 = B&lt;/text&gt;&lt;text x=&quot;380&quot; y=&quot;108&quot; class=&quot;sys-detail&quot; text-anchor=&quot;middle&quot;&gt;4 corners, in order&lt;/text&gt;
&lt;rect class=&quot;sys-boite&quot; x=&quot;466&quot; y=&quot;20&quot; width=&quot;132&quot; height=&quot;96&quot; rx=&quot;6&quot;/&gt;&lt;text x=&quot;532&quot; y=&quot;42&quot; class=&quot;sys-titre&quot; text-anchor=&quot;middle&quot;&gt;Homography&lt;/text&gt;&lt;text x=&quot;532&quot; y=&quot;70&quot; class=&quot;sys-valeur&quot; text-anchor=&quot;middle&quot;&gt;4 clicks&lt;/text&gt;&lt;text x=&quot;532&quot; y=&quot;94&quot; class=&quot;sys-detail&quot; text-anchor=&quot;middle&quot;&gt;table corners&lt;/text&gt;&lt;text x=&quot;532&quot; y=&quot;108&quot; class=&quot;sys-detail&quot; text-anchor=&quot;middle&quot;&gt;pixels → cm&lt;/text&gt;
&lt;rect class=&quot;sys-boite&quot; x=&quot;618&quot; y=&quot;20&quot; width=&quot;132&quot; height=&quot;96&quot; rx=&quot;6&quot;/&gt;&lt;text x=&quot;684&quot; y=&quot;42&quot; class=&quot;sys-titre&quot; text-anchor=&quot;middle&quot;&gt;Robot pose&lt;/text&gt;&lt;text x=&quot;684&quot; y=&quot;70&quot; class=&quot;sys-valeur&quot; text-anchor=&quot;middle&quot;&gt;x, y, heading&lt;/text&gt;&lt;text x=&quot;684&quot; y=&quot;94&quot; class=&quot;sys-detail&quot; text-anchor=&quot;middle&quot;&gt;and smoothed speed&lt;/text&gt;
&lt;line class=&quot;sys-fil&quot; x1=&quot;142&quot; y1=&quot;68&quot; x2=&quot;160&quot; y2=&quot;68&quot; marker-end=&quot;url(#vi-fl)&quot;/&gt;&lt;line class=&quot;sys-fil&quot; x1=&quot;294&quot; y1=&quot;68&quot; x2=&quot;312&quot; y2=&quot;68&quot; marker-end=&quot;url(#vi-fl)&quot;/&gt;&lt;line class=&quot;sys-fil&quot; x1=&quot;446&quot; y1=&quot;68&quot; x2=&quot;464&quot; y2=&quot;68&quot; marker-end=&quot;url(#vi-fl)&quot;/&gt;&lt;line class=&quot;sys-fil&quot; x1=&quot;598&quot; y1=&quot;68&quot; x2=&quot;616&quot; y2=&quot;68&quot; marker-end=&quot;url(#vi-fl)&quot;/&gt;
&lt;text x=&quot;10&quot; y=&quot;160&quot; class=&quot;sys-etiquette&quot;&gt;Robot A&#39;s marker (id 1), seen from the ceiling&lt;/text&gt;
&lt;rect x=&quot;30&quot; y=&quot;180&quot; width=&quot;120&quot; height=&quot;120&quot; fill=&quot;#fff&quot; stroke=&quot;var(--divider-color)&quot;/&gt;&lt;rect x=&quot;40&quot; y=&quot;190&quot; width=&quot;100&quot; height=&quot;100&quot; fill=&quot;#111&quot;/&gt;
&lt;g fill=&quot;#fff&quot;&gt;&lt;rect x=&quot;56.67&quot; y=&quot;223.33&quot; width=&quot;66.67&quot; height=&quot;16.67&quot;/&gt;&lt;rect x=&quot;56.67&quot; y=&quot;240&quot; width=&quot;16.67&quot; height=&quot;33.33&quot;/&gt;&lt;rect x=&quot;106.67&quot; y=&quot;240&quot; width=&quot;16.67&quot; height=&quot;16.67&quot;/&gt;&lt;rect x=&quot;90&quot; y=&quot;256.67&quot; width=&quot;16.67&quot; height=&quot;16.67&quot;/&gt;&lt;/g&gt;
&lt;circle cx=&quot;90&quot; cy=&quot;240&quot; r=&quot;4&quot; class=&quot;sys-marque sys-sain&quot;/&gt;&lt;line class=&quot;sys-sain-trait&quot; x1=&quot;90&quot; y1=&quot;240&quot; x2=&quot;90&quot; y2=&quot;198&quot; marker-end=&quot;url(#vi-fl2)&quot;/&gt;
&lt;text x=&quot;164&quot; y=&quot;196&quot; class=&quot;sys-detail&quot;&gt;corners 0 and 1: the top edge&lt;/text&gt;&lt;text x=&quot;164&quot; y=&quot;210&quot; class=&quot;sys-detail&quot;&gt;= the robot&#39;s front&lt;/text&gt;&lt;text x=&quot;164&quot; y=&quot;236&quot; class=&quot;sys-detail&quot;&gt;centre = mean of the 4 corners&lt;/text&gt;&lt;text x=&quot;164&quot; y=&quot;262&quot; class=&quot;sys-detail&quot;&gt;heading = from the centre to&lt;/text&gt;&lt;text x=&quot;164&quot; y=&quot;276&quot; class=&quot;sys-detail&quot;&gt;the middle of the top edge&lt;/text&gt;
&lt;text x=&quot;400&quot; y=&quot;160&quot; class=&quot;sys-etiquette&quot;&gt;The table, before and after the homography&lt;/text&gt;
&lt;polygon points=&quot;410,198 560,186 574,300 396,292&quot; fill=&quot;none&quot; class=&quot;sys-region&quot;/&gt;&lt;text x=&quot;485&quot; y=&quot;250&quot; class=&quot;sys-detail&quot; text-anchor=&quot;middle&quot;&gt;in the image&lt;/text&gt;
&lt;line class=&quot;sys-fil&quot; x1=&quot;584&quot; y1=&quot;244&quot; x2=&quot;616&quot; y2=&quot;244&quot; marker-end=&quot;url(#vi-fl)&quot;/&gt;&lt;text x=&quot;600&quot; y=&quot;234&quot; class=&quot;sys-code&quot; text-anchor=&quot;middle&quot;&gt;H&lt;/text&gt;
&lt;rect x=&quot;626&quot; y=&quot;196&quot; width=&quot;124&quot; height=&quot;81&quot; class=&quot;sys-region&quot;/&gt;&lt;text x=&quot;688&quot; y=&quot;241&quot; class=&quot;sys-detail&quot; text-anchor=&quot;middle&quot;&gt;84 × 55 cm&lt;/text&gt;&lt;text x=&quot;688&quot; y=&quot;296&quot; class=&quot;sys-detail&quot; text-anchor=&quot;middle&quot;&gt;in centimetres&lt;/text&gt;
&lt;/svg&gt;&lt;/div&gt;&lt;figcaption&gt;All the vision fits in these five steps. The 15 ms were measured on the Pi, on the footage from the shoot: at full size it took 46, for the same detection rate.&lt;/figcaption&gt;&lt;/figure&gt;
&lt;p&gt;That was my part of the work: print the marker sheet at 100 %, cut out the 4 cm squares, glue them on cardboard, then lay them as a roof on each robot, flat, resting at the front on the edge of the micro:bit. Before that, the agent could not tell which way each wheel was turning: seen from the ceiling, a robot without a marker is a few pixels wide. Once the markers were on, it had each robot make four small moves and worked out the motor wiring from where they went.&lt;/p&gt;
&lt;figure&gt;&lt;img src=&quot;robots.webp&quot; alt=&quot;The two :MOVE mini robots from the front on the white table, the micro:bit standing at the front with its red LEDs lit, and above each one a marker glued on cardboard, laid flat like a roof.&quot; width=&quot;1600&quot; height=&quot;1200&quot; loading=&quot;lazy&quot;&gt;&lt;figcaption&gt;The two robots, with their marker laid as a roof above the micro:bit.&lt;/figcaption&gt;&lt;/figure&gt;
&lt;h2 id=&quot;what-broke&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#what-broke&quot; aria-label=&quot;Anchor link for: what-broke&quot;&gt;#&lt;/a&gt;
What broke&lt;/h2&gt;
&lt;p&gt;During a match against the AI, the game stopped on “B is not seen”, while robot B was right there, switched on. Measured at that moment, its marker was detected in only 51 % of the frames. It was partly hidden, and that is very sensitive: a marker has to be seen whole, clearly, to be recognised. I repositioned it, the agent widened the detector’s thresholding windows, and both robots went to 100 %.&lt;/p&gt;
&lt;p&gt;The other surprise came from the camera. The USB webcam’s image was mediocre, and I replaced it on the ceiling with an old Redmi phone running the &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://play.google.com/store/apps/details?id=com.pas.webcam&quot;&gt;IP Webcam&lt;/a&gt; app. The image was better, but the lag between moving the phone and seeing it on screen looked like a deal-breaker for driving. The cause: the Pi analysed 17 frames a second while the phone sent 30, and the delay piled up in the network buffer. The agent split reading the stream from tracking: one thread drains the camera continuously, the other only processes the most recent frame.&lt;/p&gt;
&lt;p&gt;Then the phone switched back to 1080p on its own after the app restarted, and the tracking circles showed up next to the robots. Since then, all the geometry is computed in coordinates relative to the image size, and the server forces 720p again on every connection.&lt;/p&gt;
&lt;h2 id=&quot;the-camera-that-does-not-track&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#the-camera-that-does-not-track&quot; aria-label=&quot;Anchor link for: the-camera-that-does-not-track&quot;&gt;#&lt;/a&gt;
The camera that does not track&lt;/h2&gt;
&lt;p&gt;The old laptop sitting at the edge of the table, an eeePC running Arch Linux, has a webcam too. It was tempting to use it for vision. The agent ruled it out: from such a low angle, positions are unusable, and the Atom processor does not have the power for it. That camera does the show: a stand view, and the replay of each tag, rebuilt from the last seconds the Pi keeps in memory for every camera. The laptop only streams when someone is watching.&lt;/p&gt;
&lt;h2 id=&quot;who-did-what&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#who-did-what&quot; aria-label=&quot;Anchor link for: who-did-what&quot;&gt;#&lt;/a&gt;
Who did what&lt;/h2&gt;
&lt;p&gt;What I liked in this project is seeing the agent and its code act on the real world. I could see, very concretely, robots moving and behaving. And I was doing in the real world what AI cannot do: printing, cutting, gluing, preparing.&lt;/p&gt;
&lt;h2 id=&quot;where-i-am&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#where-i-am&quot; aria-label=&quot;Anchor link for: where-i-am&quot;&gt;#&lt;/a&gt;
Where I am&lt;/h2&gt;
&lt;p&gt;At 11:30 pm, demo mode had the AI playing against the AI, in 45-second matches that chain by themselves, while the agent recorded the three cameras and the interface. From that, it made the edit above, the pictures in this post and a thread I posted the next day on X and Bluesky.&lt;/p&gt;
&lt;figure&gt;&lt;img src=&quot;interface.webp&quot; alt=&quot;The micro:brawl interface mid-match: in the centre, the sky view with the two markers circled in orange and blue, the track view inset; on the left and right, each robot&#39;s telemetry; at the bottom, the ground track, the log and the Pi&#39;s status.&quot; width=&quot;1920&quot; height=&quot;1080&quot; loading=&quot;lazy&quot;&gt;&lt;figcaption&gt;The interface mid-match: the sky view with the tracked markers, each robot&#39;s telemetry on either side, the ground track, the log of tags and the Pi&#39;s status.&lt;/figcaption&gt;&lt;/figure&gt;
&lt;figure class=&quot;video&quot;&gt;&lt;video controls muted playsinline preload=&quot;metadata&quot; poster=&quot;mission-control-poster.jpg&quot;&gt;&lt;source src=&quot;mission-control.mp4&quot; type=&quot;video/mp4&quot;&gt;&lt;/video&gt;&lt;figcaption&gt;The same interface, filmed during demo mode: A&#39;s telemetry, then B&#39;s, the replay of a tag, the ground track and the log.&lt;/figcaption&gt;&lt;/figure&gt;
&lt;p&gt;The next morning, the agent fixed what the shoot had revealed. Against the AI, a tag happens about every 10 seconds, and spectators saw almost nothing but replays: they are shorter now and hand back to the live view as soon as play resumes. Losing Bluetooth now pauses the match, instead of letting it go on with a dead robot. Tracking decodes the image at half its size: 15 ms per frame on the Pi instead of 46, for the same detection rate, because the Pi was climbing to 82 °C and throttling. It will still need a fan. These fixes have yet to be checked in a real match.&lt;/p&gt;
&lt;p&gt;The code is on GitHub, for information: &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://github.com/storagebits/microbrawl&quot;&gt;storagebits/microbrawl&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;what-s-next&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#what-s-next&quot; aria-label=&quot;Anchor link for: what-s-next&quot;&gt;#&lt;/a&gt;
What’s next&lt;/h2&gt;
&lt;p&gt;What would be fun is opening the game up: letting strangers connect and drive the robots, and watching them roll live in my place. I also want to widen it to other robots, a &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://www.thymio.org/&quot;&gt;Thymio&lt;/a&gt; maybe, or a small indoor drone. The doors are open.&lt;/p&gt;
&lt;h2 id=&quot;links&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#links&quot; aria-label=&quot;Anchor link for: links&quot;&gt;#&lt;/a&gt;
Links&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://claude.com/product/claude-code&quot;&gt;Claude Code&lt;/a&gt;, the agent that wrote the code&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://microbit.org/&quot;&gt;micro:bit&lt;/a&gt;, the robots’ board&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://makecode.microbit.org/&quot;&gt;MakeCode&lt;/a&gt;, the firmware’s editor and compiler&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://kitronik.co.uk/products/5652-move-mini-mk2-buggy-kit-excl-microbit&quot;&gt;Kitronik :MOVE mini&lt;/a&gt;, the two-servo chassis&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://www.uco.es/investiga/grupos/ava/portfolio/aruco/&quot;&gt;ArUco&lt;/a&gt;, the markers, from the University of Córdoba&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://docs.opencv.org/4.x/d5/dae/tutorial_aruco_detection.html&quot;&gt;Detection of ArUco markers&lt;/a&gt;, in the OpenCV documentation&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://github.com/hbldh/bleak&quot;&gt;bleak&lt;/a&gt;, Bluetooth Low Energy in Python&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://fastapi.tiangolo.com/&quot;&gt;FastAPI&lt;/a&gt;, the Pi’s server&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://play.google.com/store/apps/details?id=com.pas.webcam&quot;&gt;IP Webcam&lt;/a&gt;, the app that turns the phone into a network camera&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://www.thymio.org/&quot;&gt;Thymio&lt;/a&gt;, the next robot, maybe&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://github.com/storagebits/microbrawl&quot;&gt;The micro:brawl code&lt;/a&gt;, on GitHub&lt;/li&gt;
&lt;/ul&gt;
&lt;aside class=&quot;transparence&quot; aria-label=&quot;How this post was written&quot;&gt;
  &lt;p class=&quot;transparence-titre&quot;&gt;How this post was written&lt;/p&gt;
  &lt;p&gt;Drafted by Claude Opus 5.5 from: a brief and an interview written by François, his session messages, the &lt;code&gt;microbrawl&lt;/code&gt; repository and the footage from the shoot.&lt;/p&gt;
  &lt;p&gt;Proofread and corrected by François in 10 min, 0 % of the text rewritten.&lt;/p&gt;
  &lt;p&gt;Translated from French by the AI, from the proofread version. The translation was not reviewed line by line.&lt;/p&gt;
&lt;/aside&gt;
</content>
    </entry>
</feed>
