tub-uas / fcc

1 stars 0 forks source link

Flight Control Computer (FCC)

Build Tests

This repository contains the code running on the Flight Control Computer (FCC). It controls and communicates with the rest of the flight system via CAN (Controller Area Network).

General

Use the readme and scripts in the scripts/ directory to compile, run and manage the code. You might need to install some dependencies, such as boost (a C++ library) and wiringpi.

Boost installation

$ sudo apt-get install libboost-all-dev

Wiring Pi installation

$ wget https://project-downloads.drogon.net/wiringpi-latest.deb
$ sudo dpkg -i wiringpi-latest.deb

Architecture

Directories

General overview of sub-directories. For more information consult README.md file in each sub-directory.

Layout

TODO

Operating System

Start by setting up a "normal" RaspberryPi system. Then, follow the steps below:

# Enable can (dtparam=spi=on must be set)
dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=25,spimaxfrequency=2000000
# spimaxfrequency is optional to reduce or increase spi speed if errors occur on bus lane

into your /boot/config.txt and these

auto can0  
iface can0 can static  
    bitrate 500000  

into your /etc/network/interfaces.

Hardware

We are currently using a RaspberryPi 3 (and 4) Model B. It is connected to a custom build shield (hat) that provides power and communication over the CAN bus.

RaspberryPi with CAN interface shield: RaspberryPi mounted in complete stack:

For more information about the shield and the rest of the custom hardware, have a look at the mfs-hardware repository.

Operation

We are currently supporting 3x 3 Flightmodes Mode. Flightfunction Func selects which 3 Flightmodes are active. So on total we could theoretically support 9 different actual modes.

The 3 possible states Mode can be in are MANUAL AUTNOMOUS and EXPERIMENTAL. The 3 possible states Func are divided in FCT_0 FCT_1 and FCT_2. The AUTONOMOUS mode is build on the MANUAL mode. This means, if AUTONOMOUS mode is active, all MANUAL functions are active as well. EXPERIMENTAL mode and functions are free to use and not determined to a specific behaviour yet.

Flightmode / Flightfunction FCT_0 FCT_1 FCT_2
MANUAL Manual control Attitude control Height, velocity and course control
AUTONOMOUS Mission Tracker Advanced
EXPERIMENTAL TBA TBA TBA

In addition to above presented modes / functions the pilot can decide whether the control output from the RaspberryPi should actually be used as control input to the aircraft or whether the aircraft should directly be controlled (without going through the RaspberryPi) from pilot commands. This is in addition to the "Manual control" option as seen in the table above where the signals are send through the RaspberryPi but not being modified. This is controlled via software running on the RAI board. We will call this pilot-overwrite.

Dynamics and Control

We are using the following body coordinate system:

The default orientation coordinate system of the stack is the following:

Because the stack is turned onto its left side inside the Hype aircraft, the hype coordinate system is slightly different. While x stays the same y becomes z and z becomes -y.

Styleguide

In general, follow the Google C++ and the PEP8 Python style guides. Where deemed sensible and / or necessary, diverge from these guides.