Powered by AppSignal & Oban Pro

Lesson 01 Livebook: Probe Awakening

livebooks/01_probe_awakening.livemd

Lesson 01 Livebook: Probe Awakening

This notebook keeps lesson 1 focused on the pure Jido contract.

Mix.install([
  {:helios_fleet, path: "../01_probe_awakening"}
])

Walk Khepri Through First Light

alias HeliosFleet
alias HeliosFleet.Actions.AssignSurveyTarget
alias HeliosFleet.Actions.ClearForSurveyBurn
alias HeliosFleet.Actions.RecordSubsystemCheck
alias HeliosFleet.Agents.SurveyProbe

probe = HeliosFleet.new_probe()

{probe, []} =
  SurveyProbe.cmd(
    probe,
    {RecordSubsystemCheck,
     %{
       subsystem: "power_bus",
       status: "nominal",
       detail: "reactor stable at hotel load"
     }}
  )

{probe, []} =
  SurveyProbe.cmd(
    probe,
    {RecordSubsystemCheck,
     %{
       subsystem: "thermal_loop",
       status: "nominal",
       detail: "radiator petals holding shadow-side equilibrium",
       thermal_state: "shadow_stable"
     }}
  )

{probe, []} =
  SurveyProbe.cmd(
    probe,
    {RecordSubsystemCheck,
     %{
       subsystem: "attitude_control",
       status: "nominal",
       detail: "reaction wheels trimmed against drift"
     }}
  )

{probe, []} =
  SurveyProbe.cmd(
    probe,
    {RecordSubsystemCheck,
     %{
       subsystem: "sensor_mast",
       status: "nominal",
       detail: "lidar aperture clean after dust shake"
     }}
  )

{probe, []} =
  SurveyProbe.cmd(
    probe,
    {AssignSurveyTarget,
     %{
       name: "ice fragment 6R",
       safe_standoff_m: 1_500,
       scan_profile: "passive_then_lidar"
     }}
  )

{probe, []} = SurveyProbe.cmd(probe, {ClearForSurveyBurn, %{}})

HeliosFleet.mission_snapshot(probe)

Inspect The Failure Surface

probe = HeliosFleet.new_probe()

{probe, []} =
  SurveyProbe.cmd(
    probe,
    {RecordSubsystemCheck,
     %{
       subsystem: "thermal_loop",
       status: "degraded",
       detail: "radiator petal three is lagging in sunlight",
       thermal_state: "rising"
     }}
  )

{probe, []} =
  SurveyProbe.cmd(
    probe,
    {AssignSurveyTarget,
     %{
       name: "ice fragment 6R",
       safe_standoff_m: 1_500,
       scan_profile: "passive_then_lidar"
     }}
  )

{unchanged_probe, directives} = SurveyProbe.cmd(probe, {ClearForSurveyBurn, %{}})

%{
  mission_phase: unchanged_probe.state.mission_phase,
  active_faults: unchanged_probe.state.active_faults,
  directives: directives
}

Both success and failure stay explicit in cmd/2.