Each motion axis can have a local axis PLC. This is configured as part of the YAML axis configuration.
Use the axis PLC for logic that belongs directly to one axis, for example:
For larger machine logic or coordination between many objects, use a normal PLC instead of putting everything in the axis PLC.
The code can be provided either inline in the YAML or in a separate file.
plc:
enable: true
externalCommands: true
code:
- ax3.enc.actpos:=(ax1.enc.actpos+ax2.enc.actpos)/2
velocity_filter:
encoder:
enable: true
size: 100
trajectory:
enable: true
size: 100
plc:
enable: true
externalCommands: true
file: cfg/heave.plc
velocity_filter:
encoder:
enable: true
size: 100
trajectory:
enable: true
size: 100
The corresponding PLC file:
ax${AXIS_NO}.enc.actpos:=(ax{{ var.ty1 }}.enc.actpos+ax{{ var.ty2 }}.enc.actpos)/2;
Note the mixed use of startup macros like ${AXIS_NO} and local template
variables like {{ var.ty1 }}.
enable
enable the axis PLC; required when the axis plc block is presentexternalCommands
allow the PLC to influence axis commands and setpoints; default falsecode
inline PLC linesfile
external PLC filevelocity_filter
optional encoder and trajectory velocity filtering. Each block defaults
to enable: false, size: 1 (cycles). Set enable: true to use it.The older filter.velocity and filter.trajectory syntax remains supported
but is deprecated. file and code are optional; when both are supplied,
inline lines are appended after the file content.
code for a few short axis-specific lines.file when the logic is more than a handful of lines or should be reused
across axes.