Skip to content

dudi-w/flight-simulator-interpreter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flight plan

Flight Simulator Code Interpreter

fligear Image

Static Badge Static Badge Static Badge Static Badge Static Badge

Flight plan project is to control a FlightGear flight simulator using a code source file written in a unique code syntax. The interpreter, developed in C++, analyzes and executes the code, communicating with the FlightGear simulator, And thus he controls his flight.

The source code is written in an unfamiliar language, similar to Python, you can have fun and try to build different programs and algorithms in this language, see an example of a program that calculates the Fibonacci number

Outline

Technologies and Programming Languages

  • C++.
  • MultiThreads.
  • TCP protocol.
  • Telnet protocol.
  • Design patterns: Command pattren, Singleton pattren.
  • Object-Oriented Programming (OOP) principles.
  • SOLID principles.

Dependencies and Prerequisites

Ensure the following dependencies are installed:

  • github
  • gcc compiler at least version 8
  • Cmake
  • Free ports for communication

Description of the program flow process

  1. Tokenization: The code is tokenized to prepare for analysis.
  2. Parsing: An analysis is performed, and a Binary Expression Tree is generated.
  3. Environment Definition: A definition file for simulator environment variables is created.
  4. Code Execution: The program runs the code, performing operations on the simulator, accessing the OS, connecting to a TCP server, running the simulator in a separate process, and managing TELNET communication for data storage.
  5. Device Settings: Adjustments for simulator plane devices are supported.
  6. Data Storage: Data received from the simulator is stored in a database.

Installation and Setup

  1. Clone the repository.
    git clone https://github.com/dudi-w/flight-simulator-interpreter.git
  2. Download and install FlightGear simulator.
    sudo apt-get update && apt-get install -y flightgear
  3. Ensure the availability of the necessary ports (5400, 5402).
    lsof  -i :5402 -i :5400
  4. setup the simulator
    sudo cp flight-simulator-interpreter/generic_json_format.xml /usr/share/games/flightgear/Protocol/generic_json_format.xml
  5. Compile the files.
    cd flight-simulator-interpreter
    mkdir build
    cd build
    cmake ..
    make -j4
  6. run the process
    # ./main <code_file> [<output_file>]
    ./main ../flight_instructions.txt /dev/null

Contribution Guidelines

We welcome contributions! If you would like to contribute to the project, follow these steps:

  1. Fork the repository
  2. Create a new branch
  3. Make your changes
  4. Submit a pull request

Vidoe demo

Project Demo

Acknowledgments

Special thanks to the members of the development team:

UML Diagram

UML Diagram

Run with Docker 🐳

git clone https://github.com/dudi-w/flight-simulator-interpreter.git
cd flight-simulator-interpreter
docker build -t flight_simulator_code_interpreter .
xhost +local:docker
docker run --rm -it --env DISPLAY=$DISPLAY --env QT_X11_NO_MITSHM=1 --volume /tmp/.X11-unix:/tmp/.X11-unix --privileged -p 5400:5400 -p 5402:5402 -p 8080:8080 flight_simulator_code_interpreter flight_instructions.txt