BB.Supervisor (bb v0.2.1)

View Source

Root supervisor for a BB robot.

Builds a supervision tree that mirrors the robot topology for fault isolation. A crash in an actuator at the end of a limb only affects that limb's subtree.

Supervision Tree Structure

BB.Supervisor (root, :one_for_one)
 Registry (named {MyRobot, :registry})
 PubSub Registry (named {MyRobot, :pubsub})
 Task.Supervisor (for command execution tasks)
 Runtime (robot state, state machine, command execution)
 BB.SensorSupervisor (:one_for_one)
    RobotSensor1, RobotSensor2...
 BB.ControllerSupervisor (:one_for_one)
    Controller1, Controller2...
 BB.BridgeSupervisor (:one_for_one)
    MavlinkBridge, PhoenixBridge...
 BB.LinkSupervisor(:base_link, :one_for_one)
     LinkSensor (link sensors)
     BB.JointSupervisor(:shoulder, :one_for_one)
         JointSensor
         JointActuator
         BB.LinkSupervisor(:arm, :one_for_one)
             ...

Each subsystem supervisor (sensors, controllers, bridges) has its own restart budget, so a flapping process in one won't exhaust the root supervisor's budget and bring down the entire robot.

Summary

Functions

Starts the supervisor tree for a robot module.

Functions

start_link(robot_module, opts \\ [])

@spec start_link(module(), Keyword.t()) :: Supervisor.on_start()

Starts the supervisor tree for a robot module.

Options

All options are passed through to sensor and actuator child processes.