40 lines
2.5 KiB
Markdown
40 lines
2.5 KiB
Markdown
# Building
|
|
Build with `zig build`.
|
|
This creates two main files:
|
|
* `zig-out/firmware/micromouse.uf2` which can be uploaded to an RP2040.
|
|
* `zig-out/bin/micromouse` which can be run on the host computer in simulation
|
|
|
|
# Simulation
|
|
Download the mms simulator from https://github.com/mackorone/mms/releases.
|
|
(I installed this to my Applications folder.)
|
|
Pop open a new Mouse in the simulator by clicking the plus next to the "Mouse" selector.
|
|
Point it at this directory. Set it up with `/usr/local/bin/zig build` as the build command and `./zig-out/bin/micromouse` as the run command.
|
|
|
|
# Overview / Assumptions
|
|
We're using the same coordinate space as the simulator (mms). This is "math coords", with 0, 0 in the lower left and positive y up. North is up
|
|
|
|
* Main.zig is our entry point.
|
|
* It calls Algorithm.zig which is our floodfill implementation. It stores our current knowledge of walls and nodes.
|
|
* rp2040-bot.zig and simulated-bot.zig implement the same interface for the robot/simulator respectively. They're used by Algorithm.zig to interface with the "world."
|
|
* Mouse.zig is used by Algorithm.zig to keep track of information about the mouse (mainly position). It also has functions that read or write mouse position.
|
|
* Map.zig has data types and constants related to the maze (size, goal locations). It gets imported everywhere.
|
|
|
|
# Code notes
|
|
I'm using usize as my default int type so that I can index into arrays with it.
|
|
TODO: test with non-square mazes. I did my best but I don't know
|
|
|
|
Use std.log.debug. microzig. yeah
|
|
|
|
# Sending patches
|
|
Git is decentralized, which means you don't need an account on Tildegit in order to contribute. Simply clone, make your changes, and commit like normal.
|
|
|
|
If you have Git configured with your SMTP information, you can use `git send-mail` to email your changes to me.
|
|
|
|
If you would like to avoid setting up SMTP with Git (understandable), you can instead use `git format-patch`. For example:
|
|
```sh
|
|
git format-patch HEAD~2 -o outbox
|
|
```
|
|
This creates patchfiles for the last 2 commits before HEAD. The files that Git places in the "outbox" folder are a standardized plaintext representation of a commit. You can inspect them to ensure they're correct. You can then attach these files to an email in your GUI email application of choice, or other messenger application. (Note: Maintainers of professional projects that claim to accept email patches will not be happy if you do this, but I think it's much easier.)
|
|
|
|
Once I receive your changes, I'll review them and merge them into the repository. The resulting commits will still list you as the author.
|