This article demonstrates how to integrate Sapog-based ESC into a UAV controlled by the PX4 Flight Stack. Autopilots based on the PX4 Flight Stack include Pixhawk, Pixracer, and many others.
The concepts explained here are applicable to any Sapog-based ESC design, such as Zubax Orel 20.
Connect all of the on-board CAN devices into a chain and make sure the bus is terminated at the end nodes. The order in which the ESC are chained does not matter. More information about proper bus connections can be gathered from the Cyphal/CAN device interconnection page.
PX4 supports the automatic ESC enumeration feature, so no manual configuration is needed. You may need to perform some tuning pertaining to the motor control characteristics though, but that task is out of the scope of this tutorial, and you may do that later.
The theory behind the process of auto-enumeration can be learned from the UAVCAN specification. A hands-on example from the developer perspective can be found on the UAVCAN website, too.
During the auto-enumeration process, the following configuration parameters will be assigned automatically for each enumerated ESC:
Learn more about configuration parameters in the Sapog reference manual.
You can skip the automated enumeration procedure by configuring the above listed parameters manually on each ESC. The UAVCAN GUI Tool should be of great help here.
Configuring the flight controller
Power on the UAV (powering on only the flight controller is not sufficient!), connect QGroundControl to the UAV, and navigate to the settings tab.
Enabling the UAVCAN driver
Set the configuration parameter
UAVCAN_ENABLE to the value
Sensors and Motors (the corresponding numeric value is 3). Any higher value, if supported, should also be acceptable. Afterwards, reboot the flight controller.
If applicable, it is also recommended to set the parameter
UAVCAN_ESC_IDLT to 1, which will ensure that the motors are always running at least at the idle throttle while the system is armed. Some systems, however, will not benefit from this behavior, e.g. glider drones.
Enumerating the ESC
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.
Start the process of ESC auto-enumeration as shown on the screenshot below.
You will hear a sound indication that the flight controller has entered the ESC enumeration mode. After that, manually turn each motor in the correct direction of its rotation, starting from the first motor and finishing with the last motor. 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). Each time you turn a motor, you should hear a sound confirmation. After the last motor is enumerated, the confirmation sound should be different, hinting you that the procedure is now completed.
The following video demonstrates the whole process: https://www.youtube.com/watch?v=4nSa8tvpbgQ
PX4 documentation portal: px4.io and pixhawk.org.
If you have any questions, bring them to the support forum.