Search documentation of bb

# BB.Dsl.ParamRef (bb v0.8.0)

View Source

A reference to a parameter for use in DSL fields.

Instead of providing a literal unit value in the DSL, users can reference a parameter that will be resolved at runtime. This enables runtime-adjustable configuration for values that would otherwise be compile-time constants.

## Usage

    parameters do
      group :motion do
        param :max_effort, type: {:unit, :newton_meter}, default: ~u(10 newton_meter)
      end
    end

    topology do
      link :base do
        joint :shoulder do
          limit do
            effort(param([:motion, :max_effort]))
          end
        end
      end
    end

The `param/1` function creates a reference that:

- Is validated at compile-time to ensure the parameter exists
- Is resolved at robot startup to get the current parameter value
- Subscribes to parameter changes to keep the robot struct updated

# Summary

## Types

t()

## Functions

param(path)

Create a parameter reference for DSL fields.

# Types

# t()

    @type t() :: %BB.Dsl.ParamRef{expected_unit_type: atom() | nil, path: [atom()]}

# Functions

# param(path)

    @spec param([atom()]) :: t()

Create a parameter reference for DSL fields.

The path should match a parameter defined in the `parameters` section of the robot DSL.

## Examples

    param([:motion, :max_speed])
    param([:limits, :shoulder, :effort])