diff --git a/README.md b/README.md index 4f6ead04..51fbee32 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/docs/assets/control-loop.png b/docs/assets/control-loop.png new file mode 100644 index 00000000..a2a350b5 Binary files /dev/null and b/docs/assets/control-loop.png differ diff --git a/docs/control-loop.md b/docs/control-loop.md new file mode 100644 index 00000000..6e3a07ac --- /dev/null +++ b/docs/control-loop.md @@ -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. + + + diff --git a/docs/drawio/control-loop.drawio b/docs/drawio/control-loop.drawio new file mode 100644 index 00000000..3d952c22 --- /dev/null +++ b/docs/drawio/control-loop.drawio @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file