Sequencer
Sequencer steps through a table of values on a timer.6 minute read
Sequencer steps through a table of values on a timer. Each output channel has
its own row of values and they all advance together, holding each column for
the time you give it. Use it for a pattern — a sequence of beeps on a speaker,
a blink pattern for an indicator light, a fixed series of setpoints.
flowchart LR
i1(["input — true runs the sequence"]) --> B["Sequencer"]
B --> o1(["output — one value per channel"])
While
inputis true the block advances one element everydurations[e]seconds and wraps at the end of the table. While it is false the outputs sit at element 0 and the sequence is reset, so it always restarts from the beginning.
Element 0 is the idle value, not the first step. When the sequence starts it goes straight to element 1. A five-element table plays 1, 2, 3, 4, 0, 1, 2 … — element 0 is what you see at rest and once per loop.
Set the durations before you use it. They default to zero, and a zero-duration element advances every task cycle, so an unconfigured sequencer flickers through its table at the task rate.
This block has no enable, no disable and no isEnabled. input false is
the idle state.
Signals
Inputs
| Path | Unit | Range | Description |
|---|---|---|---|
input |
- | - | True runs the sequence; false parks every channel on element 0 and resets the timer. It is a level, not a trigger — the sequence restarts from the beginning each time it goes true. |
Outputs
| Path | Unit | Description |
|---|---|---|
output |
whatever you put in the table | The active element’s value, one per channel. All channels step together. |
Parameters
| Path | Unit | Default | Range | Effect |
|---|---|---|---|---|
durations |
s | all 0 | above 0 | How long each element is held, one per element, shared by every channel. A zero or negative duration advances in one task cycle, which is what the defaults do. |
channel_01, channel_02, … |
table unit | all 0 | any | One row per output channel, one value per element. Element 0 is the idle value. |
ids |
- | all −1 | any | The IDs this sequencer answers to, used by SequenceSelector to choose between several. Ignored when the block is used on its own. |
All are persistent and survive a controller restart. No parameters exist below this block.
The table’s shape — how many elements and how many channels — is fixed when the
machine is built. Read the length of durations and of output to discover
it.
Setup
-
Read the length of
durationsto find how many elements the table has, and the length ofoutputfor the channel count. Both are fixed. -
Fill in
durationsfirst. Every element needs a positive time, or the sequence will race through it. -
Fill each
channel_NNrow with the values that channel should take at each element. Put the idle value in element 0 — that is what the channel shows while the sequence is not running. -
Leave
inputfalse and confirm every channel sits at its element 0 value. -
Set
inputtrue and watch the outputs step. Time one full loop against the sum of your durations.Step 5 drives whatever is connected to the outputs. If these values command real motion rather than an indicator, check the whole table before you start it — the sequence loops until the input goes false.
-
Set
inputfalse and confirm every channel returns to its element 0 value immediately.
Tuning
There is nothing to tune — the table is the configuration.
- Keep every duration positive. A zero means “one task cycle”, which is almost never what you want.
- Remember the sequence starts at element 1. If you want a specific value at the moment it starts, put it there, not in element 0.
- Put the rest value in element 0. It is what shows at idle and it is also part of the loop, so it acts as a gap at the end of each pass.
- All channels share one duration row, so they cannot step at different rates. Use a second sequencer for a second rhythm.
- Nothing here needs re-checking after a task-rate change — the durations are in seconds.
Read each element’s dwell off the width of a step.
| Symptom | Cause | Action |
|---|---|---|
| The outputs flicker rapidly through the table | The durations are zero — the default | Set a positive duration for every element |
| The first value of the pattern never appears | Expected: the sequence starts at element 1, and element 0 is the idle value | Put the first step in element 1 |
| The outputs sit at one value and never move | input is false |
Set it true |
| The sequence restarts from the beginning every time | Expected: input is a level, and going false resets it |
This is the designed behaviour |
| One element is much shorter than configured | Its duration is zero or negative | Write a positive value |
| The channels do not step together | Not possible — they share one timer and one element index | Check what consumes the outputs |
| The channels need different rhythms | Not possible — one duration row for all of them | Use a second sequencer |
| The loop takes longer than the sum of the durations | Expected: each element is held for its own listed time, and element 0 is part of the loop | Include element 0’s duration in the total |
| I cannot tell which element is active | The block does not publish it | Infer it from the output values |
| The table is too short | Its size is fixed when the machine is built | It needs a configuration change |
| The sequencer never runs inside a selector | Its ids do not match the selector’s input |
Check the ids array |
A starting point for a three-element blink pattern on one channel, half a second per step:
durations = 0.5, 0.5, 0.5
channel_01 = 0.0, 1.0, 0.0
At rest the channel reads 0. Running, it plays 1.0, then 0.0, then 0.0, and loops.
Limits and errors
| Limit | Set by | What happens | Reported |
|---|---|---|---|
durations above 0 |
Nothing | Not checked. A zero or negative duration advances that element in one task cycle. All zeros — the default — makes the whole table free-run at the task rate | Not reported |
| Active element | Not published | Which step is running cannot be read from the parameter tree | Not reported |
| Table shape | Machine configuration | The element count and channel count are fixed when the machine is built. Read the array lengths to discover them | Not reported |
output |
Nothing | Whatever is in the table. Bound it downstream if the consumer needs a limit | Not reported |
| Timing | Task rate independent | Durations are in seconds and keep their meaning at any task period | Not applicable |
| Block state | input false |
Going idle resets the timer and the element. There is no separate reset | Not reported |
The block raises no errors or warnings and logs nothing. Every failure above shows as a value on a trace, not as a message.
Verified against motorcortex-control3 3.30.0 (bc348fd).