# `BB.Kino.Shared.RobotContext`
[🔗](https://github.com/beam-bots/bb_kino/blob/main/lib/bb/kino/shared/robot_context.ex#L5)

Shared utilities for robot validation and initial state fetching.

Used by all BB.Kino widgets to validate robot modules and fetch
initial state data.

# `fetch_initial_state`

```elixir
@spec fetch_initial_state(module()) :: map()
```

Fetches the initial state for a robot.

Returns a map containing:
- `:robot_struct` - the robot topology struct
- `:positions` - current joint positions
- `:velocities` - current joint velocities
- `:state` - runtime state (:disarmed, :idle, :executing, :error, :disarming)
- `:armed` - boolean indicating if robot is armed

# `fetch_safety_state`

```elixir
@spec fetch_safety_state(module()) :: map()
```

Fetches just the safety-related state for a robot.

Returns a map containing:
- `:state` - safety state (:disarmed, :armed, :disarming, :error)
- `:armed` - boolean
- `:in_error` - boolean

# `validate_robot`

```elixir
@spec validate_robot(module()) :: {:ok, module()} | {:error, String.t()}
```

Validates that the given module is a BB robot.

Returns `{:ok, robot_module}` if valid, or `{:error, reason}` if not.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
