# UAVCAN ESCs (Motor Controllers)

PX4 supports UAVCAN ESCs. These have a number of advantages over PWM ESCs:

  • UAVCAN has been specifically designed to deliver robust and reliable connectivity over relatively large distances. It enables safe use of ESCs on bigger vehicles and communication redundancy.
  • The bus is bi-directional, enabling health monitoring and diagnostics.
  • Wiring is less complicated as you can have a single bus for connecting all your ESCs and other UAVCAN peripherals.
  • Setup is easier as you configure ESC numbering by manually spinning each motor (for most types of UAVCAN ESCs).

# PX4 Supported ESC

PX4 is compatible with any/all UAVCAN v0 ESCs. At time of writing PX4 does not yet support UAVCAN v1.0.

UAVCAN is generally speaking a plug'n'play protocol. The main difference between UAVCAN ESCs from a setup perspective is that the physical connectors and the software tools used to configure the motor order and direction may be different.

Some popular UAVCAN ESC firmware/products include:

注解

This list is not exhaustive/complete. If you know of another ESC, please add it to the list!

# Purchase

Sapog-based ESCs:

Mitochondrik based drives and ESC:

注解

There are many other commercially available ESCs; please add new links as you find them!

# Wiring/Connections

Connect all of the on-board UAVCAN devices into a chain and make sure the bus is terminated at the end nodes. The order in which the ESCs are connected/chained does not matter.

For more information see UAVCAN > Wiring.

注解

All UAVCAN ESCs share the same connection architecture/are wired the same way. Note however that the actual connectors differ (e.g. Zubax Orel 20 and Holybro Kotleta20 use Dronecode standard connectors (JST-GH 4 Pin) - while VESCs do not).

# PX4 Configuration

In order to use a UAVCAN ESC with PX4 you will need to enable the UAVCAN driver:

  1. Power the vehicle using the battery (you must power the whole vehicle, not just the flight controller) and connect QGroundControl.
  2. Navigate to the Vehicle Setup > Parameters screen. :::note Parameters explains how to find and set parameters. :::
  3. Set UAVCAN_ENABLE to the value Sensors and Motors (3) and then reboot the flight controller. This enables automatic enumeration of the motors (ESC) as described in the next section.
  4. (Optional) Set UAVCAN_ESC_IDLT to 1 in order to ensure that the motors are always running at least at the idle throttle while the system is armed. :::note Some systems will not benefit from this behavior, e.g. glider drones). :::

# ESC Setup

While UAVCAN devices are generally plug'n'play you will still need to enumerate (number) each of the ESC used in your system and set their direction so that they can be identified/controlled by PX4.

注解

The ESC index and direction must match/map to the Airframe Reference for the vehicle type. ESC indexes from 0-7 map to MAIN 1-8, while ESC indexes 8-15 map to AUX 1-8.

The mechanism for enumerating each type of UAVCAN ESC is different (look up the instructions in your ESC's manual). Setup information for some UAVCAN ESCs is provided below.

# Sapog ESC Enumeration using QGroundControl

This section shows how to enumerate any Sapog-based (opens new window)-based ESCs "automatically" using QGroundControl.

提示

You can skip this section if there is only one ESC in your setup, because the ESC index is already set to zero by default.

To enumerate the ESC:

  1. Power the vehicle with a battery and connect to QGroundControl

  2. Navigate to Vehicle Setup > Power in QGC.

  3. Start the process of ESC auto-enumeration by pressing the Start Assignment button, as shown on the screenshot below.

    QGC - UAVCAN ESC auto-enumeration

    You will hear a sound indicating that the flight controller has entered the ESC enumeration mode.

  4. Manually turn each motor in the correct direction of its rotation (as specified in the Airframe Reference), starting from the first motor and finishing with the last motor. Each time you turn a motor, you should hear a confirmation beep.

    注解

Make sure to turn each of the motors in the correct direction, as the ESC will automatically learn and remember the direction (i.e. motors that spin clockwise during normal operation must also be turned clockwise during enumeration). :::

  1. After the last motor is enumerated, the confirmation sound should change to indicate that the enumeration procedure is complete.
  2. Reboot PX4 and the Sapog ESCs to apply the new enumeration IDs.

The following video demonstrates the process:

# Manual ESC Enumeration using Sapog

提示

We recommend automated Sapog ESC Enumeration using QGroundControl shown above rather than manual enumeration (as it is easier and safer).

You can manually configure the ESC index and direction using the UAVCAN GUI Tool (opens new window). This assigns the following Sapog configuration parameters for each enumerated ESC:

  • esc_index
  • ctl_dir

注解

See Sapog reference manual (opens new window) for more information about the parameters.

# Myxa ESC Setup

Motor enumeration for Myxa Telega-based ESCs (opens new window) is usually performed using the Kucher tool (opens new window) (or less "GUI-friendly" UAVCAN GUI Tool (opens new window)).

There is some guidance here: Quick start guide for Myxa v0.1 (opens new window) (Zubax blog).

# VESC ESC Setup

For VESC ESCs (opens new window) the preferred tool for motor enumeration is the VESC tool (opens new window). In addition to the normal motor configuration that you will have to setup in the VESC tool, you will also need to properly setup the app configuration. The recommended app setup is as follows:

Parameter Option
App to use No App
VESC ID 1,2,...
Can Status Message Mode CAN_STATUS_1_2_3_4_5
CAN Baud Rate CAN_BAUD_500K
CAN Mode UAVCAN
UAVCAN ESC Index 0,1,...

VESC ID should have the same motor numbering as in PX4 convention, starting at 1 for top-right motor, 2 for bottom-left motor etc. However the UAVCAN ESC Index starts from 0, and as such it is always one index lower than the VESC ID. For example, in a quadcopter the bottom left motor will have VESC ID = 2 and UAVCAN ESC Index = 1.

Finally the CAN Baud Rate must match the value set in UAVCAN_BITRATE.

# Troubleshooting

# Motors not spinning when armed

If the PX4 Firmware arms but the motors do not start to rotate, check that parameter UAVCAN_ENABLE=3 to use UAVCAN ESCs. If the motors do not start spinning before thrust is increased, check UAVCAN_ESC_IDLT=1.

# UAVCAN devices dont get node ID/Firmware Update Fails

PX4 requires an SD card for UAVCAN node allocation and during firmware update (which happen during boot). Check that there is a (working) SD card present and reboot.

# Further Information