BB context for reactor execution.
This struct is injected into the reactor context by BB.Reactor.Middleware.Context
and made available to all steps as context.private.bb.
Fields
:robot_module- The robot module (e.g.,MyRobot):robot- The staticBB.Robotstruct fromrobot_module.robot():robot_state- The current robot state (:disarmed,:idle,:executing, etc.):execution_id- Unique identifier for this reactor execution
Usage in Steps
def run(arguments, context, options) do
bb = context.private.bb
robot = bb.robot_module
# Use robot module to invoke commands
apply(robot, :move_to, [goal])
end
Summary
Functions
Create a new BB context for a reactor execution.
Refresh the robot state from the runtime.
Types
@type t() :: %BB.Reactor.Context{ execution_id: reference(), robot: BB.Robot.t(), robot_module: module(), robot_state: BB.Robot.Runtime.robot_state() }
Functions
Create a new BB context for a reactor execution.
Arguments
robot_module- The robot module to use for this execution
Examples
iex> BB.Reactor.Context.new(MyRobot)
%BB.Reactor.Context{
robot_module: MyRobot,
robot: %BB.Robot{...},
robot_state: :idle,
execution_id: #Reference<...>
}
Refresh the robot state from the runtime.
Call this to get the current robot state if it may have changed.