Skip to content

A case study in using model based system engineering tools and processes to develop flight software.

Notifications You must be signed in to change notification settings

ReggieMarr/space-vehicle-system

Repository files navigation

README

Overview

This project demonstrates an fprime powered flight software deployment which leverages state machines and other MBSE type models to generate code.

Getting Started

Dependencies

The project is containerized with Docker, ensuring compatibility across various environments including Ubuntu and WSL (Windows Subsystem for Linux). Before proceeding, ensure you have the following dependencies installed:

  • Git (For cloning the repository)
  • Docker (For running the software)

Ensure Docker is configured to run without sudo in your environment

Setting up the repo

Clone the repo and submodules

#Get the repo
git clone [email protected]:ReggieMarr/MBSE_FSW.git
cd MBSE_FSW
#pull in the submodules
git submodule update --init --recursive

Example Usage

The flight software ships with a script run.sh which can be used to simplify development and interaction with this repo’s assets. Commands are summarized as such:

.org_out/run.png

The script supports a number of useful commands. Tab completion is enabled by entering the following:

source .gen-run-complete.sh
❯ ./run.sh --help
Usage: run.sh [OPTIONS] COMMAND

Options:
  --daemon             Run as daemon
  --debug              Enable debug mode
  --as-host            Run as host
  --persist            Ignore startup issues and keep running
  --local              Use local environment
  --clean              Clean build
  --host-thread-ctl    Set thread control
  --help               Show this help message

Commands:
  docker-build         Build the Docker image
  build                Build the project
  inspect [container]  Inspect a container
  exec                 Execute the FlightComputer
  gds                  Run the GDS
  update               Pulls the latest version of docker images
  sync                 Pushes local changes and updates docker images
  gen-deps             Generate dependencies (for editor mapping)
  teardown             Tear down the environment
  test                 Run tests
  topology             Generate topology visualization

One use case is building and running the deployment, this can be done like so (note building clean is only necessary when making significant changes):

❯ ./run.sh build --clean && ./run.sh exec --local

This then provides a web based ui that can be viewed by visiting http://127.0.0.1:5000/#Channels on your preferred web browser.

Note this example runs a standard version of fprime-gds and deploys it locally. More information about the Web UI can be found here.

Additional Tips

  • Combine flags: ./run.sh --clean --debug exec
  • Script uses environment variables from .env file in the same directory
  • Use --daemon flag to run processes in the background
  • Use --host-thread-ctl when building for non-sudo host execution thread control

Note: Ensure proper permissions and Docker setup before running commands.

Flight Sequence State Machine

The following state machine is fed as input to STARS which then generates fpp and c++ as output.

@startuml

[*] --> IDLE:  /initFlightStatus()

state IDLE {
}

state IN_FLIGHT {
    [*] --> FIRING
    IN_FLIGHT:Entry: initFlightStatus()
    'FIXME consolidate this and the TBURN interval
    IN_FLIGHT:Internal: UPDATE_INTERVAL/updateFlightStatus()

    state FIRING {
        FIRING:Entry: engageThrust()
    }
    state GLIDING {
        GLIDING:Entry: disengageThrust()
        GLIDING:Internal: UPDATE_INTERVAL/updateFlightStatus(); checkLowAltReached()
    }
    'NOTE this should probably be replaced by an event
    'but we wanted to play with conditions here
    state tBurnCheck <<choice>>
    FIRING --> tBurnCheck: TBURN_CHECK_INTERVAL
    tBurnCheck --> GLIDING: [isTBurnReached()]

}

IDLE --> IN_FLIGHT: IGNITE
IN_FLIGHT --> IDLE: TERMINATE

@enduml

.org_out/FlightSM.svg

About

A case study in using model based system engineering tools and processes to develop flight software.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages