Key concepts of Ethos
Ethos is a wonderfully flexible operating system, however if you've come from another brand like Futaba or Spektrum it may seem a little strange at first. 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…
The processing loop
Central to Ethos, as in other R/C operating systems, is the processing loop. This is a sequence of steps performed by the microprocessor, and repeated several times a second. It's so quick that your servos appear to respond perfectly smoothly!
During each cycle, Ethos reads the current stick positions converts them into servo channel commands. These are then sent to the RF module for transmission.
The graphic below shows the main processes during each cycle:
There are two key processes:
- The Mixers layer reads the stick positions, applies any mixing, and calculates the commands for each channel. This layer is where you define the control logic.
- The Outputs stage is where channel values are converted to PWM values representing actual servo deflections. 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.
Okay, so now let's dive a little deeper.
In Ethos, your transmitter controls – the sticks, knobs, sliders etc. – are known as sources. Each source has:
- an identifier like 'rudder', 'elevator' or 'pot1'.
- a value between −100% and +100% representing the displacement from the centre position.
Sources are used in several areas, for example mixers and logical switches.
Ethos provides 64 general purpose channels. As regards programming, all channels have equal status. However, only the lower ones are sent to the RF module for transmission (the actual number of channels transmitted depends on the RF protocol). When creating a model using the New Model wizard, Ethos assigns the servo channels appropriately.
Unassigned (high numbered) channels may be used for other purposes - typically to add features which cannot be implemented in the lower channels.
Each output channel carries a percentage value. The interpretation depends on where we are in the processing:
- After the Mixers, each channel carries a value between −100% and +100% representing the effect of all the mixers affecting that channel.
- After the Outputs, each cannel carries a PWM values representing an actual servo position.
The Outputs monitor
The outputs monitor screen is a useful aid for debugging the mixers and outputs. All 64 channels are displayed, along with an orange and green bar.
- Mixer value (green bar). This is the aggregated mixer value from the Mixers layer. This is useful for checking the mixer logic.
- Channel value (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. To the top right of each channel is the actual PM value in microseconds.
You can think of the Outputs layer as the glue between your 'ideal' mixer design, and the real model complete with building inaccuracies and wonky linkages.
Mixers are the beating heart of your setup. They are the sandwich between the sources (sticks etc.) and the outputs, and they define the control logic in your setup.
Various mixers are available, however they are all have one thing in common:
Each mix has exactly one (1) source (stick etc.), and one or more (>=1) outputs.
The source of a mixer is generally a control stick, pot etc. .
For the primary mixers (Ailerons, Elevators and Rudders), the source is the same as the mixer name. Example: the source of the Ailerons mix is the aileron stick.
For other mixers (Butterfly, Camber etc.), you choose the source yourself - typically it would be the throttle stick, a slider or a switch. For more info, see the mixers page on this site.
The same source may do duty in several mixers. For example, on F3X gliders, the aileron stick will typically drive three mixers: Ailerons, Ail=>Flaps, and Ail=>Rudder.
Each mix has one or more outputs associated. An output is simply a channel (the terms output and channel are often used interchangeably). The number of outputs may be fixed or specified by the user, depending on the mixer.
Example for Elevators mix: for models with a single elevator servo, the Elevators mix will have a single output. By contrast, for flying wings and models with V-tails, the Elevators mix will be assigned two outputs, one for each surface.
Below shows a mix with two outputs:
The purpose of a mixer is to convert the position of a stick, pot etc. into an output value, representing a contribution to one or more output channels
The output value is calculated from the source according to weight and offset parameters as follows:
Separate weights can be specified for up and down. A curve may also be specified, in which case it's applied before weight and offset.
Changing the mixer outputs
When a model is created with the wizard, Ethos sets up the mixers with appropriate outputs. However you can change both of these, by going into the mixer editor. For example, you might want to change the channel numbers to match an existing servo numbering scheme.
A channel may be driven by more then one mixer, in fact this is common with sailplanes. For example, a flap channel might be driven by three mixers: an Aileron=>Flap, Camber and Butterfly mix. Each mix makes an additive contribution to each of its outputs.
Creating your own mixers
Often you'll want to extend the functionality by adding extra mixes. The first step is to identify the input source and destination channels. Next, look for a pre-built mixer which uses these; if none is available, define a free mix.
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:
Filters are options which determine whether a mixer is active or inactive. Mixers which are inactive are ignored, in other words they do not contribute to their outputs.
Ethos offers two types of filter: active condition, and flight modes:
Active condition is typically a switch (physical or logical). For the mix to be active, the active condition must be satisfied. The default is 'always on'.
The Flight modes filter is simply a list of flight modes. 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.
Both the active condition and flight modes filters must be satisfied for the mix to be active.
That concludes our introduction to mixers. For details about the individual mixers, please see the Mixers Reference page.
How channel values are calculated
In this section, I'll explain how channel values are calculated. 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 sets all channels to zero. Next, Ethos steps through the mixer list, starting at the top. For each mix, the outputs are calculated and added to the corresponding channel values. 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 the centre position.
Once the mixer values have been aggregated, the result is passed to the Outputs layer. This layer performs two tasks: first it clips the incoming aggregated mixer values so they lie between +/-100%. Finally, it converts the results to PWM values representing actual servo deflections. Let's look at each process.
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%. If one or other limit is reached, the servo will stop dead leading to deadband at the stick. You can avoid this condition 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? You can think of them as percentage of available movement on that channel.
Mapping of channel values to PWM commands
Next, 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.
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.
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:
|[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.
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.