mirror of
https://github.com/pollen-robotics/microduck.git
synced 2026-12-03 02:47:45 +08:00
Two switches in robotd, set by `robot.soccer {active, autonomous}`:
- soccer mode: the pad's LB/RB run kick_left/kick_right whatever they
are bound to, and D-pad down starts autonomous play instead of
body + head;
- autonomous: the robot turns until it sees the purple ball, walks to
it, steps sideways until the ball is in front of the foot on its
side, kicks, and looks again. Any pad button takes it back to manual,
and that press does nothing else. A pushed stick wins over it, as
over the laser.
mediad finds the ball (`media.ball`, beside `media.laser`, sharing its
look loop): purple is the hue with both chromas above grey; passing
cells on a 4x4 grid are grouped into blobs, and a blob is the ball when
big enough, filled and round — a ball cut by the frame's edge keeps its
centre and radius from its uncut sides. Every look carries the most
purple colour seen, passed or not, for tuning. robotd projects the
centre onto the plane a radius above the floor with the laser's own
projection, now shared, and carries it by odometry through the last
steps where the ball is under the beak.
The pads learn soccer mode from `robot.mode`, which they already poll
each second — so an NFC tag switching it reaches the pad. Soccer and
laser tracking switch each other off. `[soccer]` holds the detector
thresholds, the kick spot and the gains, all live; `robotctl soccer
on|auto|off` switches it and is the tuning view; the web console draws
the ball.
API_VERSION 54: `robot.soccer`, `robot.mode`'s `soccer`,
`robot.state`'s `soccer` block, `media.ball` / `media.ballSeen`.
Colour thresholds are a first guess; to be tuned on camera images.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>