# `BB.Urdf.Importer`
[🔗](https://github.com/beam-bots/bb/blob/main/lib/bb/urdf/importer.ex#L6)

Generate BB DSL source code from a parsed URDF document.

Consumes the intermediate representation produced by `BB.Urdf.Parser` and
emits an Elixir `defmodule` that `use BB`, with nested `link`/`joint` blocks
in topology order. The output is formatted source ready to be written into
a file.

## Limitations

URDF features that don't have a direct BB analogue are skipped with a
warning rather than failing the import — see `BB.Urdf.Parser` for the
warnings collected during parsing. The importer adds its own warnings for
topology issues (cycles, missing parent/child links, multiple roots).

# `to_quoted`

```elixir
@spec to_quoted(BB.Urdf.Parser.robot(), module()) ::
  {:ok, Macro.t(), [String.t()]} | {:error, term()}
```

Build the quoted form of the generated module.

# `to_source`

```elixir
@spec to_source(BB.Urdf.Parser.robot(), module()) ::
  {:ok, String.t(), [String.t()]} | {:error, term()}
```

Render a parsed URDF document to a formatted Elixir source string.

Returns `{:ok, source, warnings}` on success.

# `to_topology_quoted`

```elixir
@spec to_topology_quoted(BB.Urdf.Parser.robot()) ::
  {:ok, Macro.t(), [String.t()]} | {:error, term()}
```

Build the quoted form of just the `topology do ... end` block.

Used when merging an imported URDF into an existing BB module — only the
topology gets replaced, leaving `settings`, sensors, controllers, commands
and other hand-written content alone.

---

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