BB.Urdf.Importer (bb v0.20.0)

Copy Markdown View Source

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).

Summary

Functions

Build the quoted form of the generated module.

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

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

Functions

to_quoted(robot, module_name)

@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(robot, module_name)

@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(robot)

@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.