Overview
To create a homing PLC the user must write a definition file which is a simple python script.
For example the following code will output a PLC 12 that defines a group of axes including axis 1 and axis 2. It will provide a standard home switch (or home mark) homing sequence. The PLC will be written to /tmp/PLC12_SLITS1_HM.pmc
Homing PLC definition file
from pmac_motorhome.commands import group, motor, plc
from pmac_motorhome.sequences import home_hsw
with plc(
plc_num=12, controller="GeoBrick", filepath="/tmp/PLC12_SLITS1_HM.pmc",
):
with group(group_num=3):
motor(axis=1)
motor(axis=2)
home_hsw()
All the code that goes into the definition file will use global functions
and contexts (The with statement
). The functions can be broken into 3 categories
which are documented in the following sections.
Commands: functions to declare PLCs, Motors and Groups
Predfined Homing Sequences: a set of commonly used predefined homing sequences
Snippet Functions: a set of blocks of PLC code combined by predfined above