Search documentation of bb

# BB.Message.Sensor.Range (bb v0.17.0)

Copy Markdown View Source

Single range reading from a distance sensor.

## Fields

- `radiation_type` - Type of radiation (`:ultrasound` or `:infrared`)
- `field_of_view` - Size of the arc that the sensor covers in radians
- `min_range` - Minimum range in metres
- `max_range` - Maximum range in metres
- `range` - Measured range in metres

Values less than min_range or greater than max_range should be discarded. A range of `:infinity` indicates no object was detected.

## Examples

    alias BB.Message.Sensor.Range

    {:ok, msg} = Range.new(:ultrasonic_sensor,
      radiation_type: :ultrasound,
      field_of_view: 0.26,
      min_range: 0.02,
      max_range: 4.0,
      range: 1.5
    )

## Summary

### Types

radiation_type()
t()

### Functions

new(frame_id, attrs)

## Types

# radiation_type()

    @type radiation_type() :: :ultrasound | :infrared

# t()

    @type t() :: %BB.Message.Sensor.Range{
      field_of_view: float(),
      max_range: float(),
      min_range: float(),
      radiation_type: radiation_type(),
      range: float() | :infinity
    }

## Functions

# new(frame_id, attrs)

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