UAVCAN ESCs (Motor Controllers)
PX4 supports the UAVCAN bus for connecting peripherals, including ESCs, GPS modules, various types of sensors, etc.
UAVCAN ESCs have a number of advantages over PWM ESCs and Servos:
- 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.
PX4 Supported ESC
PX4 is compatible with any/all UAVCAN ESCs (UAVCAN is generally speaking a plug’n’play protocol).
Note At time of writing PX4 supports UAVCAN v0 (not v1.0).
The only 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:
- Sapog firmware; an advanced open source sensorless PMSM/BLDC motor controller firmware designed for use in propulsion systems of electric unmanned vehicles.
- Mitochondrik - integrated sensorless PMSM/BLDC motor controller chip (used in ESCs and integrated drives)
- Myxa - High-end PMSM/BLDC motor controller (FOC ESC) for light unmanned aircraft and watercraft.
- VESC Project ESCs (see also Benjamin Vedder’s blog - project owner)
- OlliW’s UC4H ESC-Actuator Node
- A number of others are listed here
Note 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:
Note There are many other commercially available ESCs; please add new links as you find them!
Wiring/Connections {#connecting}
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.
Note 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).
For more information information about proper bus connections see UAVCAN Device Interconnection (Zubax KB).
PX4 Configuration
In order to use a UAVCAN ESC with PX4 you will need to enable the UAVCAN driver:
- Power the vehicle using the battery (you must power the whole vehicle, not just the flight controller!) and connect QGroundControl.
- Navigate to the Vehicle Setup > Parameters screen > Parameters explains how to find and set parameters.
- Set UAVCAN_ENABLE to the value Sensors and Motors (3) and then reboot the flight controller.
If applicable (some systems will not benefit from this behavior, e.g. glider drones):
- 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.
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.
Note 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 setup {#sapog}
The following sections explain how to enumerate Sapog-based-based ESCs with PX4. The instructions should work for any Sapog-based ESC design.
ESC Enumeration using QGroundControl {#sapog_esc_qgc}
Tip 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:
- Power the vehicle with a battery and connect to QGroundControl
- Navigate to Vehicle Setup > Power in QGC.
Start the process of ESC auto-enumeration by pressing the Start Assignment button, as shown on the screenshot below.
You will hear a sound indicating that the flight controller has entered the ESC enumeration mode.
Manually turn each motor in the correct direction of its rotation, starting from the first motor and finishing with the last motor. Each time you turn a motor, you should hear a confirmation.
Note Make sure to turn each of the motors in the correct direction, because 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).
After the last motor is enumerated, the confirmation sound should change to indicate that the enumeration procedure is complete.
The following video demonstrates the process:
{% youtube %} https://www.youtube.com/watch?v=4nSa8tvpbgQ {% endyoutube %}
Manual ESC Enumeration using Sapog
Tip We recommend automated ESC Enumeration using QGroundControl rather than manual enumeration - it is easier and safer.
You can manually configure the ESC index and direction using the UAVCAN GUI Tool. This assigns the following Sapog configuration parameters for each enumerated ESC:
esc_index
ctl_dir
Note See Sapog reference manual for more information about the parameters.
Myxa ESC Setup
Motor enumeration for Myxa Telega-based ESCs is usually performed using the Kucher tool (or less “GUI-friendly” UAVCAN GUI Tool).
There is some guidance here: Quick start guide for Myxa v0.1 (Zubax blog).
VESC ESC Setup
For VESC the preferred tool for motor enumeration is the VESC tool.
Further Information
- PX4/Sapog (Github)
- Sapog v2 Reference Manual
- UAVCAN Device Interconnection (Zubax KB)
- Using Sapog based ESC with PX4 (Zubax KB)