BB.Command.Arm (bb v0.19.0)

Copy Markdown View Source

Standard command handler for arming a robot.

When executed from the :disarmed state, this command arms the robot via BB.Safety.Controller, making it ready to accept motion commands.

Usage

Add to your robot's command definitions:

commands do
  command :arm do
    handler BB.Command.Arm
    allowed_states [:disarmed]
  end
end

Then execute:

{:ok, cmd} = MyRobot.arm()
{:ok, :armed} = BB.Command.await(cmd)

Implicit arm: true

When this module is the handler, the DSL implicitly sets arm: true on the command, which means BB.Safety.arm/1 will route through this command rather than flipping safety state directly. To insert pre-arm work (e.g. moving to a home position) without losing the safety-API routing, write a custom handler that calls BB.Safety.Controller.arm/1 directly and flag it with arm true.