BB.Message.Geometry.Pose (bb v0.15.0)

View Source

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{}

Summary

Functions

Create a new Pose message from a Transform.

Create a new Pose message from position and orientation.

Get the orientation component as Quaternion.

Get the position component as Vec3.

Get the underlying Transform.

Types

t()

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

Functions

new(frame_id, attrs)

@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(frame_id, position, orientation)

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

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

Get the orientation component as Quaternion.

position(pose)

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

Get the position component as Vec3.

to_transform(pose)

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

Get the underlying Transform.