Trigger: Threshold
The threshold trigger allows actions to be performed in response to a user-specified data quantity crossing a threshold. There are several modes which make it very flexible.
Configuration
The data to be checked is identified by its corresponding MIP descriptor set, field descriptor, and parameter index. The parameter index is the 1-based index of the parameter within the MIP data field. E.g. Parameter 2 of Scaled Accel (0x80,0x04), a 3-vector, would represent the Y axis.
The interpretation of the thresholds depends on the mode parameter.
Window Comparator
Mode = WINDOW
In window mode, the last two parameters are double-precision lower and upper thresholds. When the data quantity is in the window (i.e. between the thresholds) the trigger is activated. The thresholds can be reversed to invert the logic and make the trigger active when the data is outside the window.
The data value is first converted to a double-precision float for the purposes of the comparison.
The trigger can also be reversed by swapping the low and high thresholds, i.e. if the high threshold is below the low threshold:
Example: Stopping a Robot if It Tips Over
Interval Trigger
Mode = INTERVAL
In interval mode, the last two parameters are threshold and interval as doubles. The trigger is active when the data value, modulo the interval, is less than the threshold. This forms a repeating pattern which is useful mostly for time quantities.
Example: Synchronized Square Wave Output.