Skip to content

improvement: installer registers arm_commands handlers in generated robot#1

Merged
jimsynz merged 1 commit into
mainfrom
install-arm-commands
May 16, 2026
Merged

improvement: installer registers arm_commands handlers in generated robot#1
jimsynz merged 1 commit into
mainfrom
install-arm-commands

Conversation

@jimsynz
Copy link
Copy Markdown
Contributor

@jimsynz jimsynz commented May 16, 2026

Summary

mix igniter.install bb_so101 now adds the arm_commands example package
as a sparse git dep against
beam-bots/bb_examples, and
registers the three demo command handlers as commands on the generated
robot — home, move_to_pose, and demo_circle — each with full DSL
argument metadata so the bb_liveview dashboard renders proper input
widgets for every goal field.

The user gets a fully demo-ready arm out of a single
mix igniter.install bb_so101: IK-driven moves to a Cartesian target, a
configurable demo circle in any of the three axis-aligned planes, and a
parameterised home command.

What gets generated

defp deps do
  [
    {:arm_commands,
     git: \"https://github.com/beam-bots/bb_examples.git\",
     sparse: \"arm_commands\"}
    # …
  ]
end
commands do
  command :arm,           do: handler(BB.Command.Arm)
  command :disarm,        do: handler(BB.Command.Disarm)

  command :home do
    handler BB.Examples.ArmCommands.Home
    allowed_states [:idle]
    argument :position, :float, default: 0.0, doc: \"…\"
  end

  command :move_to_pose do
    handler BB.Examples.ArmCommands.MoveToPose
    allowed_states [:idle]
    argument :ee_link, :atom, default: :ee_link, doc: \"\"
  end

  command :demo_circle do
    handler BB.Examples.ArmCommands.DemoCircle
    allowed_states [:idle]
    argument :ee_link, :atom, default: :ee_link, doc: \"\"
    argument :plane, {:in, [:xy, :xz, :yz]}, default: :xz, doc: \"\"
    argument :radius, :float, default: 0.03, doc: \"\"
    argument :points, :integer, default: 16, doc: \"\"
    argument :settle_tolerance_m, :float, default: 5.0e-3, doc: \"\"
    argument :settle_timeout_ms, :integer, default: 1500, doc: \"\"
  end
end

Implementation note

There's no BB.Igniter.add_command/4 helper in bb yet, so the
installer carries its own small add_command/4 private function that
wraps Spark.Igniter.update_dsl the same way BB.Igniter.add_controller/4
already does internally. Idempotent on command name. If/when more
installers need this, it can be promoted into BB.Igniter.

Test plan

  • mix check --no-retry green
  • 4 new tests cover: sparse git dep added to mix.exs; each of the
    three commands registered with the right handler and at least one
    representative argument declaration.
  • Existing idempotency test still passes — running the installer
    twice produces no further changes.

…obot

`mix igniter.install bb_so101` now adds the `arm_commands` example package
as a sparse git dep against `beam-bots/bb_examples`, and registers the
three demo command handlers — `BB.Examples.ArmCommands.{Home, MoveToPose,
DemoCircle}` — as commands on the generated robot.

Each command is registered with full DSL `argument` metadata, so the
bb_liveview dashboard immediately renders proper input widgets for every
goal field:

- `:position` (float) for home
- `:ee_link` (atom) for move_to_pose and demo_circle
- `:plane` (`{:in, [:xy, :xz, :yz]}` enum), `:radius` (float),
  `:points` (integer), `:settle_tolerance_m` (float),
  `:settle_timeout_ms` (integer) for demo_circle

The user gets a fully demo-ready arm out of a single
`mix igniter.install bb_so101` — including IK-driven moves to a Cartesian
target and a configurable demo circle.

## Why a sparse git dep?

`arm_commands` lives in the `bb_examples` monorepo, distributed as a git
dep rather than via Hex on the grounds that example/demo code doesn't
need versioned releases. The `sparse:` checkout means consumers only
pull the `arm_commands/` sub-directory, not the entire monorepo.

## Implementation note

There's no `BB.Igniter.add_command/4` helper in `bb` yet, so the
installer carries its own small `add_command/4` private function that
wraps `Spark.Igniter.update_dsl` the same way `BB.Igniter.add_controller/4`
already does internally. If/when more installers need this, it can be
promoted into `BB.Igniter`.

## Test plan

- [x] `mix check --no-retry` green (16 installer tests, +4 new covering
      the arm_commands dep + each command registration)
- [x] Idempotency test passes — running the installer twice produces no
      further changes.
@jimsynz jimsynz force-pushed the install-arm-commands branch from 1549ddd to 4b10c5a Compare May 16, 2026 06:12
@jimsynz jimsynz merged commit 2a8f96a into main May 16, 2026
16 checks passed
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