Using logical boxes
This tutorial describes an example of the use of 2 logical boxes that you can find in Choregraphe: Loop and Wait. Logical boxes are very useful when you want to create more complex behaviors. In Choregraphe, you can find two ready-to-use logical boxes but you can create your own.
Description of the boxes
|It has a reset input, to reset the internal counter. Loop's logical behavior increments an internal counter and stimulates its output depending on the counter value compared to the max initially set. This logical box is appropriate when you want, for example, to repeat the same behavior for a determined number of cycles. Open the box parameters panel to edit the number of time it will loop over.|
|The Wait box is a script box with no second level. The Wait box waits for its two inputs to be stimulated before stimulating its output.|
How to use these logical boxes together ?
Example: you would like to create a simple behavior with NAO nodding three times while dancing before he starts to walk. The most efficient way to create this behavior is to use the two ready-built logical boxes.
- Take a Movement box and create a nodding movement behavior with the motion timeline.
> Refer to the Creating a movement from scratch tutorial for further information.
- Drag and drop a Dance box (you can change the motion keyframes if you want) and connect the two boxes to the main behavior entry.
> If you click on, NAO will nod once while dancing.
- Add a Loop box to your behavior and set the Final value to 3. Then, connect it to your Movement box.
> NAO will nod three times while dancing. It’s not bad but we also want NAO to start walking after he has finished nodding and dancing. This is quite simple: a Wait box should be used.
- Drag and drop a Wait box onto the diagram and connect it to the Dance and Loop boxes.
> The Wait box stimulates its output once the two inputs are stimulated.
- Add a Walk box to your behavior.
> NAO starts walking after he has finished nodding and dancing.