Source Code

PythonPilot is a new flight controller software suite developed by Robotics-In-Flight LLC for UAVs.   Although currently designed for quadcopters, it is readily extendable to multi-copters, and to platforms of other types, i.e. fixed wing, ground vehicles, water craft.   Users are free to download and use this open-source code in their projects, with suggestions on how to do so in Getting Started.  Source code components in block diagram below are those in gold.  Hardware components are shown on the right in violet.

PythonPilot open-source code flow diagram

Access to the open source code is available to registered members.  The following links will take you to the Member Registration page (it’s free) and to the Source Code page.    Send your questions / queries to the Forums or Contact Us pages.    General information on the topics of control systems, mechatronics, multi-copter and drone construction is provided in the Knowledge Base

Top level descriptions of the various python routines are given below.  Get there quickly by clicking here:

pythonpilot_main.py | gnc.py | flt_st.py | imu.py | esc.py | kb_cmd.py

pythonpilot_main.py

The top level, main component, pythonpilot_main.py, calls various subroutines and handles data passing from the code to hardware components shown on the right in violet.   Software blocks are those in gold.   Modification of this code to port the code to other multi-copter platforms requiring different parameters (i.e. platform mass, thrust/control coefficient, etc.) will be provided shortly in a soon to be published Blog Post.

gnc.py

The module ‘gnc.py’ includes subroutines handling the (a) guidance, (b) navigation, and (c) control functions of the flight controller.    The ‘guidance’ function converts stick setpoints into roll and pitch angle setpoints, yaw rate setpoint, and an altitude setpoint.   ‘navigation’ is generating a filtered estimate of the state of the platform for use in platform stabilization guidance.   This state vector includes: 3 components of velocity, altitude, angular rates, angles, and a number of sensor biases that are being removed.   It is not yet generating a complete navigation solution including the Geodetic location on the earth.   The ‘control’ function handles the stabilization of the platform and tracking of platform setpoints.

flt_st.py

The module ‘flt_st.py’ is the flight state controller.  It handles transitions through the various operational modes – preflight calibration, idle mode, and flight mode.

imu.py

‘imu.py’ is the interface module that reads the Inertial Measurement Units (IMUs) components of angular rate and linear acceleration.

esc.py

‘esc.py’ handles the sending of control samples to the 4 individual Electronic Speed Controller (ESC) devices.

kb_cmd.py

‘kb_cmd.py’ is a rarely used function that receives data from a user terminal like Putty, receiving and sending into the code keyboard inputs via the WiFi link. Comes in handy when implementing and testing new functionality.