Usage
Initial Setup
Before Piper can be used, the library must be added to the project along with the MachineControl package. The MachineControl package adds a gMachine variable, which provides machine state status information, and a machine command interface that can be used by the rest of the system.
Adding Substates
Substates can be added in the MachineControl package by editing the MachineControl.typ file. Substates always flow in order, so add and order substates as needed for the application.
Integrating with Tasks
To interface with Piper, a task requires two files: (1) a variable file where the Module and ModuleInterface are declared and (2) an action file, written in either ST or C depending on the task to which the interface is added. Once these two files are added, call the action in the task’s cyclic code. Templates can be found on the Module Templates page.
Controlling Machine State
Machine will remain in a Wait state until an action is commanded via gMachine or a Module responds with MACH_ST_ERROR. Each command is only valid in some states. See the list of commands. While in an Acting state, Machine will wait in that state until all Modules reply with “done”. Within each state, Machine will cycle through substates as requested.
HMI Interface with Piper
For ease of use, the MachineControl package provides a task for machine control via HMI. The local machine commands and command status should be linked to the HMI instead of the gMachine commands directly.
Style and Best Practices
For details on Piper style and best practices, see the Piper Guide.
Example
The example can be downloaded here.