Controls mixer

Nodes: nav sim com ifc | Module: ports.controls | Parameters: ports

This module is used to mix different mandala values to control channels.

If several controls are assigned to the same channel, the output of channel is the sum of all outputs.

The module provides array of controls. Each control, when enabled, does the following:

  • multiplies input variable value by mult factor;
  • applies diff multiplier;
  • limits slew rate according to speed value;
  • adds result to the assigned channel value;

After processing all enabled controls, the module processes the control channels:

  • adds ch_zero bias to the channel value;
  • limits value by ch_min and ch_max;
  • publishes value to underlying subscribers, like gpio or protocols.

The gpio module can output physical signals for servo drives based on channel values. The channel number corresponds to gpio number. The corresponding gpio pin must have bind property not set.

Configuration examples

  • differential ailerons: diff=-1.2 on the left and diff=1.2 on the right aileron control;
  • flaps: speed=0.8, ch_min=0, ch_max=100, ch_zero=0;
  • throttle: mult=2, ch_min=-100, ch_max=100, ch_zero=-100:

Since most of the variables related to controls have values from -1 to +1 (or 0 to 1), the mult parameter must be adjusted to consider servo mechanical limits set in ch_min and ch_max to span the whole variable value range to the limited output channel range. F.ex., when you have ch_min=0 and ch_max=20 mechanical limits for throttle, which has the range of 0 to 1, the mult has to be set to 0.2 to have fill span of input value in effect.

Configuration parameters

  • ports
    • controls

      Servo controls

      • bind Mandala variable binding bind

        Value of the variable is used as input value for the control.

      • mult Value multiplier real

        Input value is multiplied by this factor if this setting is not zero. F.ex, for servo reverse set this factor to negative value.

      • diff Differential multiplier real

        Allows to apply different multiplier for positive and negative input values. Can be used for differential ailerons implementation.

        • diff>0: when input value is positive (>0), then it is multiplied by this factor;
        • diff<0: when input value is negative (<0), then it is multiplied by this factor;
      • speed Slew rate limit real

        The slew rate limit for the control, i.e. the value of 0.1 will result in 0.1/s rate of change limit. Can be used to slow down servo motion.

      • ch Channel assignment byte

        The output of the control will be added (mixed) to the specified output channel number. When this value is zero, the control is disabled.

      • ch_min Channel minimum value real [%]

        Output channel value is limited by this number (divided by 100). Used to set servo mechanical limit.

      • ch_max Channel maximum value real [%]

        Output channel value is limited by this number (divided by 100). Used to set servo mechanical limit.

      • ch_zero Channel zero bias real [%]

        Output channel value is adjusted by this number (divided by 100). Used to set servo zero position.