⇐ Back to Flight Modes

Alternative Mode Switch Configurations

In old revisions of firmware and documentation you may find old mode names: SEATBELT (changed to ALTCTL), EASY (changed to POSCTL), MISSION (changed to AUTO). And old switch names: ASSISTED (changed to POSCTL). Modes were renamed in May 2014 to be more clear and consistent with other autopilot systems. Please report about any documentation issues.

PX4 supports customization of the mode switches to enable various alternative configurations. This is accomplished using the following parameters:

switch channel mapping parameters:

  1. RC_MAP_MODE_SW - mode switch channel
  2. RC_MAP_POSCTL_SW - posctl switch channel
  3. RC_MAP_RETURN_SW - return to launch switch channel
  4. RC_MAP_LOITER_SW - loiter switch channel

switch threshold parameters:

  1. RC_ASSIST_TH (default = 0.25)
  2. RC_AUTO_TH (default = 0.75)
  3. RC_POSCTL_TH (default = 0.5)
  4. RC_RETURN_TH (default = 0.5)
  5. RC_LOITER_TH (default = 0.5)

Each switch channel is normalized to a range from 0 to 1 and compared to the thresholds provided by these parameters to determine the flight mode. Default values correspond to the standard 3-2-2-2 switch configuration (one 3-position switch and three 2-position switches). In the default configuration, the 3pos (main mode switch) is configured to select AUTO if the associated channel is above 75% of full range, ASSISTED if above 25%, else MANUAL. Similarly each of the 2pos switches are set to select their associated functions when they are above the default 50% threshold.

The following flowchart illustrates switch priority:

FIXME: the RTL switch now has priority above every other switch.

To configure alternative configurations, change the channel mapping and desired thresholds appropriately. Negative values may be entered for switch thresholds. If a threshold is negative, then that particular mode will be selected when the associated channel is below the threshold rather than above it.

PWM values

To set a mode, the channel value must be higher than the threshold - but lower than the next threshold. Choose one in the middle between two thresholds.

The following table is an example for a single-channel configuration (see further down). In the column ms Channel you see required radio output to trigger the threshold.

ParameterValuems ChannelMode
1100msManual
RC_ASSIST_TH 0.251300AltCtl
RC_POSCTL_TH 0.3751400PosCtl
RC_AUTO_TH 0.51600Auto Mission
RC_LOITER_TH 0.6251700Loiter
RC_RETURN_TH 0.751800Return

Because the PWM values will be normalized, min. and max. values for the channel are relevant too.

ParameterValue
RCX_MAX2000
RCX_MIN1000

“X” denotes the channel number. Min/max might vary for your radio.

If you can configure your radio either in ms or %:

  1. set the thresholds in PX4 (well distributed from 0 to 1)
  2. program your radio to output the defined channel values (mixing)

If you can not directly configure your radio:

  1. read the PWM values from all switch-positions (e.g. over QGroundControl)
  2. define the needed thresholds (remark, below the lowest threshold is manual mode)

General example configurations for various RCs

Example 1: Dual-channel, 3-3 configuration

One handy configuration is to use two 3 position switches. To set this up, map the main mode switch to one 3pos channel and all the other switches to the other 3pos channel. If, for example, the main mode switch is on channel 5 and you have a second 3 position switch on channel 6, the following will work:

RC_MAP_MODE_SW 5
RC_MAP_POSCTL_SW 6
RC_MAP_LOITER_SW 6
RC_ASSIST_TH 0.25
RC_AUTO_TH 0.75
RC_POSCTL_TH 0.75
RC_LOITER_TH 0.25

This will result in the following mapping:

  • SW1:1 MANUAL
  • SW1:2 ASSISTED
    • SW2:1 ALTCTL
    • SW2:2 ALTCTL
    • SW2:3 POSCTL
  • SW1:3 AUTO
    • SW2:1 MISSION
    • SW2:2 LOITER

RTL cannot be included in a 3-3 dual-channel configuration. In that case it needs to be on a different channel, for example:

RC_MAP_RETURN_SW 7
RC_RETURN_TH 0.75

Example 2: Single-channel configuration

There are different reasons to setup single channel mode switching, and there are different control setups that can result in a single channel control, for example:

  • 3-3 switches but you only want to use one channel
    • mixing required
  • rotary switch
  • 6 position switch
  • custom control hardware
    • mixing required

For some of these configurations your radio needs to be able to do channel mixing. See this this page for an example on OpenTX RC (Turnigy 9x, …).

The thresholds need to trigger the modes in the correct order, as shown in the examples.

3-3 configuration

RC_MAP_MODE_SW 5
RC_MAP_POSCTL_SW 5
RC_MAP_RETURN_SW 5
RC_MAP_LOITER_SW 5
RC_ASSIST_TH 0.33
RC_AUTO_TH 0.66
RC_POSCTL_TH 0.55
RC_LOITER_TH 0.77
RC_RETURN_TH 0.88

This will result in the following mapping (same as dual channel 3-pos solution):

  • SW1:1 MANUAL
  • SW1:2 ASSISTED
    • SW2:1 ALTCTL
    • SW2:2 ALTCTL
    • SW2:3 POSCTL
  • SW1:3 AUTO
    • SW2:1 MISSION
    • SW2:2 LOITER
    • SW2:3 RETURN

Rotary configuration

RC_MAP_MODE_SW 5
RC_MAP_POSCTL_SW 5
RC_MAP_RETURN_SW 5
RC_MAP_LOITER_SW 5
RC_ASSIST_TH 0.25
RC_AUTO_TH 0.5
RC_POSCTL_TH 0.375
RC_LOITER_TH 0.625
RC_RETURN_TH 0.75

This will result in the following mapping:

  • SW1:1 MANUAL
  • SW1:2 ALTCTL
  • SW1:3 POSCTL
  • SW1:4 MISSION
  • SW1:5 LOITER
  • SW1:6 RETURN
Translations of this page:


Quick Links

QR Code: URL of current page