This article demonstrates how to integrate Sapog-based ESC into a UAV controlled by ArduPilot. The concepts explained here are applicable to any Sapog-based ESC design, such as Zubax Orel 20.

Documentation may be outdated

At the time of writing this, ArduPilot was undergoing a major redesign of its CAN bus subsystem. This means that the instructions provided here may have become outdated. Please check the ArduPilot documentation for updated instructions before reading this further.

Connecting

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 UAVCAN device interconnection page.

Configuring Sapog

Configuring ESC parameters using the UAVCAN GUI Tool

Sapog can be configured either via CLI or via UAVCAN.

Via UAVCAN

This method requires that you have a CAN adapter connected to your computer.

Install the UAVCAN GUI Tool on your PC, then perform the following steps:

  1. Launch the application and connect to the correct CAN bus interface. Configure the bit rate at 1 Mbps, unless you have other specific requirements.
  2. Enable the dynamic node ID allocation server in the GUI Tool.
  3. Wait for the ESC nodes to become online.
  4. For each ESC node:
    1. Set the configuration parameter uavcan_node_id to a unique integer value for each ESC, except 1 (the node ID 1 is used by the autopilot).
    2. Set the configuration parameter esc_index to a correct value according to the geometry of your airframe.
    3. If necessary, change the direction of rotation of the ESC by setting the parameter ctl_dir.
    4. Reboot the ESC by sending a reboot request from the GUI Tool.
  5. Now you can verify the correct operation of each ESC by controlling them directly from the GUI Tool. If you chose to do so, ensure that the autpilot is not issuing any ESC commands.

Via the serial CLI

If you prefer CLI, you will need a Dronecode Probe to connect to the debug port of your ESC. Read the article about the serial command line interface (Serial CLI) for more information on how to use it.

Once connected, configure the same parameters as if you were using the GUI tool via the CLI.

Configuring the flight controller

Set the configuration parameter BRD_CAN_ENABLE to the value of 3, then reboot the flight controller (at the time of writing this, the documentation of ArduPilot wrongly stated that the only valid values of BRD_CAN_ENABLE are 0 and 1; this is not true).

Checking the configuration

This part is entirely optional. You may use the UAVCAN GUI Tool to check what ESC setpoints are being sent to the bus by the flight controller.

See also