# `BB.Message.Actuator.Command.Velocity`
[🔗](https://github.com/beam-bots/bb/blob/main/lib/bb/message/actuator/command/velocity.ex#L5)

Command to set an actuator's velocity.

The actuator will move at the specified velocity until stopped, a new
command is received, or the optional duration expires.

## Fields

- `velocity` - Target velocity (rad/s for revolute, m/s for prismatic)
- `duration` - Optional duration (milliseconds), nil = until stopped
- `command_id` - Optional reference for correlating with feedback messages

## Examples

    alias BB.Message
    alias BB.Message.Actuator.Command.Velocity

    # Continuous velocity
    {:ok, msg} = Message.new(Velocity, :wheel,
      velocity: 1.0
    )

    # Velocity for fixed duration
    {:ok, msg} = Message.new(Velocity, :wheel,
      velocity: 1.0,
      duration: 500
    )

# `t`

```elixir
@type t() :: %BB.Message.Actuator.Command.Velocity{
  command_id: reference() | nil,
  duration: pos_integer() | nil,
  velocity: float()
}
```

# `new`

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

---

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