# nasa/astrobee architecture

> Architecture diagram of the GitHub repository nasa/astrobee, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nasa/astrobee
- Repository: https://github.com/nasa/astrobee

## Overview

##### Major Components
- Flight Software Core – Represented by the “astrobee” package that integrates the overall flight control. This includes components such as “commands,” “plans,” launch files, configuration management, and the main ROS entry points.
- Behavior Modules – Separated under folders like “behaviors/arm”, “behaviors/dock”, “behaviors/light_flow”, “behaviors/perch”, and “behaviors/states”. These modules implement finite state machines or command execution routines.
- Navigation, Guidance & Control (GN&C) – The “gnc” directory includes modules for control logic (“ctl”, “fam”, and “pmc”), which represent the robotics control core.
- Hardware Drivers – Organized as separate packages under “hardware” (for EPS drivers, imus, lasers, perching arms, etc.) that interface directly with sensors and actuators.
- Localization – A large suite dedicated to vision and sensor data fusion (including “localization”, “graph_localizer”, “ros_graph_localizer”, “ros_pose_extrapolator”, etc.). This captures vision-based localization, depth odometry, and pose estimation.
- Communications – Folders like “communications” (with submodules for DDS, ROS bridges, ff_hw_msgs, ff_msgs, etc.) that enable messaging between onboard processes and with ground control.
- Mobility and Planning – Under “mobility” (with “choreographer”, “mapper”, “planner_qp”, “planner_trapezoidal”, etc.) covering mapping, trajectory planning, and motion execution.
- Management and System Monitoring – Under “management” (with modules for CPU/memory monitoring, disk, executive, and access control) that provide system health and monitor fault management.
- Simulation – The “simulation” folder shows the high-fidelity simulator built using Gazebo and ROS that replicates physics, sensor plugins, and environment configuration.
- Shared/Support Libraries – “shared” directories (such as “ff_common”, “ff_util”, “jsonloader”, etc.) which provide common functionality for configuration, message conversion, and utility processes.
- Tools and Scripts – A wide range of tools for building, calibration, bag processing, performance testing, and postprocessing. These tools, although not part of the runtime system, support development and testing.

##### Interactions and Data Flow
- The Flight Software Core interacts with Behavior Modules to execute commands, which in turn rely on GN&C routines for motion control.
- Hardware drivers provide sensor data (from devices such as IMUs, laser scanners, cameras) and receive actuator commands, interfacing with the flight software through ROS nodelets.
- Localization and perception modules ingest sensor data to produce pose estimates that feed into the navigation and control loops.
- Communications components provide middleware interfaces via ROS and DDS to connect onboard modules and to support the ground data system (GDS).
- Simulation components mimic actual hardware and environmental interactions, using Gazebo plugins that often replicate the hardware interfaces found in the “hardware” folder.
- Management services monitor system health parameters, manage data collection (data_bagger, cpu_mem_monitor, disk_monitor), and coordinate higher-level executive decisions.
- Tools are used in the build/deployment pipeline and for calibrating sensors, processing recorded data (bags), and tuning parameters.

##### Architectural Patterns and Principles
- Layered Architecture: High-level decision-making (flight software and behaviors) depends on lower-level drivers and middleware components.
- Separation of Simulation and Real-World Execution: Distinguish between the “simulation” environment and the actual onboard robot software running on Astrobee.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Onboard Flight Software"
        A["Flight Software Core"]
        B["Behavior Modules"]
        C["Navigation, Guidance & Control (GN&C)"]
        D["Hardware Drivers"]
    end

    subgraph "Perception & Localization"
        E["Localization"]
    end

    subgraph "Communications"
        F["Communications"]
    end

    subgraph "Mobility and Planning"
        G["Mobility and Planning"]
    end

    subgraph "Management and Monitoring"
        H["Management and System Monitoring"]
    end

    subgraph "Simulation Environment"
        I["Simulation"]
    end

    subgraph "Support Libraries"
        J["Shared / Support Libraries"]
    end

    subgraph "Development Tools"
        K["Tools and Scripts"]
    end

    %% Interactions and Data Flow
    A -->|"dispatches"| B
    B -->|"executes"| C
    C -->|"controls"| D
    D -->|"sends_sensor_data"| E
    E -->|"informs"| C
    A <-->|"ROS_messaging"| F
    A -->|"mission_status"| H
    A -->|"trajectory_planning"| G
    G -->|"commands_motion"| D
    I -->|"mimics_hardware"| D
    D -->|"feedback"| I
    J -->|"provides_services"| A
    K -->|"supports_development"| A

    %% Click Events for Components
    click A "https://github.com/nasa/astrobee/tree/master//astrobee"
    click B "https://github.com/nasa/astrobee/tree/master//behaviors"
    click C "https://github.com/nasa/astrobee/tree/master//gnc"
    click D "https://github.com/nasa/astrobee/tree/master//hardware"
    click E "https://github.com/nasa/astrobee/tree/master//localization"
    click F "https://github.com/nasa/astrobee/tree/master//communications"
    click G "https://github.com/nasa/astrobee/tree/master//mobility"
    click H "https://github.com/nasa/astrobee/tree/master//management"
    click I "https://github.com/nasa/astrobee/tree/master//simulation"
    click J "https://github.com/nasa/astrobee/tree/master//shared"
    click K "https://github.com/nasa/astrobee/tree/master//scripts and /tools"

    %% Styling Classes
    classDef onboard fill:#FFCC00,stroke:#333,stroke-width:2px;
    classDef localization fill:#66CC66,stroke:#333,stroke-width:2px;
    classDef communications fill:#66CCCC,stroke:#333,stroke-width:2px;
    classDef management fill:#FF9966,stroke:#333,stroke-width:2px;
    classDef simulation fill:#CCCCFF,stroke:#333,stroke-width:2px;
    classDef mobility fill:#99CC99,stroke:#333,stroke-width:2px;
    classDef shared fill:#CCCCCC,stroke:#333,stroke-width:2px;
    classDef tools fill:#FF99CC,stroke:#333,stroke-width:2px;

    %% Assign classes to nodes
    class A,B,C,D onboard;
    class E localization;
    class F communications;
    class H management;
    class I simulation;
    class G mobility;
    class J shared;
    class K tools;
```
