STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
sequencer Namespace Reference

Namespaces

namespace  anonymous_namespace{AbortBroadcaster.cpp}
namespace  anonymous_namespace{PressureFeed.cpp}
namespace  anonymous_namespace{ScriptRunner.cpp}
namespace  anonymous_namespace{ScriptStates.cpp}
namespace  anonymous_namespace{StateMachine.cpp}

Classes

class  AbortBroadcaster
 Sends ABORT / ABORT_DONE / CLEAR_ABORT UDP broadcast packets (PacketHeader only — 6 bytes) to the configured broadcast address and port. More...
struct  ActuatorRole
 Config entry for one named actuator role loaded from config.toml [actuator_roles]. More...
class  ActuatorCommander
 Sends UDP actuator commands based on state transitions. More...
struct  HoldSpec
 What one hold is: how long, and who to tell. More...
class  HoldTimer
 A cancellable hold of an exact length, and nothing else. More...
class  PressureFeed
 Live calibrated pressures, by ROLE NAME, for the sequencer. More...
struct  ScriptEnv
 What a running script is allowed to do to the world. More...
class  ScriptRunner
 Runs one dynamic state's script on its own thread. More...
struct  DynamicState
 One dynamic state, resolved and proven usable. More...
struct  ScriptLoadResult
 What a config load made of its dynamic states. More...
struct  ScriptLoadContext
 Everything load_dynamic_states needs that it cannot get from Config alone. More...
class  SequencerService
 Top-level sequencer service. More...
class  StateMachine
 Parses state_transitions.csv and validates state transitions. More...
struct  Expr
struct  ScriptProgram
 A parsed script, as a flat arena. More...
struct  Stmt

Typedefs

using ActuatorCommandedMsg = comms::CommsMessage<uint64_t, uint8_t, uint8_t>
using SequencerStateMsg
using StateTransitionMsg = comms::CommsMessage<uint64_t, uint8_t, uint8_t, uint8_t>

Enumerations

enum class  State : uint8_t {
  DEBUG = 0 , IDLE = 1 , ARMED = 2 , FUEL_FILL = 3 ,
  OX_FILL = 4 , GN2_LOW_PRESS = 5 , GN2_VENT = 6 , FUEL_PRESS = 7 ,
  FUEL_VENT = 8 , OX_PRESS = 9 , OX_VENT = 10 , GN2_HIGH_PRESS = 11 ,
  GN2_HIGH_VENT = 12 , VENT = 13 , CALIBRATE = 14 , READY = 15 ,
  FIRE = 16 , ENGINE_ABORT = 17 , GSE_ABORT = 18 , EMERGENCY_ABORT = 19 ,
  PRESS_STANDBY = 20 , UNKNOWN = 255
}
 System state IDs — must match the TypeScript SystemState enum in web-gui/shared/types.ts. More...
enum class  ExprKind
enum class  Op
enum class  StmtKind

Functions

bool parseHoldMs (const std::string &text, uint32_t &out)
 Parse a hold duration off the wire, strictly.
ScriptLoadResult load_dynamic_states (const fsw::config::Config &cfg, const std::string &config_text, const ScriptLoadContext &ctx)
 Resolve, load and validate every [[states]] entry carrying a script_file.
bool is_valid_script_filename (const std::string &name)
 True when name is a safe bare script filename: ^[A-Za-z0-9_-]+.script$, no separators.
static uint8_t actuator_elodin_low_byte (uint32_t board_id, uint8_t local_channel)
 Elodin low byte for [0x32, lo]: (board_slot - 1) * 0x20 + local_channel; slot = board_id % 10, 0 → 10.
static std::string trimVal (const std::string &s)
static std::string toLower (std::string s)
static uint64_t now_ns ()
static std::string readFile (const std::string &path)
static std::string resolveDataPath (const std::string &rel)
static std::string trimCell (const std::string &s)

Variables

constexpr uint32_t kMaxHoldMs = 3600000
 Hard ceiling on any client-supplied hold, independent of per-state config.
constexpr uint32_t kMaxScriptTimeoutMs = 600000
 Hard ceiling on script_timeout_ms, independent of per-state config.
static constexpr uint16_t VTABLE_SEQUENCER_STATE = 0x5000
static constexpr uint16_t VTABLE_STATE_TRANSITION = 0x4300
static constexpr int kControllerConnectTimeoutMs = 300

Typedef Documentation

◆ ActuatorCommandedMsg

using sequencer::ActuatorCommandedMsg = comms::CommsMessage<uint64_t, uint8_t, uint8_t>

Definition at line 32 of file ActuatorCommander.cpp.

◆ SequencerStateMsg

Initial value:
CommsMessage - Template-based message serialization.

Definition at line 43 of file SequencerService.cpp.

◆ StateTransitionMsg

using sequencer::StateTransitionMsg = comms::CommsMessage<uint64_t, uint8_t, uint8_t, uint8_t>

Definition at line 47 of file SequencerService.cpp.

Enumeration Type Documentation

◆ ExprKind

enum class fsw::script::ExprKind : uint8_t
strong

