mirror of
https://github.com/pollen-robotics/microduck.git
synced 2026-12-03 02:47:45 +08:00
mapd subscribes to robot.state and tof.frame like any client, feeds the maploc mapper on its own thread, keeps the map in /var/lib/mapd/map.json across reboots, and answers map.status, map.stream, map.grid and map.wipe on /run/mapd/map.sock. It commands nothing: the robot walks without it, and the head moves by robotd's own idle glances. The map file is replaced atomically, saved every autosave_s, when the pose has moved 30 cm and on shutdown; a file it cannot read is set aside as map.json.bad-<secs>, never overwritten. [map] in robotd.toml (on by default); robotctl map / map show / map wipe; routed over WebRTC by mediad, refused over BLE. Packaged in both release workflows and dev-push, named in install.sh, configd's unit list and updater.toml. docs/design/mapping-design.md owns the mechanism. Checked end to end against a recorded living-room session served over real sockets: same 21 stops as the offline replay, saved on SIGTERM, and after a restart relocalized within four stops onto the first run's nodes (2-3 cm). Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
29 lines
1.1 KiB
TOML
29 lines
1.1 KiB
TOML
# The onboard map: where the robot is in its home, kept across reboots.
|
|
#
|
|
# A client of `robotd` and `tofd` like any other — it subscribes to `robot.state` and `tof.frame`
|
|
# and owns nothing the robot needs to walk — so it is its own process: a mapping bug, a slow
|
|
# relocalization search or a corrupt map file must never reach the control loop. The algorithm is
|
|
# the `maploc` library; this crate is its sockets, its file and its thread.
|
|
[package]
|
|
name = "mapd"
|
|
version.workspace = true
|
|
edition.workspace = true
|
|
rust-version.workspace = true
|
|
license.workspace = true
|
|
|
|
[dependencies]
|
|
anyhow = "1"
|
|
clap = { workspace = true, features = ["derive"] }
|
|
duck-ipc-proto = { path = "../duck-ipc-proto" }
|
|
libc = "0.2"
|
|
maploc = { path = "../maploc" }
|
|
robotd-params = { path = "../robotd-params" }
|
|
serde = { workspace = true }
|
|
serde_json.workspace = true
|
|
tokio = { workspace = true, features = ["macros", "net", "rt", "signal", "sync", "time", "io-util"] }
|
|
tracing.workspace = true
|
|
tracing-subscriber = { workspace = true, features = ["env-filter"] }
|
|
|
|
[dev-dependencies]
|
|
tempfile = "3.27.0"
|