# `BB.Message.Geometry.Pose`
[🔗](https://github.com/beam-bots/bb/blob/main/lib/bb/message/geometry/pose.ex#L5)

A position and orientation in 3D space.

Wraps a `BB.Math.Transform` for use as a message payload.

## Fields

- `transform` - The pose as `BB.Math.Transform.t()`

## Examples

    alias BB.Message.Geometry.Pose
    alias BB.Math.{Vec3, Quaternion, Transform}

    # Create from Transform
    transform = Transform.from_position_quaternion(Vec3.new(1.0, 0.0, 0.5), Quaternion.identity())
    {:ok, msg} = Pose.new(:end_effector, transform)

    # Or from position and orientation
    {:ok, msg} = Pose.new(:end_effector, Vec3.new(1.0, 0.0, 0.5), Quaternion.identity())

    # Access components
    pose = msg.payload
    Pose.position(pose)     # => %Vec3{}
    Pose.orientation(pose)  # => %Quaternion{}
    Pose.to_transform(pose) # => %Transform{}

# `t`

```elixir
@type t() :: %BB.Message.Geometry.Pose{transform: BB.Math.Transform.t()}
```

# `new`

```elixir
@spec new(
  atom(),
  keyword()
) :: {:ok, BB.Message.t()} | {:error, term()}
@spec new(atom(), BB.Math.Transform.t()) :: {:ok, BB.Message.t()} | {:error, term()}
```

Create a new Pose message from a Transform.

## Examples

    alias BB.Math.Transform

    {:ok, msg} = Pose.new(:base_link, Transform.identity())

# `new`

```elixir
@spec new(atom(), BB.Math.Vec3.t(), BB.Math.Quaternion.t()) ::
  {:ok, BB.Message.t()} | {:error, term()}
```

Create a new Pose message from position and orientation.

## Examples

    alias BB.Math.{Vec3, Quaternion}

    {:ok, msg} = Pose.new(:base_link, Vec3.new(1.0, 2.0, 3.0), Quaternion.identity())

# `orientation`

```elixir
@spec orientation(t()) :: BB.Math.Quaternion.t()
```

Get the orientation component as Quaternion.

# `position`

```elixir
@spec position(t()) :: BB.Math.Vec3.t()
```

Get the position component as Vec3.

# `to_transform`

```elixir
@spec to_transform(t()) :: BB.Math.Transform.t()
```

Get the underlying Transform.

---

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