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

Parse a URDF XML document into a plain-map intermediate representation.

The result is intentionally close to the URDF wire format: link/joint
lists are flat (joints reference parent and child link names), values are
floats in SI base units, and unsupported URDF features are collected as
warnings rather than raised as errors. The `BB.Urdf.Importer` consumes this
representation and produces a BB DSL module.

# `collision`

```elixir
@type collision() :: %{
  name: String.t() | nil,
  origin: origin() | nil,
  geometry: geometry() | nil
}
```

# `geometry`

```elixir
@type geometry() ::
  {:box, %{size: {float(), float(), float()}}}
  | {:cylinder, %{radius: float(), length: float()}}
  | {:sphere, %{radius: float()}}
  | {:mesh, %{filename: String.t(), scale: float()}}
```

# `inertial`

```elixir
@type inertial() :: %{
  origin: origin() | nil,
  mass: float() | nil,
  inertia: %{
    ixx: float(),
    iyy: float(),
    izz: float(),
    ixy: float(),
    ixz: float(),
    iyz: float()
  }
}
```

# `joint`

```elixir
@type joint() :: %{
  name: String.t(),
  type: atom(),
  parent: String.t(),
  child: String.t(),
  origin: origin() | nil,
  axis: {float(), float(), float()} | nil,
  limit:
    %{
      lower: float() | nil,
      upper: float() | nil,
      effort: float() | nil,
      velocity: float() | nil
    }
    | nil,
  dynamics: %{damping: float() | nil, friction: float() | nil} | nil,
  mimic: %{joint: String.t(), multiplier: float(), offset: float()} | nil
}
```

# `link`

```elixir
@type link() :: %{
  name: String.t(),
  visual: visual() | nil,
  collisions: [collision()],
  inertial: inertial() | nil
}
```

# `material`

```elixir
@type material() :: %{
  name: String.t() | nil,
  color: %{red: float(), green: float(), blue: float(), alpha: float()} | nil,
  texture: String.t() | nil
}
```

# `origin`

```elixir
@type origin() :: %{
  xyz: {float(), float(), float()},
  rpy: {float(), float(), float()}
}
```

# `robot`

```elixir
@type robot() :: %{
  name: String.t(),
  links: [link()],
  joints: [joint()],
  transmissions: %{optional(String.t()) =&gt; transmission()},
  materials: %{optional(String.t()) =&gt; material()},
  warnings: [String.t()]
}
```

# `transmission`

```elixir
@type transmission() :: %{
  name: String.t() | nil,
  joint: String.t(),
  actuator: String.t() | nil,
  reduction: float()
}
```

# `visual`

```elixir
@type visual() :: %{
  name: String.t() | nil,
  origin: origin() | nil,
  geometry: geometry() | nil,
  material: material() | nil
}
```

# `parse_file`

```elixir
@spec parse_file(Path.t()) :: {:ok, robot()} | {:error, term()}
```

Parse a URDF XML file from disk.

# `parse_string`

```elixir
@spec parse_string(String.t()) :: {:ok, robot()} | {:error, term()}
```

Parse a URDF XML string.

---

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