Key concepts of Ethos
Introduction
Ethos is a wonderfully flexible operating system, however if you've come from another brand it may seem a little strange at first - even though it's quite simple. My aim with this article is to explain how Ethos works, and to give you the knowledge needed to design your own setups from scratch. So let's get started…
Overview
Central to Ethos, as in other R/C operating systems, is a sequence of steps repeated several times a second - that's fast enough to make your servos respond smoothly. During each cycle, Ethos reads the stick positions and converts them into channel commands. These are then sent to the RF module for transmission.
The graphic below shows the main processes:
There are two key processes going on:
- The Mixers layer reads the stick positions and applies any mixing. This layer is where you define the control logic.
- The Outputs stage is where adjustments are made to servo centre and limits. This layer is where you account for linkage geometry.
The ability to consider control logic and geometry separately is one of the great strengths of Ethos. Don't worry if this doesn't make much sense yet - it will 'click' when you start to program your models.
Channels
Ethos provides 64 general purpose channels. All channels may be programmed the same way, however only the lower ones are sent to the RF module for transmission. When you create a new model using the wizard, Ethos assigns the lower numbered channels to the servos, ESC etc.
Channels which are not transmitted (so-called 'high' channels) can be used to carry out secondary mixing tasks, with the results employed in other channels (how this is done is beyond the scope of this introduction).
Introduction to mixers
Ethos employs a simple mixing model. All mixers follow a simple convention:
A mix has exactly one (1) input, and one or more (>=1) outputs.
Ethos provides a number of dedicated mixers like Elevators, Ailerons, Butterfly. For ultimate flexibility, there is a powerful Free mix which can be used to build setups in the style of OpenTX.
Mixer inputs
The input of a mix is normally a stick, slider or knob. These are termed sources. Each source has a unique identifier, for example:
- Elevator = elevator stick
- SA = switch 'SA'
- Slider right = right slider
Each source carries a value between -100 and 100 according to its position:
- Stick centre = 0%
- Stick half down/right = +50%
- Stick full back/left = -100%
- Switch (e.g. SA) up position = -100%
- Switch down = +100%
- Switch centre = 0%
There are also a group of 'special' sources, the most commonly used being MIN and MAX for emulating stick limits:
- MIN = −100%
- MAX = +100%
Choosing a source
With some mixers, for example the Ailerons, Rudders, and Elevators mixers, the source is predefined and cannot be changed.
With other mixers, like the Butterfly mix, you choose the source. So you could use a slider, a switch or the throttle stick or any other suitable control.
A source may be used in multiple mixers simultaneously. For example, the aileron stick is a source which is common to the Ailerons mixer, and the Ail=>Flap mix. Both mixes may be active simultaneously.
For more info, see the mixers page on this site.
Mixer outputs
As we've seen, a mixer can drive one or more outputs. An output is always associated with a numbered channel.
With some mixers you can specify the number of outputs. For example on a flying wing, you would use the Elevators mix for pitch control. You would specify two outputs, one for each elevon channel.
A channel may be driven by more than one mix simultaneously. For example, a flap channel may be driven by a Camber mix, and an Ail=>Flap mix. Each mix makes an additive contribution to its outputs.
Output values
While input values represent stick positions, output values represent channel positions, as a percentage of available travel. So 0% represents the centre position, -100% represents one end point, and +100% is the other end point, for that channel. We'll see later how these quantities are mapped to PWM values representing actual servo positions.
How trims are handled
For the primary mixers (Ailerons, Elevators and Rudders mixers), the trims are included in the input. For all other mixers, trim values are not included included in the input - even if the source is an aileron, rudder etc. stick.
A trim can itself be a source of a mix, just like a stick. This offers some interesting possibilities. For example, if your setup is not using a particular primary mix, you can repurpose its trim to control something else.
Mixer processing
So far we've considered a mixer as a black box, with an input and one or more outputs. In this section we'll take a quick peek at what goes on inside.
In the simplest case, the mixer output value is calculated from the source according to weight and offset parameters as follows:
Separate weights can be specified for up and down.
Other parameters include 'slow' and 'curve'. I won't go into these in detail here, except to say that the order of processing is Slow, Curve, Weight and Offset.
Mixer viewing options
By default, the mixer list shows mixers in the order in which they were inserted.
However, Ethos also allows you to view the mixer stack of a channel (the collection of mixers affecting that channel). So in the following screenshot, you can see all the free mixers affecting CH1:Creating your own mixers
Often you'll want to extend the functionality by adding extra mixes. As an example, consider a knife edge mix. The purpose of such a mix is to counteract the roll effect generated by the rudder. So, the input is the rudder stick, and the outputs are the aileron channels. You can either use the predefined Rud=>Ail mix, or you could create a free mix as follows:
Activating and inhibiting mixers
Filters are options which determine whether a mixer is active or inactive. If a mixer is inactive, it is ignored. If a mixer is active, it's shown highlighted.
Ethos offers two types of filter: active condition, and flight modes:
Active condition is a general purpose filter. For the mix to be active, the condition specified in Active condition must be satisfied. Use Active condition if you want to use a switch (physical or logical). The default is 'always on' in other words no filter is applied.
If you want to activate a mix in one or more flight modes only, then use the Flight modes filter. This is simply a list of flight modes which you select by ticking. The currently active flight mode must be in the list for the mix to be active. By default, all flight modes are included in the list.
That concludes our introduction to mixers. For details about the individual mixers, please see the Mixers Reference page.
How mixer values are aggregated
In this section, I'll explain how channel commands are calculated from the mixer values. Central to this process is the mixer list:
OK, so get ready because we're going to drill down into the detail!
At the start of each processing cycle, Ethos resets all channel values to zero. Next, Ethos steps through the mixer list, starting at the top. For each mix, the output(s) are calculated and added to the corresponding channel. When all the mixers have been processed, each channel value will be the aggregate of all its contributing mixes.
If a channel has no contributing mixers, it will have a value of zero corresponding to nominal centre.
Outputs layer
Once the channel values have been calculated, they're passed to the Outputs layer.
The job of the Outputs layer is to map your 'ideal' mixer design to the real world of wonky linkages and restricted movement: it's where you set the operating limits of your servos, and compensate for differences between the left and right geometry.
Technically, the Outputs layer performs two main tasks: first it clips the channel values so they lie between +/-100%. Second, it converts the results to PWM values representing actual servo deflections. Let's look at each process.
Channel clipping
If a channel is driven by more than one mixer, it's possible that aggressive stick movements would cause the aggregated mixer value to exceed nominal limits of +/-100%. A common example is a V-tail setup, where each V-tail channel is driven by both rudder and elevator controls.
To prevent channel values exceeding safe limits, Ethos clips (limits) them so that they lie between −100% and +100%. A channel which is clipped in this way is 'saturated'. When saturation occurs, the servo will stop dead. This may or may not be a problem depending on how you use the controls.
If saturation is a problem, it can be mitigated or eliminated by reducing the weight of the constituent mixers. For example, with a V-tail setup, reduce the weight of the elevator and rudder mixes so that their sum is ≤100%.
By now, you're probably asking: what do these % channel values actually mean? They are in effect the percentage of available movement on that channel. In the next section, we'll see how to define that range by mapping channel values to PWM commands.
Mapping of channel values to PWM commands
In the final step, the (clipped) channel values are mapped to PWM values representing actual servo deflections.
This is where your mixer logic hits the real world of servos and linkages!
The mapping is defined by Min, Max, Subtrim and Direction. Together these define a three-point curve.
- Min defines the PWM value corresponding to an incoming channel value of −100%.
- Max defines the PWM value corresponding to an incoming channel value of +100%.
- Subtrim defines the PWM value corresponding to an incoming channel value of zero.
- Direction sets normal/reversed output.
Since the channel values have been clipped to +/−100%, Min and Max also represent servo limits.
PWM units
Although PWM values are normally shown in μs (microseconds), they are entered as percentages of standard servo travel. The relationship between the units is as follows:
- −150% = 732 μs
- −100% = 988 μs
- 0% = 1500 μs
- 100% = 2012 μs
- 150% = 2268 μs
In practice, you don't need to worry too much about their values, as you'll make the adjustments visually.
The outputs monitor
The outputs monitor screen is a useful aid for debugging the mixers and outputs. Each channel is displayed with an orange and a green bar.
- Green bar. This is the aggregated mixer value from the Mixers layer. This is useful for checking the mixer logic.
- Orange bar. This represents the final PWM value after Outputs processing. The microseconds are shown above and right of the bar. Use it to check how far your servos are being driven.
Mixer functions (advanced topic!)
That's all the main items covered... but here's a little extra before we finish. It's about mixer functions and it's quite advanced; you only need to read this if you intend using free mixes. Here goes …
Each mix has a function associated, for updating the channel values during the main processing loop. For all mixers except Freemix, the only function available is add, and cannot be changed (in fact the option is hidden). Since addition is not order-sensitive, you can position your mixers at any convenient position in the mixer list.
Things are more interesting with mixers of type 'FreeMix'. In addition to the add function, these mixers also offer replace, multiply and lock — and the mixer order is significant for these. Here's how the functions work:
- Add: the mixer outputs are added to the channel values.
- Multiply: the channel values are multiplied by the mixer outputs, and the results becomes the new channel values.
- Replace: the channel values are replaced by the mixer outputs.
- Lock: same as 'replace, except that subsequent mixes affecting the outputs are ignored.
Here's a rather artificial example for illustration only: a setup with four free mixes and various functions. The inputs are not important in this example, we're only interested in the outputs:
Mix_1: Function=Add, Out_1=>(CH1, CH2)
Mix_2: Function=Multiply, Out_2=>(CH2, CH3)
Mix_3: Function=Replace, Out_3=>(CH3)
Mix_4: Function=Add, Out_4=>(CH3)
Let's see what happens to the channel totals as Ethos steps through the mixer list:
Step | CH1 | CH2 | CH3 | Notes |
[Initial] | 0 | 0 | 0 | Ethos initialises channels to zero |
Mix_1 | Out_1 | Out_1 | 0 | Mix_1 output is added to CH1, CH2. |
Mix_2 | Out_1 | Out_1*Out_2 | 0*Out_2 = 0 | Mix_2 output multiplies previous CH2, CH3 |
Mix_3 | Out_1 | Out_1*Out_2 | Out_3 | Mix_3 output replaces previous CH3 |
Mix_4 | Out_1 | Out_1*Out_2 | Out_3+Out_4 | Mix_4 output is added to previous CH3 |
Uses for Multiply and Replace
A full treatment is beyond the scope of this article, but in a nutshell:
- Multiply may be used to implement adjustable mixes, where the target mix is multiplied by the adjuster mix.
- Replace is handy for the motor channel, where you may have an idle mix (source = MIN), overridden by a throttle mix when the motor is armed.
Summary
Okay, so let's summarise the processing during each cycle.
- Inputs (sticks, knobs, sliders etc.) are read.
- Channels are initialised to zero (corresponding to centre).
- The mixers are processed, and their outputs added to the corresponding channel.
- The channel values are passed to the Outputs stage where they are clipped, then mapped to PWM values according to Min/Max/Subtrim.
- The PWM values are passed to the RF module for transmission.