Rclex.ParameterEventHandler (Rclex (Experimental) v0.12.0)

Copy Markdown View Source

Helper for subscribing to ROS 2 /parameter_events and dispatching per-node or per-parameter callbacks.

The handler is a thin wrapper around Rclex.start_subscription/5 that filters incoming ParameterEvent messages by the fully qualified node name (e.g. "/ns/node") and optionally by parameter name(s).

Summary

Functions

Start a subscription on the local client_node_name for ROS 2 parameter events.

Stop the parameter-event subscription on client_node_name.

Functions

start(callback, client_node_name, opts \\ [])

@spec start(
  callback :: (Rclex.parameter_event() -> any()),
  client_node_name :: String.t(),
  opts :: keyword()
) :: :ok | {:error, term()}

Start a subscription on the local client_node_name for ROS 2 parameter events.

callback is invoked with a %Rclex.Pkgs.RclInterfaces.Msg.ParameterEvent{} struct whenever an event passes the configured filters.

Options

  • :namespace — namespace of the client node. Defaults to "/".
  • :node_filter — a fully qualified node name (e.g. "/ns/node") to filter events by. Defaults to nil (no filter).
  • :parameter_filter — a list of parameter names to filter by. Only events touching at least one of these parameters are forwarded. Defaults to nil (no filter).
  • :qos — defaults to Rclex.QoS.profile_parameter_events/0.

stop(client_node_name, opts \\ [])

@spec stop(client_node_name :: String.t(), opts :: keyword()) ::
  :ok | {:error, :not_found}

Stop the parameter-event subscription on client_node_name.