Conditions
Conditions can be used in if-then-else instructions, loops, and as termination conditions in motion instructions. The conditions can be combinations of digital inputs, global signals, boolean operations and comparisons. Capitalization and spaces between symbols are ignored.
Digital Inputs & Global Signals
In the simplest case, for example, a condition can check whether a signal is present at digital input 21:
- DIn21
More complex conditions can be constructed using the AND and OR keywords and parentheses. The following condition is met if a signal is present at either input 21 or inputs 22 and 23:
- DIn21 OR (DIn22 AND DIn23)
To negate an expression put an exclamation mark (!) in front of it. This is also possible before paren- thesized expressions. The following condition is met if either there is no signal at input 21 or if there is no signal at inputs 22 and 23 together:
- !DIn21 OR !(DIn22 AND DIn23)
Likewise, the state of global signals can be queried. Global signals are internal flags which can also be used for communication between robot and logic program and external ap- plications or PLC:
- GSig1 AND !DIn21
The states of the digital outputs cannot be queried in conditions. If necessary, a global signal representing the output can be set after setting the output.
Variables
In addition, the values of number and position variables can also be checked. Number variables represent a single number while position variables contain several number components. For position variables, it is therefore always necessary to specify which component is to be compared.
- mynumbervariable = 5
- mynumbervariable < 10
- mypositionvariable >= 42
- mypositionvariable.X = 123
- mypositionsvariable.B >= 90
- mypositionvariable.A3 > 300
- mypositionvariable.E1 < 500
Numeric values can also be compared to each other:
- mypositionvariable.X > mynumbervariable
- mypositionvariable.A1 <= otherpositionvariable.A1
The following position components can be used to compare positions:
- cartesian
- X, Y, Z: position in millimeters
- A, B, C: orientation in degrees
- axis positions
- A1 to A6: robot axes in degrees or millimeters
- E1 to E3: additional axes in degrees, millimeters or self-defined unit
Syntax Rules
In summary, the condition syntax can be described by the following EBNF definition:
| Expression | ["!"] <Boolean> <BooleanOperator> <Boolean> ... |
| Boolean | <BooleanConstant> | <Expression> | "(" <Expression> ")" | CompExpression | "(" <CompExpression> ")" | <DigitalInputs> | "(" <DigitalInputs> ")" |
| BooleanOperator | "And" | "Or" |
| BooleanConstant | "True" | "False" |
| Digital Inputs | <ChannelType> <ChannelId> |
| ChannelType | "Din" | "GSig" |
| ChannelId | Integer value |
| CompExpression | <CompValue> <CompOperator> <CompValue> |
| CompValue | <Variable> | <Number> |
| Variable | <Numbervariable> | < PositionComponent> |
| Numbervariable | Name of a number variable |
| Positions component | <Position variable> "." <Component> |
| PositionVariable | Name of a position variable |
| Component | "x" | "y" | "z" | "A" | "B" | "C" | "A1" | "A2" | "A3" | "A4" | "A5" | "A6" | "E1" | "E2" | "E3" |
| Number | Integer or floating point number |
| CompOperator | "=" | ">" | "<" | ">=" | "<=" |