Link Search Menu Expand Document

Using VOXL ESCs with PX4

Table of contents

  1. Overview
  2. Requirements
  3. Video Tutorial
  4. Hardware Connections
  5. PX4 Setup
    1. Enable UART ESC
      1. TELEM3
    2. PX4 Params
    3. RGB LED Codes
  6. Debugging Tips
    1. Setting Up PX4 Motor ID to UART_ESC_MOTORX
  7. Development

Overview

The VOXL 2, VOXL Flight and Flight Core systems provides the ability to easily and quickly interface with UART ESCs. The following guide provides you the necessary details on doing so.

Requirements

NOTE! This feature is currently in developer preview and requires you to load the PX4 FW from a branch

Video Tutorial

For those of you who prefer videos, we have a video tutorial here that covers the software configuration and usage. Note, you’ll want to look at the hardware connections below as that part is skipped in this video.

TL;DR

Hardware Connections

The guide here describes the connectivity: VOXL ESC v2 Manual

PX4 Setup

Enable UART ESC

To enable the UART ESC feature, set the UART_ESC_CONFIG parameter to a value of 1 and power cycle the vehicle.

You can use QGroundControl’s Parameter feature to query and modify the UART_ESC params.

The remainder of the settings can be left as default if you followed the hardware connections described in the previous section.

TELEM3

The UART ESC uses /dev/ttyS1, same as TELEM3. On bootup, if any MAVLink instance is configured to use TELEM3, it will be disabled via boards/modalai/fc-v1/init/rc.board_defaults.

PX4 Params

The following are the PX4 parameters that are used by the modalai_esc driver:

NameDescriptionMin > Max (Incr.)DefaultUnits
UART_ESC_BAUDBaud rate between FlightController and ESC(1)250000Bits/sec
UART_ESC_CONFIGUART ESC Configuration
Values:
- 0: Disabled
- 1: ModalAI ESC

Reboot Required
 0 (Disabled) 
UART_ESC_MOTOR1ESC CH0 (Motor 1) mapping to PX4 motor index. Negative value reverses spin.-4 > 4
(1)
3 
UART_ESC_MOTOR2ESC CH1 (Motor 2) mapping to PX4 motor index. Negative value reverses spin.-4 > 4
(1)
2 
UART_ESC_MOTOR3ESC CH2 (Motor 3) mapping to PX4 motor index. Negative value reverses spin.-4 > 4
(1)
4 
UART_ESC_MOTOR4ESC CH3 (Motor 4) mapping to PX4 motor index. Negative value reverses spin.-4 > 4
(1)
1 
UART_ESC_RPM_MAXMaximum RPM, used by actuator output to determine thrust fullscale.(1)15000RPM
UART_ESC_RPM_MINMinimum RPM, used by actuator output to determine thrust fullscale.(1)5500RPM

The following are use to control “Turtle Mode” (flip over after crash, which is currently in test):

NameDescriptionMin > Max (Incr.)DefaultUnits
UART_ESC_MODEUART ESC Mode:
Values:
- 0: None
- 1: Turtle Mode enabled via AUX1
- 2: Turtle Mode enabled via AUX2
Reboot Required
0 > 20 
UART_ESC_T_PERCTurtle Mode Crash Flip Motor Percent (percentage of motor range to use in flip over mode)1 > 100
(1)
90Percentage (as int)
UART_ESC_T_DEADPercentage of fullscale RPM that is in a deadband when in Turtle mode1 > 100
(1)
20Percentage (as int)
UART_ESC_T_MINFMinimum stick percentage in the dead zone needed to move0.0 > 1.00
(0.01)
0.15Percentage (as float)
UART_ESC_T_EXPOFlip power expo value1 > 100
(1)
35Percentage (as int)
UART_ESC_COSPHIValue used to specify the sensitivity for isolating a single motor for spinning0.000 > 1.000
(0.001)
0.990Percentage (as float)

RGB LED Codes

This is currently a work in progress. The standard LED codes should output to the all the LED channels in a similar way as other PX4 RGB LED peripherals with the exception that the breathing pattern is replaced by a fast blink.

Debugging Tips

Setting Up PX4 Motor ID to UART_ESC_MOTORX

Say you have the following:

M0049 silkscreen ID0 channel –> wired to a motor at PX4 Motor ID 2 M0049 silkscreen ID1 channel –> wired to a motor at PX4 Motor ID 3 M0049 silkscreen ID2 channel –> wired to a motor at PX4 Motor ID 1 M0049 silkscreen ID3 channel –> wired to a motor at PX4 Motor ID 4

Then you would have the following params set:

UART_ESC_MOTOR1 = 2 UART_ESC_MOTOR2 = 3 UART_ESC_MOTOR3 = 1 UART_ESC_MOTOR4 = 4

And you can test by spinning, for example, 1000 RPM for 64 command cycles:

# spin PX4 motor #1
modalai_esc -i 1 -r 1000 -n 64 rpm

# spin PX4 motor #2
modalai_esc -i 2 -r 1000 -n 64 rpm

# spin PX4 motor #3
modalai_esc -i 4 -r 1000 -n 64 rpm

# spin PX4 motor #4

Development

The PX4 Driver source code can be found on github