BB.Message.Geometry.Twist2D (bb v0.28.0)

Copy Markdown View Source

Linear and angular velocity within a plane.

The planar counterpart of BB.Message.Geometry.Twist, and the velocity of a :planar joint. vx/vy are in the plane spanned by the joint's axis normal, and omega is about that normal — the same basis BB.Math.Transform2D.to_transform/2 uses.

Using the 3D Twist with the out-of-plane components zeroed would let a producer emit a physically impossible out-of-plane velocity that nothing would reject.

Fields

  • vx - In-plane linear velocity along the plane's first axis, in m/s
  • vy - In-plane linear velocity along the plane's second axis, in m/s
  • omega - Angular velocity about the plane's normal, in rad/s

Examples

alias BB.Message.Geometry.Twist2D

{:ok, msg} = Twist2D.new(:chassis, 0.5, 0.0, 0.1)

Summary

Types

t()

@type t() :: %BB.Message.Geometry.Twist2D{omega: float(), vx: float(), vy: float()}

Functions

new(frame_id, attrs)

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

new(frame_id, vx, vy, omega)

@spec new(atom(), number(), number(), number()) ::
  {:ok, BB.Message.t()} | {:error, term()}

Create a new Twist2D message.

Returns {:ok, %BB.Message{}} with the twist as payload.

Examples

{:ok, msg} = Twist2D.new(:chassis, 0.5, 0.0, 0.1)