Good morning, I'm trying to build an XYYZZ gantry with two motors on the Y and Z axes. To do this, I've used 5 CMMT-ST drives with absolute encoder servomotors. I have some doubts about the homing procedure. At the moment I can see the drives, but I haven't managed to move them yet. Before causing any damage, I wanted to get your opinion on the configuration files, since this is my first time using LinuxCNC.
ethercat.ini
Code:
[EMC]
VERSION = 1.1
# Debug level, 0 means no messages. See src/emc/nml_int/emcglb.h for others
#DEBUG = 0x7FFFFFFF
DEBUG = 0
[DISPLAY]
DISPLAY = axis
CYCLE_TIME = 0.1
MAX_LINEAR_VELOCITY = 50.0
DEFAULT_LINEAR_VELOCITY = 10.0
POSITION_OFFSET = RELATIVE
POSITION_FEEDBACK = ACTUAL
[TASK]
TASK = milltask
CYCLE_TIME = 0.01
[EMCMOT]
EMCMOT = motmod
# Timeout for comm to emcmot, in seconds
COMM_TIMEOUT = 1.0
# Servo task period, in nano-seconds
SERVO_PERIOD = 1000000
# section for main IO controller parameters -----------------------------------
[EMCIO]
# Name of IO controller program, e.g., io
EMCIO = io
# cycle time, in seconds
CYCLE_TIME = 0.100
TOOL_TABLE = tool.tbl
[HAL]
HALFILE = ethercat.hal
# Single file that is executed after the GUI has started. Only supported by
# AXIS at this time (only AXIS creates a HAL component of its own)
#POSTGUI_HALFILE = test_postgui.hal
HALUI = halui
[RS274NGC]
PARAMETER_FILE = linuxcnc.var
[TRAJ]
COORDINATES = XYYZZ
LINEAR_UNITS = mm
ANGULAR_UNITS = degree
MAX_LINEAR_VELOCITY = 25.0
DEFAULT_LINEAR_VELOCITY = 2.50
[KINS]
JOINTS = 5
KINEMATICS = trivkins coordinates=XYYZZ kinstype=BOTH
# --- X Axis ---
[AXIS_X]
MAX_VELOCITY = 50.0
MAX_ACCELERATION = 200.0
MIN_LIMIT = -30.0
MAX_LIMIT = 1700.0
[JOINT_0]
TYPE = LINEAR
HOME = 0.0
MAX_VELOCITY = 50.0
MAX_ACCELERATION = 200.0
MIN_LIMIT = -30.0
MAX_LIMIT = 1700.0
FERROR = 1000
MIN_FERROR = 1000
HOME_ABSOLUTE_ENCODER = 2
HOME_SEQUENCE = 0
# --- Y Axis (dual) ---
[AXIS_Y]
MAX_VELOCITY = 50.0
MAX_ACCELERATION = 200.0
MIN_LIMIT = -30.0
MAX_LIMIT = 1700.0
[JOINT_1]
TYPE = LINEAR
HOME = 0.0
FERROR = 1000
MIN_FERROR = 1000
# both Y joints home together
HOME_SEQUENCE = 1
HOME_ABSOLUTE_ENCODER = 2
MAX_VELOCITY = 50.0
MAX_ACCELERATION = 200.0
MIN_LIMIT = -30.0
MAX_LIMIT = 1700.0
[JOINT_2]
TYPE = LINEAR
HOME = 0.0
FERROR = 1000
MIN_FERROR = 1000
# both Y joints home together
HOME_SEQUENCE = 1
HOME_ABSOLUTE_ENCODER = 2
MAX_VELOCITY = 50.0
MAX_ACCELERATION = 200.0
MIN_LIMIT = -30.0
MAX_LIMIT = 1700.0
# --- Z Axis (dual) ---
[AXIS_Z]
MAX_VELOCITY = 50.0
MAX_ACCELERATION = 200.0
MIN_LIMIT = -30.0
MAX_LIMIT = 1700.0
[JOINT_3]
TYPE = LINEAR
HOME = 0.0
MAX_VELOCITY = 50.0
MAX_ACCELERATION = 200.0
MIN_LIMIT = -30.0
MAX_LIMIT = 1700.0
FERROR = 1000
MIN_FERROR = 1000
# both Z joints home together
HOME_SEQUENCE = 2
HOME_ABSOLUTE_ENCODER = 2
[JOINT_4]
TYPE = LINEAR
HOME = 0.0
MAX_VELOCITY = 50.0
MAX_ACCELERATION = 200.0
MIN_LIMIT = -30.0
MAX_LIMIT = 1700.0
FERROR = 1000
MIN_FERROR = 1000
# both Z joints home together
HOME_SEQUENCE = 2
HOME_ABSOLUTE_ENCODER = 2
ethercat.hal
Code:
# --- load components ---
loadrt [KINS]KINEMATICS
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=5
# load EtherCAT xml then drivers
loadusr -W lcec_conf ethercat-conf.xml
loadrt lcec
loadrt cia402 count=5
# estop loopback
net estop-loop iocontrol.0.user-enable-out iocontrol.0.emc-enable-in
#machine enabled if no estop loopback
#setp iocontrol.0.emc-enable-in 1
# --- add functions to servo-thread ---
addf lcec.read-all servo-thread
# read from cia402 drivers (one per joint)
addf cia402.0.read-all servo-thread
addf cia402.1.read-all servo-thread
addf cia402.2.read-all servo-thread
addf cia402.3.read-all servo-thread
addf cia402.4.read-all servo-thread
# motion stack
addf motion-command-handler servo-thread
addf motion-controller servo-thread
# writes: cia402 then lcec
addf cia402.0.write-all servo-thread
addf cia402.1.write-all servo-thread
addf cia402.2.write-all servo-thread
addf cia402.3.write-all servo-thread
addf cia402.4.write-all servo-thread
addf lcec.write-all servo-thread
# =========================
# JOINT 0 (X) -> cia402.0 -> lcec.0.4
# =========================
setp cia402.0.csp-mode 1
setp cia402.0.pos-scale 2000 # match SCALE in .ini; negate if direction reversed
# joint signals for motion
net x-pos-cmd joint.0.motor-pos-cmd => cia402.0.pos-cmd
net x-pos-fb joint.0.motor-pos-fb <= cia402.0.pos-fb
net x-enable joint.0.amp-enable-out => cia402.0.enable
net x-amp-fault joint.0.amp-fault-in <= cia402.0.drv-fault
# ethercat to cia402 driver
net x-statusword lcec.0.4.cia-statusword => cia402.0.statusword
net x-opmode-display lcec.0.4.opmode-display => cia402.0.opmode-display
net x-drv-act-pos lcec.0.4.actual-position => cia402.0.drv-actual-position
# cia402 driver to ethercat
net x-controlword cia402.0.controlword => lcec.0.4.cia-controlword
net x-modes-of-operation cia402.0.opmode => lcec.0.4.opmode
net x-drv-target-pos cia402.0.drv-target-position => lcec.0.4.target-position
# homing (optional)
# net x-home-request joint.0.request-custom-homing => cia402.0.home
# net x-homing joint.0.is-custom-homing <= cia402.0.stat-homing
# net x-homed joint.0.custom-homing-finished <= cia402.0.stat-homed
# =========================
# JOINT 1 (Y1) -> cia402.1 -> lcec.0.2
# =========================
setp cia402.1.csp-mode 1
setp cia402.1.pos-scale 2000
#setp cia402.1.abs-encoder 1
net y1-pos-cmd joint.1.motor-pos-cmd => cia402.1.pos-cmd
net y1-pos-fb joint.1.motor-pos-fb <= cia402.1.pos-fb
net y1-enable joint.1.amp-enable-out => cia402.1.enable
net y1-amp-fault joint.1.amp-fault-in <= cia402.1.drv-fault
net y1-statusword lcec.0.2.cia-statusword => cia402.1.statusword
net y1-opmode-display lcec.0.2.opmode-display => cia402.1.opmode-display
net y1-drv-act-pos lcec.0.2.actual-position => cia402.1.drv-actual-position
net y1-controlword cia402.1.controlword => lcec.0.2.cia-controlword
net y1-modes-of-operation cia402.1.opmode => lcec.0.2.opmode
net y1-drv-target-pos cia402.1.drv-target-position => lcec.0.2.target-position
# =========================
# JOINT 2 (Y2) -> cia402.2 -> lcec.0.3
# =========================
setp cia402.2.csp-mode 1
setp cia402.2.pos-scale 2000
#setp cia402.2.abs-encoder 1
net y2-pos-cmd joint.2.motor-pos-cmd => cia402.2.pos-cmd
net y2-pos-fb joint.2.motor-pos-fb <= cia402.2.pos-fb
net y2-enable joint.2.amp-enable-out => cia402.2.enable
net y2-amp-fault joint.2.amp-fault-in <= cia402.2.drv-fault
net y2-statusword lcec.0.3.cia-statusword => cia402.2.statusword
net y2-opmode-display lcec.0.3.opmode-display => cia402.2.opmode-display
net y2-drv-act-pos lcec.0.3.actual-position => cia402.2.drv-actual-position
net y2-controlword cia402.2.controlword => lcec.0.3.cia-controlword
net y2-modes-of-operation cia402.2.opmode => lcec.0.3.opmode
net y2-drv-target-pos cia402.2.drv-target-position => lcec.0.3.target-position
# =========================
# JOINT 3 (Z1) -> cia402.3 -> lcec.0.0
# =========================
setp cia402.3.csp-mode 1
setp cia402.3.pos-scale 2000
#setp cia402.3.abs-encoder 1
net z1-pos-cmd joint.3.motor-pos-cmd => cia402.3.pos-cmd
net z1-pos-fb joint.3.motor-pos-fb <= cia402.3.pos-fb
net z1-enable joint.3.amp-enable-out => cia402.3.enable
net z1-amp-fault joint.3.amp-fault-in <= cia402.3.drv-fault
net z1-statusword lcec.0.0.cia-statusword => cia402.3.statusword
net z1-opmode-display lcec.0.0.opmode-display => cia402.3.opmode-display
net z1-drv-act-pos lcec.0.0.actual-position => cia402.3.drv-actual-position
net z1-controlword cia402.3.controlword => lcec.0.0.cia-controlword
net z1-modes-of-operation cia402.3.opmode => lcec.0.0.opmode
net z1-drv-target-pos cia402.3.drv-target-position => lcec.0.0.target-position
# =========================
# JOINT 4 (Z2) -> cia402.4 -> lcec.0.1
# =========================
setp cia402.4.csp-mode 1
setp cia402.4.pos-scale 2000
#setp cia402.4.abs-encoder 1
net z2-pos-cmd joint.4.motor-pos-cmd => cia402.4.pos-cmd
net z2-pos-fb joint.4.motor-pos-fb <= cia402.4.pos-fb
net z2-enable joint.4.amp-enable-out => cia402.4.enable
net z2-amp-fault joint.4.amp-fault-in <= cia402.4.drv-fault
net z2-statusword lcec.0.1.cia-statusword => cia402.4.statusword
net z2-opmode-display lcec.0.1.opmode-display => cia402.4.opmode-display
net z2-drv-act-pos lcec.0.1.actual-position => cia402.4.drv-actual-position
net z2-controlword cia402.4.controlword => lcec.0.1.cia-controlword
net z2-modes-of-operation cia402.4.opmode => lcec.0.1.opmode
net z2-drv-target-pos cia402.4.drv-target-position => lcec.0.1.target-position
# End of HAL
ethercat-conf.xml
Code:
<masters>
<master idx="0" appTimePeriod="1000000" refClockSyncCycles="1">
<!-- Joint Z1 -->
<slave idx="0" type="generic" vid="0000001D" pid="007b5a25" configPdos="true">
<dcConf assignActivate="300" sync0Cycle="*1" sync0Shift="0"/>
<syncManager idx="2" dir="out">
<pdo idx="1600">
<pdoEntry idx="6040" subIdx="00" bitLen="16" halPin="cia-controlword" halType="u32"/>
<pdoEntry idx="6060" subIdx="00" bitLen="8" halPin="opmode" halType="s32"/>
<pdoEntry idx="607A" subIdx="00" bitLen="32" halPin="target-position" halType="s32"/>
</pdo>
</syncManager>
<syncManager idx="3" dir="in">
<pdo idx="1a00">
<pdoEntry idx="6041" subIdx="00" bitLen="16" halPin="cia-statusword" halType="u32"/>
<pdoEntry idx="6061" subIdx="00" bitLen="8" halPin="opmode-display" halType="s32"/>
<pdoEntry idx="6064" subIdx="00" bitLen="32" halPin="actual-position" halType="s32"/>
<pdoEntry idx="606C" subIdx="00" bitLen="32" halPin="actual-velocity" halType="s32"/>
<pdoEntry idx="6077" subIdx="00" bitLen="32" halPin="actual-torque" halType="s32"/>
</pdo>
</syncManager>
</slave>
<!-- Joint Z2 -->
<slave idx="1" type="generic" vid="0000001D" pid="007b5a25" configPdos="true">
<dcConf assignActivate="300" sync0Cycle="*1" sync0Shift="0"/>
<syncManager idx="2" dir="out">
<pdo idx="1600">
<pdoEntry idx="6040" subIdx="00" bitLen="16" halPin="cia-controlword" halType="u32"/>
<pdoEntry idx="6060" subIdx="00" bitLen="8" halPin="opmode" halType="s32"/>
<pdoEntry idx="607A" subIdx="00" bitLen="32" halPin="target-position" halType="s32"/>
</pdo>
</syncManager>
<syncManager idx="3" dir="in">
<pdo idx="1a00">
<pdoEntry idx="6041" subIdx="00" bitLen="16" halPin="cia-statusword" halType="u32"/>
<pdoEntry idx="6061" subIdx="00" bitLen="8" halPin="opmode-display" halType="s32"/>
<pdoEntry idx="6064" subIdx="00" bitLen="32" halPin="actual-position" halType="s32"/>
<pdoEntry idx="606C" subIdx="00" bitLen="32" halPin="actual-velocity" halType="s32"/>
<pdoEntry idx="6077" subIdx="00" bitLen="32" halPin="actual-torque" halType="s32"/>
</pdo>
</syncManager>
</slave>
<!-- Joint Y1 -->
<slave idx="2" type="generic" vid="0000001D" pid="007b5a25" configPdos="true">
<dcConf assignActivate="300" sync0Cycle="*1" sync0Shift="0"/>
<syncManager idx="2" dir="out">
<pdo idx="1600">
<pdoEntry idx="6040" subIdx="00" bitLen="16" halPin="cia-controlword" halType="u32"/>
<pdoEntry idx="6060" subIdx="00" bitLen="8" halPin="opmode" halType="s32"/>
<pdoEntry idx="607A" subIdx="00" bitLen="32" halPin="target-position" halType="s32"/>
</pdo>
</syncManager>
<syncManager idx="3" dir="in">
<pdo idx="1a00">
<pdoEntry idx="6041" subIdx="00" bitLen="16" halPin="cia-statusword" halType="u32"/>
<pdoEntry idx="6061" subIdx="00" bitLen="8" halPin="opmode-display" halType="s32"/>
<pdoEntry idx="6064" subIdx="00" bitLen="32" halPin="actual-position" halType="s32"/>
<pdoEntry idx="606C" subIdx="00" bitLen="32" halPin="actual-velocity" halType="s32"/>
<pdoEntry idx="6077" subIdx="00" bitLen="32" halPin="actual-torque" halType="s32"/>
</pdo>
</syncManager>
</slave>
<!-- Joint Y2 -->
<slave idx="3" type="generic" vid="0000001D" pid="007b5a25" configPdos="true">
<dcConf assignActivate="300" sync0Cycle="*1" sync0Shift="0"/>
<syncManager idx="2" dir="out">
<pdo idx="1600">
<pdoEntry idx="6040" subIdx="00" bitLen="16" halPin="cia-controlword" halType="u32"/>
<pdoEntry idx="6060" subIdx="00" bitLen="8" halPin="opmode" halType="s32"/>
<pdoEntry idx="607A" subIdx="00" bitLen="32" halPin="target-position" halType="s32"/>
</pdo>
</syncManager>
<syncManager idx="3" dir="in">
<pdo idx="1a00">
<pdoEntry idx="6041" subIdx="00" bitLen="16" halPin="cia-statusword" halType="u32"/>
<pdoEntry idx="6061" subIdx="00" bitLen="8" halPin="opmode-display" halType="s32"/>
<pdoEntry idx="6064" subIdx="00" bitLen="32" halPin="actual-position" halType="s32"/>
<pdoEntry idx="606C" subIdx="00" bitLen="32" halPin="actual-velocity" halType="s32"/>
<pdoEntry idx="6077" subIdx="00" bitLen="32" halPin="actual-torque" halType="s32"/>
</pdo>
</syncManager>
</slave>
<!-- Joint X -->
<slave idx="4" type="generic" vid="0000001D" pid="007b5a25" configPdos="true">
<dcConf assignActivate="300" sync0Cycle="*1" sync0Shift="0"/>
<syncManager idx="2" dir="out">
<pdo idx="1600">
<pdoEntry idx="6040" subIdx="00" bitLen="16" halPin="cia-controlword" halType="u32"/>
<pdoEntry idx="6060" subIdx="00" bitLen="8" halPin="opmode" halType="s32"/>
<pdoEntry idx="607A" subIdx="00" bitLen="32" halPin="target-position" halType="s32"/>
</pdo>
</syncManager>
<syncManager idx="3" dir="in">
<pdo idx="1a00">
<pdoEntry idx="6041" subIdx="00" bitLen="16" halPin="cia-statusword" halType="u32"/>
<pdoEntry idx="6061" subIdx="00" bitLen="8" halPin="opmode-display" halType="s32"/>
<pdoEntry idx="6064" subIdx="00" bitLen="32" halPin="actual-position" halType="s32"/>
<pdoEntry idx="606C" subIdx="00" bitLen="32" halPin="actual-velocity" halType="s32"/>
<pdoEntry idx="6077" subIdx="00" bitLen="32" halPin="actual-torque" halType="s32"/>
</pdo>
</syncManager>
</slave>
</master>
</masters>
I hope this can eventually help other people who want to use these drives.
Many thanks to all for your help.