/uas-catpilot

CatPilot is a hardware and OS agnostic drone's autopilot software stack. It is designed for faster creation of scalable distributed control systems for mission-critical applications. (UAS-CatPilot repo is a upper lever repo for sharing configurations for UAVs)

Primary LanguagePythonBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

CatPilot is a drone's autopilot software stack designed to create scalable, distributed embedded software systems.

CatPilot key idea is to use top-level domain-specific notations for specifying desired behavior. And the minimalistic generalized C-language codebase to execute it for real-time mission-critical applications.

Key features

  • written in C language;
  • extends via atomic functions - reusable blocks with supporting code generation from formal description;
  • integrates to the specific vehicle by XML-shaped DSLs, which are orchestrated by model-based design tools;
  • provides hardware and OS-agnostic stack that can easily migrate from one hardware to another while growing from prove-of-concept prototype to the certification grade solution;
  • provides services for telemetry transmission, logging and visualization.

Atomic functions

1. Create formal representation
from fspeclib import *

Function(
    name='core.quat.prop',
    title=LocalizedString(
        en='Propagate quaternion'
    ),
    inputs=[
        Input(
            name='omega',
            title='Angular rate vector',
            value_type='core.type.v3f64'
        ),

        Input(
            name='q0',
            title='Initial quat',
            value_type='core.type.quat'
        ),

        Input(
            name='q',
            title='Recurrent quat',
            value_type='core.type.quat'
        ),

        Input(
            name='reset',
            title='Reset',
            description='Command for re-initializing output quat by q0',
            value_type='core.type.bool',
            mandatory=False
        ),
    ],
    outputs=[
        Output(
            name='q',
            title='Updated quat',
            value_type='core.type.quat'
        ),
    ],
    state=[
        Variable(
            name='inited',
            title='Initialized flag',
            value_type='core.type.bool'
        ),
    ],

    injection=Injection(
        timedelta=True
    )
)
2. Generate integration software and the implementation stub

Simply run:

fspecgen.py --code --cmake --f_specs_dirs project:./atomics/ catpilot:catpilot/atomics/ catom:catpilot/c-atom/atomics/

Check Manual for details documentation for details

3. Implement behaviour
#include "core_quat_prop.h"

void core_quat_prop_exec(
    const core_quat_prop_inputs_t *i,
    core_quat_prop_outputs_t *o,
    core_quat_prop_state_t *state,
    const core_quat_prop_injection_t *injection
)
{
    if (i->optional_inputs_flags.reset) {
        if (i->reset) {
            state->inited = 0;
        }
    }

    if (state->inited == FALSE) {
        o->q = i->q0;
        state->inited = 1;
    } else {
        o->q.w = i->q.w + -0.5 * ( i->q.x * i->omega.x + i->q.y * i->omega.y + i->q.z * i->omega.z ) * injection->dt;
        o->q.x = i->q.x +  0.5 * ( i->q.w * i->omega.x + i->q.y * i->omega.z - i->q.z * i->omega.y ) * injection->dt;
        o->q.y = i->q.y +  0.5 * ( i->q.w * i->omega.y + i->q.z * i->omega.x - i->q.x * i->omega.z ) * injection->dt;
        o->q.z = i->q.z +  0.5 * ( i->q.w * i->omega.z + i->q.x * i->omega.y - i->q.y * i->omega.x ) * injection->dt;
    }
}
4. Integrate and reuse easily
<f name="integrate_att" by_spec="core.quat.prop">
    <in alias="wx">omega_x/output</in>
    <in alias="wy">zero/output</in>
    <in alias="wz">zero/output</in>
    <in alias="q0">initial_euler/q</in>
    <in alias="q">norm_att_quat/q</in>
</f>
5. Check existing atomic functions catalog

Catalog's link

DSL based integration

Define top level behavior in the problem-oriented notation:

  • swsys - software system description layer; allocates functions and other blocks into tasks and processes.
  • flow - block to arrange computational graphs as a sequence of atomic reusable functions.
  • fsm - finite state machine notation, operates by states, transitions and actions on states and transitions.
  • ibr - interface bridge - designed to take care of converting information from and to other devices.
More info

Documentation

Model-based design representation

View this GitHub project in C-ATLAS

Target's software system outlook

Software system

Atomic function orchestration outlook

Functional flow

Hardware integration outlook

Hardware schematic

Quick control interfaces creation

Check documentation for more info

Vizialization tools

Quick start and documentation

Quick start manual

Documentation

Hardware support

CatPilot supports:

  1. CubePilot
  2. Catalyst Aerospace Technologies devices family

Project structure

Software architecture

This repository is created to collaborate on functions and configurations for Unmanned Aerial Systems, while hardware and platform related software is implemented in catpilot repo. CatPilot relates on C-ATOM library for its generic functionality. Core platform-agnostic middleware is the Embedded Software Bus (ESWB) library.

The project intends to separate knowledge is well-defined related and easily reusable modules.

How to contribute

  1. Join Discord, ask questions, raise issues
  2. Create UAS-specific or generic atomic functions
  3. Extend the list of the supported hardware (by the way, C-ATOM is application agnostic embedded stack)
  4. Help to make the documentation crystal clear by adjusting the text or highlighting grey spots and problems

Join the community

Discord group

logo_discord.png

Follow the updates