feat: use AprilTag instead of QR code

This commit is contained in:
Schuwi
2025-09-14 18:52:24 +02:00
parent 788ad54724
commit 589c9964aa
600 changed files with 12814 additions and 122 deletions

View File

@@ -0,0 +1,57 @@
defmodule Mix.Tasks.Apriltag.GenerateAll do
@moduledoc """
Generates all 587 AprilTag tag36h11 SVG files for the storage system.
## Examples
mix apriltag.generate_all
mix apriltag.generate_all --force
Options:
* `--force` - Regenerate all files even if they already exist
"""
use Mix.Task
@shortdoc "Generate all AprilTag SVG files"
def run(args) do
{opts, [], []} = OptionParser.parse(args, strict: [force: :boolean])
force_regenerate = Keyword.get(opts, :force, false)
Mix.Task.run("app.start")
IO.puts("Generating AprilTag SVG files...")
IO.puts("Force regenerate: #{force_regenerate}")
start_time = System.monotonic_time(:millisecond)
result = ComponentsElixir.AprilTag.generate_all_apriltag_svgs(
force_regenerate: force_regenerate
)
end_time = System.monotonic_time(:millisecond)
duration = end_time - start_time
IO.puts("Generation completed in #{duration}ms")
IO.puts("Total: #{result.total}")
IO.puts("Success: #{result.success}")
IO.puts("Errors: #{result.errors}")
if result.errors > 0 do
IO.puts("\nErrors encountered:")
result.results
|> Enum.filter(&match?({:error, _, _}, &1))
|> Enum.each(fn {:error, id, reason} ->
IO.puts(" AprilTag ID #{id}: #{inspect(reason)}")
end)
end
if result.success == result.total do
IO.puts("\n✅ All AprilTag SVG files generated successfully!")
IO.puts("Files are available in: priv/static/apriltags/")
else
IO.puts("\n⚠️ Some files failed to generate. Check the errors above.")
System.halt(1)
end
end
end