Definition at line 93 of file StateScript.hpp.

◆ Op

enum class fsw::script::Op : uint8_t
strong

Definition at line 102 of file StateScript.hpp.

◆ State

enum class sequencer::State : uint8_t
strong

System state IDs — must match the TypeScript SystemState enum in web-gui/shared/types.ts.

Enumerator
DEBUG 
IDLE 
ARMED 
FUEL_FILL 
OX_FILL 
GN2_LOW_PRESS 
GN2_VENT 
FUEL_PRESS 
FUEL_VENT 
OX_PRESS 
OX_VENT 
GN2_HIGH_PRESS 
GN2_HIGH_VENT 
VENT 
CALIBRATE 
READY 
FIRE 
ENGINE_ABORT 
GSE_ABORT 
EMERGENCY_ABORT 
PRESS_STANDBY 
UNKNOWN 

Definition at line 14 of file StateMachine.hpp.

◆ StmtKind

enum class fsw::script::StmtKind : uint8_t
strong

Definition at line 83 of file StateScript.hpp.

Function Documentation

◆ actuator_elodin_low_byte()

uint8_t sequencer::actuator_elodin_low_byte ( uint32_t board_id,
uint8_t local_channel )
static

Elodin low byte for [0x32, lo]: (board_slot - 1) * 0x20 + local_channel; slot = board_id % 10, 0 → 10.

Definition at line 36 of file ActuatorCommander.cpp.

References board_id.

Referenced by sequencer::ActuatorCommander::applyForState(), and sequencer::ActuatorCommander::publishInitialState().

◆ is_valid_script_filename()

bool sequencer::is_valid_script_filename ( const std::string & name)

True when name is a safe bare script filename: ^[A-Za-z0-9_-]+.script$, no separators.

Definition at line 12 of file ScriptStates.cpp.

References ok.

Referenced by load_dynamic_states().

◆ load_dynamic_states()

◆ now_ns()

uint64_t sequencer::now_ns ( )
static

◆ parseHoldMs()

bool sequencer::parseHoldMs ( const std::string & text,
uint32_t & out )
inline

Parse a hold duration off the wire, strictly.

Strictly, because the lenient version of this is a hazard: atoi("1e3") returns 1, so a frame asking for a thousand seconds would have quietly run a one-millisecond pulse and the operator would have weighed a mass against a window that never happened. The whole string must be digits.

Rejects: empty, non-digits, a leading sign, trailing junk, anything over kMaxHoldMs, and zero — zero is the "no duration supplied" sentinel everywhere else, so it must never arrive as one.

Parameters
outwritten only on success.
Returns
true if text is a usable duration.

Definition at line 31 of file HoldParse.hpp.

References b, kMaxHoldMs, and res.

Referenced by anonymous_namespace{sequencer_main.cpp}::handleCommandLine(), and main().

◆ readFile()

std::string sequencer::readFile ( const std::string & path)
static

◆ resolveDataPath()

std::string sequencer::resolveDataPath ( const std::string & rel)
static

Definition at line 192 of file SequencerService.cpp.

Referenced by sequencer::SequencerService::applyConfig().

◆ toLower()

◆ trimCell()

std::string sequencer::trimCell ( const std::string & s)
static

Definition at line 216 of file StateMachine.cpp.

References a, and b.

Referenced by sequencer::StateMachine::load().

◆ trimVal()

std::string sequencer::trimVal ( const std::string & s)
static

Definition at line 46 of file ActuatorCommander.cpp.

References a, and b.

Referenced by sequencer::ActuatorCommander::load().

Variable Documentation

◆ kControllerConnectTimeoutMs

int sequencer::kControllerConnectTimeoutMs = 300
staticconstexpr

◆ kMaxHoldMs

uint32_t sequencer::kMaxHoldMs = 3600000
inlineconstexpr

Hard ceiling on any client-supplied hold, independent of per-state config.

This is not the real limit — each holdable state carries its own, usually far smaller, max. This one exists so a typo or a garbage frame is rejected at the wire before it reaches anything that has to reason about it.

Definition at line 16 of file HoldParse.hpp.

Referenced by main(), and parseHoldMs().

◆ kMaxScriptTimeoutMs

uint32_t sequencer::kMaxScriptTimeoutMs = 600000
inlineconstexpr

Hard ceiling on script_timeout_ms, independent of per-state config.

Same posture as HoldParse's kMaxHoldMs: this is not the real limit — each state carries its own, usually far smaller — it exists so a typo cannot arm a valve-open window measured in hours.

Definition at line 20 of file ScriptStates.hpp.

Referenced by load_dynamic_states(), and main().

◆ VTABLE_SEQUENCER_STATE

uint16_t sequencer::VTABLE_SEQUENCER_STATE = 0x5000
staticconstexpr

Definition at line 32 of file SequencerService.cpp.

Referenced by sequencer::SequencerService::publishState().

◆ VTABLE_STATE_TRANSITION

uint16_t sequencer::VTABLE_STATE_TRANSITION = 0x4300
staticconstexpr