Search documentation of bb

# BB.Dsl.CommandTransformer (bb v0.8.0)

View Source

Generates convenience functions for commands on the robot module.

For each command defined in the DSL, this transformer generates a function on the robot module that calls `BB.Robot.Runtime.execute/3`.

## Example

Given a command definition:

    commands do
      command :navigate_to_pose do
        handler NavigateToPoseHandler
        argument :target_pose, BB.Pose, required: true
        argument :tolerance, :float, default: 0.1
      end
    end

This transformer generates:

    @spec navigate_to_pose(keyword()) :: {:ok, Task.t()} | {:error, term()}
    def navigate_to_pose(goal \\ []) do
      BB.Robot.Runtime.execute(__MODULE__, :navigate_to_pose, Map.new(goal))
    end

The caller can then await the task to get the result:

    {:ok, task} = MyRobot.navigate_to_pose(target_pose: pose)
    {:ok, result} = Task.await(task)

# Summary

## Functions

after_compile?()

Callback implementation for `Spark.Dsl.Transformer.after_compile?/0`.

# Functions

# after_compile?()

Callback implementation for `Spark.Dsl.Transformer.after_compile?/0`.