Files
microduck/mapd/systemd/mapd.service
T
apirrone c1937fc55f maploc: a brief pick-up is a bump, searched for nearby; every search logged
On graphite the pick-up detector fired for 0.36 s as a fall began, then the
limp fall: mapd read it as a carry, dropped the position and searched a thin
map everywhere at a strict uniqueness gate, and never found itself — silently.

- A pick-up shorter than brief_pickup_s (2 s) becomes lost=bumped with a
  nearby hint (±0.5 m, ±25°); a fall while lost widens a nearby hint.
- A nearby search that fails local_search_keyframes stops keeps the heading
  and widens to the whole map (±30°).
- Every relocalization search is an event, logged by mapd with its scope,
  window, candidate and the gate that refused it.
- The saved map is handed to the robot group (dir 0751, file 0640), so it
  can be copied off a robot and replayed.

maploc::sim gains Step::Stumble; the test reproduces the journal's sequence
and relocalizes in 2 stops (1 cm).

Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 16:57:25 +02:00

57 lines
1.9 KiB
Desktop File

# The onboard map: where the robot is in its home (docs/design/mapping-design.md).
#
# A client of robotd and tofd like any other, and its own process for the reason tofd is: a
# mapping bug, a slow relocalization search or a corrupt map file must never reach the control
# loop. Nothing depends on this unit; the robot walks without it.
[Unit]
Description=Robot onboard map
Documentation=file:///opt/robot/daemon/current/docs/architecture.md
After=local-fs.target
# No ordering on robotd or tofd: both feeds reconnect on their own, which is also what carries
# the map through an update restarting them.
[Service]
Type=exec
ExecStart=/opt/robot/daemon/current/bin/mapd
User=mapd
Group=mapd
# robot — to subscribe to robot.state and tof.frame, and to hand the map socket to the same group
SupplementaryGroups=robot
Restart=always
RestartSec=5s
# Background work: a relocalization search is a second or two of one core, and it must lose every
# argument about the CPU to the control loop.
Nice=10
# The map lives here, across updates and rollbacks — it is the robot's, not the release's.
StateDirectory=mapd
# Traversable, not listable, by others; the map file itself is handed to `robot`, so the people who
# may read the map over the socket may also copy the file to look at why a robot stayed lost.
StateDirectoryMode=0751
RuntimeDirectory=mapd
NoNewPrivileges=yes
ProtectSystem=strict
ProtectHome=yes
PrivateTmp=yes
PrivateDevices=yes
ProtectKernelTunables=yes
ProtectKernelModules=yes
ProtectControlGroups=yes
RestrictSUIDSGID=yes
RestrictAddressFamilies=AF_UNIX
RestrictNamespaces=yes
LockPersonality=yes
MemoryDenyWriteExecute=yes
SystemCallFilter=@system-service
SystemCallErrorNumber=EPERM
CapabilityBoundingSet=
Environment=RUST_LOG=info
StandardOutput=journal
StandardError=journal
# Long enough to write the map on the way out.
TimeoutStopSec=15s
[Install]
WantedBy=multi-user.target