Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Principle:Facebookresearch Habitat lab App State Machine

From Leeroopedia
Knowledge Sources
Domains Human_in_the_Loop, Software_Architecture
Last Updated 2026-02-15 02:00 GMT

Overview

A dependency-injection-based application state machine pattern that manages interactive session lifecycle through discrete states with event-driven transitions.

Description

The App State Machine pattern structures HITL applications as a finite state machine where each state (AppState subclass) handles a specific phase of the interactive session (lobby, loading, gameplay, feedback, etc.). The AppService class serves as a dependency injection container, providing all framework services (environment, simulator, controllers, recorders) to each state without tight coupling.

Usage

Use when building HITL applications that need structured session management. The state machine pattern ensures clean transitions between session phases and proper resource management.

Theoretical Basis

The pattern combines two design patterns:

  1. State Machine: Discrete states with defined transitions (connect->lobby->gameplay->feedback->end)
  2. Dependency Injection: AppService provides services to states without inheritance coupling
# Abstract state machine
class AppState(ABC):
    def on_enter(self): ...
    def sim_update(self, dt): ...
    def on_exit(self): ...

states = [Lobby, LoadEpisode, Gameplay, Feedback, EndSession]
current_state = states[0]
# Transitions triggered by events (client connect, episode complete, etc.)

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment