BB.Jido.Signal (bb_jido v0.2.0)

Copy Markdown View Source

Canonical mapping from BB.PubSub messages to Jido.Signal structs.

PubSub subscribers receive {:bb, source_path, %BB.Message{}}. This module converts those into Jido.Signal structs with stable, queryable type strings following the bb.* namespace.

Naming convention

  • bb.state.transition — robot state machine transitions (payload BB.StateMachine.Transition).
  • bb.safety.error — safety hardware errors (payload BB.Safety.HardwareError).
  • bb.parameter.changed — parameter updates (payload BB.Parameter.Changed).
  • bb.pubsub.<path> — generic envelope for any other PubSub message, where <path> is the dotted source path (e.g. bb.pubsub.sensor.joint_state).

Source follows the /bb/<robot_module> convention for traceability, and the CloudEvents subject attribute carries the robot module name so handlers can identify the robot without unpacking data.

Summary

Functions

Returns the canonical signal source string for a robot module.

Returns the CloudEvents subject for a robot module — the robot's module name, or nil when the robot is unknown.

Returns the canonical signal type string for a given path/payload pair.

Functions

from_pubsub(robot, source_path, message)

@spec from_pubsub(module() | nil, [atom()], BB.Message.t()) :: Jido.Signal.t()

Converts a BB.PubSub delivery into a Jido.Signal.

  • robot is the robot module that owns the subscription (used to build the signal source URI; falls back to the robot recorded on the message itself).
  • source_path is the publisher's full path as delivered by BB.PubSub.
  • message is the %BB.Message{} payload.

source(robot)

@spec source(module() | nil) :: String.t()

Returns the canonical signal source string for a robot module.

subject(robot)

@spec subject(module() | nil) :: String.t() | nil

Returns the CloudEvents subject for a robot module — the robot's module name, or nil when the robot is unknown.

type_for(path, arg2)

@spec type_for([atom()], struct() | nil) :: String.t()

Returns the canonical signal type string for a given path/payload pair.

Specialised types are recognised for well-known payload modules so that agents can subscribe to (for example) bb.state.transition regardless of the path the publisher used.