Skip to content

Commit

Permalink
Make UAVCAN user-facing (PX4#1077)
Browse files Browse the repository at this point in the history
  • Loading branch information
hamishwillee authored Mar 25, 2021
1 parent ea28b16 commit 17a4c34
Show file tree
Hide file tree
Showing 20 changed files with 533 additions and 466 deletions.
Binary file modified assets/peripherals/esc_qgc/qgc_uavcan_settings.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/peripherals/esc_usavcan_zubax_sadulli/sadulli_top.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/uavcan/uavcan_qgc_setup.png
Binary file not shown.
14 changes: 7 additions & 7 deletions en/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,10 @@
* [FrSky Telemetry](peripherals/frsky_telemetry.md)
* [Power Modules](power_module/README.md)
* [CUAV HV pm](power_module/cuav_hv_pm.md)
* [CUAV CAN PMU](power_module/cuav_can_pmu.md)
* [CUAV CAN PMU](uavcan/cuav_can_pmu.md)
* [Holybro PM07 (Pixhawk 4 PM)](power_module/holybro_pm07_pixhawk4_power_module.md)
* [Holybro PM06 (Micro Power Module)](power_module/holybro_pm06_pixhawk4mini_power_module.md)
* [Pomegranate Systems Power Module](power_module/pomegranate_systems_pm.md)
* [Pomegranate Systems Power Module](uavcan/pomegranate_systems_pm.md)
* [Distance Sensors \(Rangefinders\)](sensor/rangefinders.md)
* [Lightware SFxx Lidar](sensor/sfxx_lidar.md)
* [Ainstein US-D1 Standard Radar Altimeter](sensor/ulanding_radar.md)
Expand All @@ -242,7 +242,7 @@
* [Lidar-Lite](sensor/lidar_lite.md)
* [TeraRanger](sensor/teraranger.md)
* [Lanbao PSK-CM8JL65-CC5](sensor/cm8jl65_ir_distance_sensor.md)
* [Avionics Anonymous Laser Altimeter UAVCAN Interface](sensor/avanon_laser_interface.md)
* [Avionics Anonymous Laser Altimeter UAVCAN Interface](uavcan/avanon_laser_interface.md)
* [Tachometers (Revolution Counters)](sensor/tachometers.md)
* [ThunderFly TFRPM01 Tachometer Sensor](sensor/thunderfly_tachometer.md)
* [Airspeed Sensors](sensor/airspeed.md)
Expand All @@ -251,13 +251,15 @@
* [PMW3901](sensor/pmw3901.md)
* [ESCs & Motors](peripherals/esc_motors.md)
* [PWM ESCs and Servos](peripherals/pwm_escs_and_servo.md)
* [UAVCAN ESCs](uavcan/escs.md)
* [DShot ESCs](peripherals/dshot.md)
* [UAVCAN ESCs](peripherals/uavcan_escs.md)
* [Camera](peripherals/camera.md)
* [Parachute](peripherals/parachute.md)
* [ADSB/FLARM (Traffic Avoidance)](peripherals/adsb_flarm.md)
* [Smart Batteries](smart_batteries/README.md)
* [Rotoye Batmon Battery Smartification Kit](smart_batteries/rotoye_batmon.md)
* [UAVCAN Peripherals](uavcan/README.md)
* [UAVCAN Configuration](uavcan/node_enumeration.md)
* [Companion Computer Peripherals](peripherals/companion_computer_peripherals.md)
* [Development](development/development.md)
* [Getting Started](dev_setup/getting_started.md)
Expand Down Expand Up @@ -311,11 +313,9 @@
* [SiK Radio](data_links/sik_radio.md)
* [Sensor and Actuator I/O](sensor_bus/README.md)
* [I2C Bus](sensor_bus/i2c.md)
* [UAVCAN Bus](uavcan/README.md)
* [UAVCAN Bus](uavcan/developer.md)
* [UAVCAN Bootloader](uavcan/bootloader_installation.md)
* [UAVCAN Firmware Upgrades](uavcan/node_firmware.md)
* [UAVCAN Configuration](uavcan/node_enumeration.md)
* [UAVCAN Various Notes](uavcan/notes.md)
* [UART/Serial Ports](uart/README.md)
* [Port-Configurable Serial Drivers](uart/user_configurable_serial_driver.md)
* [RTK GPS (Integration)](advanced/rtk_gps.md)
Expand Down
186 changes: 1 addition & 185 deletions en/peripherals/uavcan_escs.md
Original file line number Diff line number Diff line change
@@ -1,185 +1 @@
# UAVCAN ESCs (Motor Controllers)

PX4 supports the [UAVCAN](https://uavcan.org/) bus for connecting peripherals, including ESCs, GPS modules, various types of sensors, etc. However PX4 currently does not support UAVCAN Servos.

UAVCAN ESCs have a number of advantages over [PWM ESCs](../peripherals/pwm_escs_and_servo.md):
- 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 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](#sapog) firmware; an advanced open source sensorless PMSM/BLDC motor controller firmware designed for use in propulsion systems of electric unmanned vehicles.
- [Zubax Orel 20](https://zubax.com/products/orel_20)
- [Holybro Kotleta20](https://shop.holybro.com/kotleta20_p1156.html)
- [Mitochondrik](https://zubax.com/products/mitochondrik) - integrated sensorless PMSM/BLDC motor controller chip (used in ESCs and integrated drives)
- [Zubax Sadulli Integrated Drive](https://shop.zubax.com/collections/integrated-drives/products/sadulli-integrated-drive-open-hardware-reference-design-for-mitochondrik?variant=27740841181283)
- [Myxa](https://zubax.com/products/myxa) - High-end PMSM/BLDC motor controller (FOC ESC) for light unmanned aircraft and watercraft.
- [VESC Project ESCs](https://vesc-project.com/) (see also [Benjamin Vedder's blog](http://vedder.se) - project owner)
- [OlliW’s UC4H ESC-Actuator Node](http://www.olliw.eu/2017/uavcan-for-hobbyists/#chapterescactuator)
- A number of others are [listed here](https://forum.uavcan.org/t/uavcan-esc-options/452/3?u=pavel.kirienko)

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

## Purchase

Sapog-based ESCs:
- [Zubax Orel 20](https://zubax.com/products/orel_20)

![Orel20 - Top](../../assets/peripherals/esc_uavcan_zubax_orel20/orel20_top.jpg)

- [Holybro Kotleta20](https://shop.holybro.com/kotleta20_p1156.html)

![Kotleta20 - Top](../../assets/peripherals/esc_uavcan_holybro_kotleta20/kotleta20_top.jpg)
![Kotleta20 - Bottom](../../assets/peripherals/esc_uavcan_holybro_kotleta20/kotleta20_bottom.jpg)

Mitochondrik based drives and ESC:
- [Zubax Sadulli Integrated Drive](https://shop.zubax.com/collections/integrated-drives/products/sadulli-integrated-drive-open-hardware-reference-design-for-mitochondrik?variant=27740841181283)

![Sadulli - Top](../../assets/peripherals/esc_usavcan_zubax_sadulli/sadulli_top.jpg)

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

<span id="connecting"></span>
## 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.

:::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 about proper bus connections see [UAVCAN Device Interconnection](https://kb.zubax.com/display/MAINKB/UAVCAN+device+interconnection) (Zubax KB).


## 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*.
1. Navigate to the **Vehicle Setup > Parameters** screen
> [Parameters](../advanced_config/parameters.md) explains how to find and set parameters.
1. Set [UAVCAN_ENABLE](../advanced_config/parameter_reference.md#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):
1. Set [UAVCAN_ESC_IDLT](../advanced_config/parameter_reference.md#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](../airframes/airframe_reference.md) 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.


<span id="sapog"></span>
### Sapog ESC setup

The following sections explain how to enumerate [Sapog-based](https://github.com/PX4/sapog#px4-sapog)-based ESCs with PX4.
The instructions should work for any Sapog-based ESC design.

<span id="sapog_esc_qgc"></span>
#### ESC Enumeration using QGroundControl

:::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:
1. Power the vehicle with a battery and connect to *QGroundControl*
1. Navigate to **Vehicle Setup > Power** in QGC.
1. Start the process of ESC auto-enumeration by pressing the **Start Assignment** button, as shown on the screenshot below.

![QGC - UAVCAN ESC auto-enumeration](../../assets/peripherals/esc_qgc/qgc_uavcan_settings.jpg)

You will hear a sound indicating that the flight controller has entered the ESC enumeration mode.
1. 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).
:::

1. 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)
@[youtube](https://www.youtube.com/watch?v=4nSa8tvpbgQ)

#### Manual ESC Enumeration using Sapog

:::tip
We recommend automated [ESC Enumeration using QGroundControl](#sapog_esc_qgc) rather than manual enumeration - it is easier and safer.
:::

You can manually configure the ESC index and direction using the [UAVCAN GUI Tool](https://uavcan.org/GUI_Tool/Overview/).
This assigns the following Sapog configuration parameters for each enumerated ESC:
- `esc_index`
- `ctl_dir`

:::note
See [Sapog reference manual](https://files.zubax.com/products/io.px4.sapog/Sapog_v2_Reference_Manual.pdf) for more information about the parameters.
:::

### Myxa ESC Setup

Motor enumeration for Myxa [Telega-based ESCs](https://zubax.com/products/telega) is usually performed using the [Kucher tool](https://files.zubax.com/products/com.zubax.kucher/) (or less "GUI-friendly" [UAVCAN GUI Tool](https://uavcan.org/GUI_Tool/Overview/)).

There is some guidance here: [Quick start guide for Myxa v0.1](https://forum.zubax.com/t/quick-start-guide-for-myxa-v0-1/911) (Zubax blog).


### VESC ESC Setup

For [VESC ESCs](https://vesc-project.com/) the preferred tool for motor enumeration is the [VESC tool](https://vesc-project.com/vesc_tool).
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](../advanced_config/parameter_reference.md#UAVCAN_BITRATE).

## Further Information

- [PX4/Sapog](https://github.com/PX4/sapog#px4-sapog) (Github)
- [Sapog v2 Reference Manual](https://files.zubax.com/products/io.px4.sapog/Sapog_v2_Reference_Manual.pdf)
- [UAVCAN Device Interconnection](https://kb.zubax.com/display/MAINKB/UAVCAN+device+interconnection) (Zubax KB)
- [Using Sapog based ESC with PX4](https://kb.zubax.com/display/MAINKB/Using+Sapog-based+ESC+with+PX4) (Zubax KB)

<Redirect to="../uavcan/escs" />
6 changes: 3 additions & 3 deletions en/power_module/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ This section provides links/information about supported power modules and power
* [CUAV HV PM](../power_module/cuav_hv_pm.md)
* [Holybro PM07 (Pixhawk 4 PM)](../power_module/holybro_pm07_pixhawk4_power_module.md)
* [Holybro PM06 (Pixhawk 4 Mini PM)](../power_module/holybro_pm06_pixhawk4mini_power_module.md)
* [UAVCAN](https://new.uavcan.org/) power modules
* [CUAV CAN PMU](../power_module/cuav_can_pmu.md)
* [Pomegranate Systems Power Module](../power_module/pomegranate_systems_pm.md)
* [UAVCAN](../uavcan/README.md) power modules
* [CUAV CAN PMU](../uavcan/cuav_can_pmu.md)
* [Pomegranate Systems Power Module](../uavcan/pomegranate_systems_pm.md)
71 changes: 1 addition & 70 deletions en/power_module/cuav_can_pmu.md
Original file line number Diff line number Diff line change
@@ -1,70 +1 @@
# CAUV CAN PMU

CAN PMU<sup>&reg;</sup> is a high-precision power module developed by CUAV<sup>&reg;</sup>.
It uses the [UAVCAN](https://new.uavcan.org/) protocol and runs the CUAV ITT compensation algorithm, which enables drones to get the battery data more accurately.

![CAN PMU](../../assets/hardware/power_module/cuav_can/can_pmu.jpg)

It is recommended for use in large commercial vehicles, but might also be used for research vehicles.

## Specifications

- **Processor:** STM32F412
- **Voltage input**: 6~62V\(2-15S\)
- **Max current:** 110A
- **Voltage accuracy:** ±0.05V
- **Current accuracy:** ±0.1A
- **Resolution:** 0.01A/V
- **Max output power:** 6000W/90S
- **Max stable power:** 5000W
- **Power port output:** 5.4V/5A
- **Protocol:** UAVCAN
- **Operating temp:** -20~+100
- **Firmware upgrade:** Supported.
* **Calibration:** Not needed.
* **Interface Type:**
- **IN/OUT:** XT90\(Cable)/Amass 8.0\(Module)
- **Power port:** 5025850670
- **CAN:** GHR-04V-S
- **Appearance:**
- **Size:** 46.5mm \* 38.5mm \* 22.5mm
- **Weight:** 76g

## Purchase

- [CUAV store](https://store.cuav.net/index.php)
- [CUAV aliexpress ](https://www.aliexpress.com/item/4000369700535.html)

## Pinouts

![CAN PMU](../../assets/hardware/power_module/cuav_can/can_pmu_pinouts_en.png)

![CAN PMU](../../assets/hardware/power_module/cuav_can/can_pmu_pinouts_en2.png)

## Connection

![CAN PMU](../../assets/hardware/power_module/cuav_can/can_pmu_connection_en.png)

The connection steps are:
* Connect the flight control CAN1/2 and the module CAN interface.
* Connect the V5 series power cable to the V5 Flight Control Power2 (if other flight controllers are connect to the Power interface) and the module Power interface.

## Enable CAN PMU

Set the following parameters in the *QGroundControl* [parameter list](../advanced_config/parameters.md) and then restart:

* `UAVCAN_ENABLE`: set to: *Sensors Automatic Config*

![qgc set](../../assets/hardware/power_module/cuav_can/qgc_set_en.png)

# Package Contents

![CAN PMU list](../../assets/hardware/power_module/cuav_can/can_pmu_list.png)

## Further Information

[CAN PMU Manual](http://manual.cuav.net/power-module/CAN-PMU.pdf)

[CAN PMU Power detection module > Enable CAN PMU > PX4 firmware](http://doc.cuav.net/power-module/can-pmu/en/) (CUAV docs)

[UAVCAN](https://new.uavcan.org/)
<Redirect to="../uavcan/cuav_can_pmu" />
56 changes: 1 addition & 55 deletions en/power_module/pomegranate_systems_pm.md
Original file line number Diff line number Diff line change
@@ -1,55 +1 @@
# Pomegranate Systems Power Module

![Module Image](../../assets/hardware/power_module/pomegranate_systems_pm/main_image.jpg)

Digital Power Module with high resolution current integration, 5V/2A supply with power monitoring, single UAVCAN v0 CANbus interface, and an RGB status LED.

Detailed setup, configuration, and troubleshooting information can be found on the [manufacturer's device home page](https://p-systems.io/product/power_module).

## Specifications

- **Input Voltage:** 6-26V \(2-6S\)
- **Max Continuous Current:**
- **Benchtop:** 40A
- **Forced Cooling:** 100A
- **Max 5V Output Current:** 2A
- **Voltage Resolution:** 0.04 ΔV
- **Current Resolution:**
- **Primary / Battery Bus:** 0.02 ΔA
- **5V bus:** 0.001 ΔA
- **CANbus Termination:** Electronic (on by default)
- **MCU:** STM32 F302K8U
- **Firmware:** [Open Source](https://bitbucket.org/p-systems/firmware/)
- **Electrical Interface:**
- **Power:** Solder pads or XT60PW (right angle, board-mounted connectors)
- **CANbus** Dual JST GH-4 (standard UAVCAN micro-connector)
- **I2C / Serial:** JST GH-5
- **5V Output:** Solder pads or CANbus / I2C connectors
- **Device Mass:**
- **Without Connectors:** 9g
- **With XT60PW Connectors:** 16g


![Dimensions](../../assets/hardware/power_module/pomegranate_systems_pm/mechanical.png)

## Configuration

1. Enable UAVCAN by setting the [UAVCAN_ENABLE](../advanced_config/parameter_reference.md#UAVCAN_ENABLE) parameter to `2` (Sensors Automatic Config) or `3`.
2. Set the following module parameters using the [Mavlink console](https://docs.qgroundcontrol.com/en/analyze_view/mavlink_console.html):
* Battery capacity in mAh: `battery_capacity_mAh`
* Battery voltage when *full*: `battery_full_V`,
* Battery voltage when *empty*: `battery_empty_V`
* Turn on current integration: `enable_current_track`
* (optional) Turn Off CANbus termination resistor :`enable_can_term`

**Example:** A Power Module with UAVCAN node id `125` connected to a `3S` LiPo with capacity of `5000mAh` can be configured with the following commands:

```
uavcan param set 125 battery_capacity_mAh 5000
uavcan param set 125 battery_full_V 12.5
uavcan param set 125 battery_empty_V 11.2
uavcan param set 125 enable_current_track 1
uavcan param save 125
```

See [device configuration page](https://p-systems.io/product/power_module/configuration) for a full list of parameters.
<Redirect to="../uavcan/pomegranate_systems_pm" />
Loading

0 comments on commit 17a4c34

Please sign in to comment.