docs control loop

This commit is contained in:
Icedsoda committed 2025-03-26 12:41:16 +01:00
1 parent 0b7d8307f9
commit eaa8d989e2
4 files changed
+108 -5

No files matched your search

+1 -5
View File
@@ -64,11 +64,7 @@ Other
- Identifying Groups
- Validating Machines
- Run Control Loop
- [ ] Control Loop
- Ethercat TX/RX
- Reading Inputs
- Calling Actors
- Writing Outputs
- [X] [Control Loop](./docs/control-loop.md)
- [ ] Machine/Device Identification
- SubDevice Identity
- Identification design choices
Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

+22
View File
@@ -0,0 +1,22 @@
# Control Loop
![Diagram](./assets/control-loop.png)
## TX/RX
The control loop starts with the TX/RX handled by Ethercrab. It sends the EtherCat frome to all devices and waits for recieval.
Although EtherCAT supports multiple in-flight frames we just use one at a time.
## Read Inputs
We loop over every device and check if the inputs for this device match the expected length (byte length).
If the size matches we give the inputs to the `TxPdo` object of the device which will decode and store the inputs.
## Act
We loop over all known actors and call their `act` function. This is where the control loop logic happens. They can read the input and write the output.
## Write Outputs
We loop over every device and check if the outputs for this device match the expected length (byte length).
If the size matches we give the outputs to the `RxPdo` object of the device which will encode the outputs.
+85
View File
@@ -0,0 +1,85 @@
<mxfile host="65bd71144e" scale="1" border="10">
<diagram id="byiMNmKaLVVecmADtaWw" name="Page-1">
<mxGraphModel dx="458" dy="665" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<root>
<mxCell id="0"/>
<mxCell id="1" parent="0"/>
<mxCell id="23" value="" style="swimlane;startSize=0;fillStyle=solid;fillColor=none;strokeColor=none;swimlaneFillColor=#FFFFFF;" parent="1" vertex="1">
<mxGeometry x="140" y="270" width="630" height="550" as="geometry">
<mxRectangle x="140" y="270" width="50" height="40" as="alternateBounds"/>
</mxGeometry>
</mxCell>
<mxCell id="13" style="edgeStyle=orthogonalEdgeStyle;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;dashed=1;" parent="23" source="2" target="3" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="15" style="edgeStyle=none;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="23" source="2" target="4" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="2" value="Read Inputs" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#ffe6cc;strokeColor=#d79b00;" parent="23" vertex="1">
<mxGeometry x="70" y="240" width="120" height="60" as="geometry"/>
</mxCell>
<mxCell id="14" style="edgeStyle=orthogonalEdgeStyle;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;dashed=1;" parent="23" source="3" target="5" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="3" value="Device" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#ffe6cc;strokeColor=#d79b00;" parent="23" vertex="1">
<mxGeometry x="490" y="330" width="120" height="60" as="geometry"/>
</mxCell>
<mxCell id="8" style="edgeStyle=none;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;dashed=1;" parent="23" source="4" target="6" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="16" style="edgeStyle=none;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="23" source="4" target="5" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="4" value="act()" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#ffe6cc;strokeColor=#d79b00;" parent="23" vertex="1">
<mxGeometry x="70" y="330" width="120" height="60" as="geometry"/>
</mxCell>
<mxCell id="5" value="Write Inputs" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#ffe6cc;strokeColor=#d79b00;" parent="23" vertex="1">
<mxGeometry x="70" y="420" width="120" height="60" as="geometry"/>
</mxCell>
<mxCell id="9" style="edgeStyle=none;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;dashed=1;" parent="23" source="6" target="7" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="6" value="Machine" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#ffe6cc;strokeColor=#d79b00;" parent="23" vertex="1">
<mxGeometry x="230" y="330" width="120" height="60" as="geometry"/>
</mxCell>
<mxCell id="10" style="edgeStyle=none;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;dashed=1;" parent="23" source="7" target="3" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="7" value="..." style="rounded=0;whiteSpace=wrap;html=1;fillColor=#ffe6cc;strokeColor=#d79b00;" parent="23" vertex="1">
<mxGeometry x="390" y="330" width="60" height="60" as="geometry"/>
</mxCell>
<mxCell id="18" style="edgeStyle=none;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="23" source="17" target="2" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="17" value="TX/RX" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#ffe6cc;strokeColor=#d79b00;" parent="23" vertex="1">
<mxGeometry x="70" y="150" width="120" height="60" as="geometry"/>
</mxCell>
<mxCell id="19" style="edgeStyle=orthogonalEdgeStyle;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.526;entryY=-0.067;entryDx=0;entryDy=0;entryPerimeter=0;" parent="23" source="5" target="17" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="130" y="530"/>
<mxPoint x="20" y="530"/>
<mxPoint x="20" y="110"/>
<mxPoint x="133" y="110"/>
</Array>
</mxGeometry>
</mxCell>
<mxCell id="20" value="" style="endArrow=classic;html=1;" parent="23" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="160" y="80" as="sourcePoint"/>
<mxPoint x="160" y="150" as="targetPoint"/>
</mxGeometry>
</mxCell>
<mxCell id="21" value="Setup" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#ffe6cc;strokeColor=#d79b00;" parent="23" vertex="1">
<mxGeometry x="70" y="20" width="120" height="60" as="geometry"/>
</mxCell>
<mxCell id="24" value="EtherCAT" style="ellipse;shape=cloud;whiteSpace=wrap;html=1;" vertex="1" parent="23">
<mxGeometry x="214" y="140" width="120" height="80" as="geometry"/>
</mxCell>
<mxCell id="25" style="edgeStyle=none;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0.088;entryY=0.488;entryDx=0;entryDy=0;entryPerimeter=0;startArrow=classic;startFill=1;" edge="1" parent="23" source="17" target="24">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>