镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Publish match direction - #151

Open
FrogAi wants to merge 1 commit into
pfeiferj:mainfrom
FrogAi:publish-match-direction
Open

FrogAi wants to merge 1 commit into
pfeiferj:mainfrom
FrogAi:publish-match-direction

Conversation

@FrogAi

@FrogAi FrogAi commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

"mapdOut" has "wayId", but nothing says which way along that road the car is going. Two-way roads often have a different limit in each direction ("maxspeed:forward" and "maxspeed:backward"), and mapd already handles that internally with "OnWay.IsForward", but a fork that wants to remember or look up something per road direction can't tell the two apart from "wayId" alone.

This adds "isForward" to "MapdOut", set from "CurrentWay.OnWay.IsForward". It's true when the car is travelling in the order the way's nodes are stored, the same direction "maxspeed:forward" refers to.

Audit report

Why it's needed

Anything downstream that stores or looks up data per road direction needs it, like a fork that learns or caches speed limits per road, or a UI that shows something different for each direction. Without the field both directions share one entry, so a value seen going one way gets used going the other. FrogPilot is one example. It keys its speed limit data on "(wayId, isForward)", and it has been running this exact change on its devices since October.

Change

  • "cereal/custom/custom.capnp": "isForward @27 :Bool" at the end of "MapdOut". 27 is the next free ordinal, so it's a backward compatible addition. Older readers ignore it and newer readers see false from older mapd.
  • "cereal/custom/custom.capnp.go": regenerated with "capnp compile" and "capnpc-go" v3.1.0-alpha.1, the versions in the Makefile. Regenerating it from the schema gives the committed file byte for byte. Regenerating main's file the same way also reproduces main exactly, so the toolchain matches.
  • "state.go": one "output.SetIsForward(...)" next to "SetWayId".
  • "docs/outputs.md": describes the field.

Testing

  • Over a real 12 minute drive, FrogPilot's mapd build on a comma 3X, which includes this change, published "isForward" true on 63% of "mapdOut" messages. Main has no such field, so it always reads false.
  • "go build ./...", "go vet ./..." and "go test ./..." pass in "golang:1.26.2-bookworm".

MapdOut gains isForward, so consumers can tell which direction the current way match is traveled in.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant