• Stars
    star
    203
  • Rank 192,890 (Top 4 %)
  • Language
    C
  • License
    BSD 3-Clause "New...
  • Created about 11 years ago
  • Updated almost 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Sapog - advanced multiplatform ESC firmware

PX4 Sapog

Forum Forum

Documentation

Sapog v2 Reference Manual is the main piece of project documentation; make sure to read it. Additional documentation and related resources can be found at the Zubax Knowledge Base.

Change Log

v2.3

  • Configuration parameter mot_i_shunt_mr has been removed; now the firmware detects the shunt resistance based on the HW ID pin states.
  • Migrated from GCC 4.9 to GCC 7.2.

v2.2

  • Added a low-pass filter on the estimated angular speed output. This change led to improved performance on motors with severe phase asummetry.
  • Improved RGB LED indication in the bootloader.

v2.1

  • Fixed stability issues at extremely high RPM (>10k mechanical RPM for 14 pole motor).
  • Default PWM frequency set to 60 kHz.

v2.0

  • Completely new, more robust spin up algorithm. Supports smooth start-up from standstill as well as picking up the rotation if the rotor is already spinning.
  • Significantly more reliable operation during rapid acceleration and deceleration, especially at high advance angles.
  • Wider PWM frequency range: 20...75 kHz.
  • Raised the maximum RPM limit; the new maximum for 14 pole motor exceeds 14000 mechanical RPM.

Firmware

If you're not running Linux or OSX natively, you can use Bistromathic - a Linux virtual machine pre-configured for embedded development.

Bootloader

The bootloader allows to update the firmware via the standard UAVCAN firmware upgrade protocol, which is documented at uavcan.org. No additional steps are needed to build the bootloader - the build system will build it automatically together with the firmware. The resulting *.elf file will be extended with the bootloader too, so it can be flashed directly into an factory fresh MCU.

Build Instructions

Prebuilt binaries are available at https://files.zubax.com/products/io.px4.sapog/.

Prerequisites:

  • GCC ARM 7.2
  • Python 3.2+
  • Linux or OSX host computer (Windows is not supported)
git submodule update --init --recursive
cd firmware
make RELEASE=1 # RELEASE is optional; omit to build the debug version

The build outputs will be stored into build/:

  • *.application.bin - built application binary, suitable for uploading via the bootloader;
  • *.compound.bin - application binary together with the bootloader, in one image;
  • compound.elf - application ELF together with the bootloader, in one file; this option is recommended for debugging.

Execute ./blackmagic_flash.sh [portname] from the tools directory to flash the firmware with a Black Magic Debug Probe.

Development

We recommend Eclipse for IDE, but any other IDE will work equally well. If you prefer Eclipse and need GUI debugging, avoid upgrading to any version newer than Luna, since in newer releases GUI GDB debugging of embedded targets is broken. Otherwise we recommend to use the latest Eclipse together with CLI GDB client. It's inconvenient, but unlike Eclipse it works reliably.

When editing code, please follow the PX4 coding conventions.

Hardware Timer Usage

  • TIM1 - 3-phase FET bridge PWM
  • TIM2 - ADC synchronization, works in lockstep with TIM1
  • TIM3 - RGB LED PWM
  • TIM4 - Hard real time callout interface for motor control logic (preempts the kernel)
  • TIM5 - RC PWM input capture
  • TIM6 - High precision timestamping for motor control logic (sub-microsecond resolution, never overflows)
  • TIM7 - General purpose timestamping

Hardware

Reference hardware design is published under CC BY-SA 3.0 in the PX4 Hardware repository.

Known commercially available compatible hardware designs are listed below.

More Repositories

1

PX4-Autopilot

PX4 Autopilot Software
C++
7,009
star
2

PX4-Avoidance

PX4 avoidance ROS node for obstacle detection and avoidance.
C++
618
star
3

PX4-ECL

Estimation & Control Library for Guidance, Navigation and Control Applications
C++
473
star
4

eigen

Eigen is a C++ template library for linear algebra: matrices, vectors, numerical solvers, and related algorithms.
C++
418
star
5

PX4-SITL_gazebo-classic

Set of plugins, models and worlds to use with OSRF Gazebo Simulator in SITL and HITL.
C++
368
star
6

PX4-user_guide

PX4 User Guide
Jupyter Notebook
257
star
7

PX4-Bootloader

PX4 Bootloader for PX4FMU, PX4IO and PX4FLOW
C
236
star
8

PX4-Flow

Firmware for PX4FLOW board
C
232
star
9

PX4-Devguide

PX4 Devguide GitBook
TeX
193
star
10

flight_review

web application for flight log analysis & review
Python
191
star
11

PX4-Matrix

Lightweight, dependency free Matrix library (BSD)
C++
176
star
12

PX4-OpticalFlow

This repository contains different algorithms to calculate the optical flow. It can be used as input for a position estimator
C++
156
star
13

NuttX

Standard NuttX with current PX4 patches
C
138
star
14

pyulog

Python module & scripts for ULog files
Python
124
star
15

px4_ros_com

ROS2/ROS interface with PX4 through a Fast-RTPS bridge
C++
120
star
16

PX4-GPSDrivers

Platform independent GPS drivers
C++
84
star
17

DriverFramework

Operating system and flight stack agnostic driver framework for POSIX (Linux, NuttX, Mac OS, QNX, VxWorks).
C++
77
star
18

px4_msgs

ROS/ROS2 messages that match the uORB messages counterparts on the PX4 Firmware
CMake
69
star
19

homebrew-px4

PX4-related Homebrew formula for developers using OS X
Ruby
68
star
20

PX4-containers

Build scripts for containers running various PX4 setups, like SITL with ROS.
Makefile
64
star
21

HIL

Hardware in the loop tools for PX4 Firmware
Python
38
star
22

PX4NuttX

For Migration to new NuttX Repository layout
36
star
23

PX4-windows-toolchain

Repo containing all scripts to install and use the PX4 Toolchain for Windows.
Batchfile
31
star
24

snap_cam

This package provides tools to work with the Snapdragon Flight cameras as well as perform optical flow for use with the PX4 flight stack.
C++
27
star
25

NuttX-apps

Standard NuttX apps with current PX4 patches
C
26
star
26

PX4-gazebo-models

Model repo in app.gazebosim.org
Python
18
star
27

uvc_ros_driver

A ros node to stream images from a multi-camera UVC device
C++
18
star
28

px4ros

contains submodules for ROS SITL, used to define relations between projects/versions
17
star
29

Lepton

FLIR Lepton ROS node
C++
14
star
30

docs.px4.io

PX4 User Guide Content: See https://github.com/PX4/px4_user_guide
HTML
11
star
31

micrortps_agent

microRTPS agent side of the microRTPS bridge. Used to interface PX4 with the DDS world through FastRTPS/FastDDS.
C++
10
star
32

UAVCAN_Bootloaders

C
8
star
33

disparity_to_point_cloud

ROS Node which converts a disparity map in a point cloud
C++
8
star
34

electronWebGCS

JavaScript
7
star
35

ulog_cpp

C++ library for reading and writing ULog files
C++
7
star
36

dev.px4.io

PX4 Developer Guide Content: See https://github.com/PX4/Devguide
HTML
7
star
37

rpi_toolchain

Files for building PX4 POSIX on Raspberry Pi
Shell
5
star
38

mav_comm

This repository contains message and service definitions used for mavs. All future message definitions go in here, existing ones in other stacks should be moved here where possible.
C++
4
star
39

px4_sdk

Library to control PX4 from a companion computer using ROS 2
C++
4
star
40

PX4-Metadata-Translations

Translated metadata for https://github.com/PX4/PX4-Autopilot
Python
3
star
41

Board_ID

3
star
42

uavcan_board_ident

CMake
2
star
43

PX4-graphics

Downloadable media assets and branding guideline
2
star
44

Toolchains

PX4 build system toolchains
Shell
2
star
45

Firmware-Doxygen

PX4 Firmware Doxygen documentation
HTML
2
star
46

rddrone_uavcan

2
star
47

companion

Companion computer bringup and maintenance scripts
Shell
1
star
48

px4_msgs-release

Release repository of px4_msgs for ROS (1) distros
1
star
49

px4_msgs2-release

Release repository of px4_msgs for ROS 2 distros
1
star
50

NuttX-NxWidgets

C++
1
star
51

rfcs

Requests for Comment for PX4/Firmware
1
star