Dev.TestRobot (BB.TUI v0.1.0)

Copy Markdown View Source

A simulated WidowX-200 style robot arm for development.

Based on the WidowX-200 5-DOF robot arm kinematic structure but without any hardware controllers — purely for TUI development and testing.

Summary

Functions

Returns default parameter values.

Returns the parameter schema for validation.

Execute the calibrate command.

Returns a child specification for starting this robot under a supervisor.

Execute the home command.

Execute the log command.

Execute the move command.

Returns the optimised robot representation.

Starts the robot's supervision tree.

Execute the stream command.

Execute the wobble command.

Functions

__bb_default_parameters__()

@spec __bb_default_parameters__() :: [{[atom()], term()}]

Returns default parameter values.

Returns a list of {path, value} tuples for parameters that have defaults.

__bb_parameter_schema__()

@spec __bb_parameter_schema__() :: [{[atom()], keyword()}]

Returns the parameter schema for validation.

The schema is a list of {path, opts} tuples where opts is a keyword list compatible with Spark.Options.

calibrate(goal \\ [])

@spec calibrate(keyword()) :: {:ok, pid()} | {:error, term()}

Execute the calibrate command.

Returns

  • {:ok, pid()} - Command started, use BB.Command.await/2 for the result
  • {:error, term()} - Command could not be started

Example

{:ok, cmd} = calibrate(goal_args)
{:ok, result} = BB.Command.await(cmd)

child_spec(opts \\ [])

@spec child_spec(Keyword.t()) :: Supervisor.child_spec()

Returns a child specification for starting this robot under a supervisor.

home(goal \\ [])

@spec home(keyword()) :: {:ok, pid()} | {:error, term()}

Execute the home command.

Returns

  • {:ok, pid()} - Command started, use BB.Command.await/2 for the result
  • {:error, term()} - Command could not be started

Example

{:ok, cmd} = home(goal_args)
{:ok, result} = BB.Command.await(cmd)

log(goal \\ [])

@spec log(keyword()) :: {:ok, pid()} | {:error, term()}

Execute the log command.

Arguments

  • message: :string, default: "hello" - Free-form note attached to the entry.
  • level: :integer, default: 1 - Severity 1..5; higher is louder.

Returns

  • {:ok, pid()} - Command started, use BB.Command.await/2 for the result
  • {:error, term()} - Command could not be started

Example

{:ok, cmd} = log(goal_args)
{:ok, result} = BB.Command.await(cmd)

move(goal \\ [])

@spec move(keyword()) :: {:ok, pid()} | {:error, term()}

Execute the move command.

Arguments

  • joint: {:in, [:waist, :shoulder, :elbow, :wrist_angle, :wrist_rotate, :gripper]}, default: :waist - Joint to drive.
  • angle: :float, default: 0.0 - Target joint angle, in radians.

Returns

  • {:ok, pid()} - Command started, use BB.Command.await/2 for the result
  • {:error, term()} - Command could not be started

Example

{:ok, cmd} = move(goal_args)
{:ok, result} = BB.Command.await(cmd)

robot()

@spec robot() :: BB.Robot.t()

Returns the optimised robot representation.

This struct is built at compile-time from the DSL definition and contains:

  • All physical values converted to SI base units (floats)
  • Flat maps for O(1) lookup of links, joints, sensors, and actuators
  • Pre-computed topology metadata for efficient traversal

Examples

robot = Elixir.Dev.TestRobot.robot()
link = BB.Robot.get_link(robot, :base_link)
joint = BB.Robot.get_joint(robot, :shoulder)

start_link(opts \\ [])

@spec start_link(Keyword.t()) :: Supervisor.on_start()

Starts the robot's supervision tree.

Options

All options are passed through to sensor and actuator child processes.

stream(goal \\ [])

@spec stream(keyword()) :: {:ok, pid()} | {:error, term()}

Execute the stream command.

Arguments

  • joint: {:in, [:waist, :shoulder, :elbow, :wrist_angle, :wrist_rotate, :gripper]}, default: :waist - Joint to sweep.

Returns

  • {:ok, pid()} - Command started, use BB.Command.await/2 for the result
  • {:error, term()} - Command could not be started

Example

{:ok, cmd} = stream(goal_args)
{:ok, result} = BB.Command.await(cmd)

wobble(goal \\ [])

@spec wobble(keyword()) :: {:ok, pid()} | {:error, term()}

Execute the wobble command.

Returns

  • {:ok, pid()} - Command started, use BB.Command.await/2 for the result
  • {:error, term()} - Command could not be started

Example

{:ok, cmd} = wobble(goal_args)
{:ok, result} = BB.Command.await(cmd)