Moved PDOs to SDOs, made an example config

This commit is contained in:
Hakan Bastedt
2025-08-17 20:01:12 +02:00
parent 90a2d4dd32
commit dac61fbba5
11 changed files with 1146 additions and 1197 deletions

View File

@@ -0,0 +1,230 @@
# EMC controller parameters for a simulated machine.
# General note: Comments can either be preceded with a # or ; - either is
# acceptable, although # is in keeping with most linux config files.
# General section -------------------------------------------------------------
[EMC]
# Version of this INI file
VERSION = 1.1
# Name of machine, for use with display, etc.
MACHINE = LinuxCNC-HAL-SIM-AXIS
# Debug level, 0 means no messages. See src/emc/nml_int/emcglb.h for others
#DEBUG = 0x7FFFFFFF
DEBUG = 0
# Sections for display options ------------------------------------------------
[DISPLAY]
# Name of display program, e.g., axis
DISPLAY = axis
# Cycle time, in seconds, that display will sleep between polls
CYCLE_TIME = 0.100
# Path to help file
HELP_FILE = doc/help.txt
# Initial display setting for position, RELATIVE or MACHINE
POSITION_OFFSET = RELATIVE
# Initial display setting for position, COMMANDED or ACTUAL
POSITION_FEEDBACK = ACTUAL
# Highest value that will be allowed for feed override, 1.0 = 100%
MAX_FEED_OVERRIDE = 1.2
MAX_SPINDLE_OVERRIDE = 1.0
MAX_LINEAR_VELOCITY = 5
DEFAULT_LINEAR_VELOCITY = .25
DEFAULT_SPINDLE_SPEED = 200
# Prefix to be used
PROGRAM_PREFIX = /home/debian/linuxcnc/nc_files
# Introductory graphic
INTRO_GRAPHIC = linuxcnc.gif
INTRO_TIME = 5
#EDITOR = geany
TOOL_EDITOR = tooledit
INCREMENTS = 1 in, 0.1 in, 10 mil, 1 mil, 1mm, .1mm, 1/8000 in
[FILTER]
PROGRAM_EXTENSION = .png,.gif,.jpg Grayscale Depth Image
PROGRAM_EXTENSION = .py Python Script
png = image-to-gcode
gif = image-to-gcode
jpg = image-to-gcode
py = python3
# Task controller section -----------------------------------------------------
[TASK]
# Name of task controller program, e.g., milltask
TASK = milltask
# Cycle time, in seconds, that task controller will sleep between polls
CYCLE_TIME = 0.001
# Part program interpreter section --------------------------------------------
[RS274NGC]
# File containing interpreter variables
PARAMETER_FILE = sim.var
# Motion control section ------------------------------------------------------
[EMCMOT]
EMCMOT = motmod
# Timeout for comm to emcmot, in seconds
COMM_TIMEOUT = 1.0
# BASE_PERIOD is unused in this configuration but specified in core_sim.hal
BASE_PERIOD = 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 file
TOOL_TABLE = sim.tbl
TOOL_CHANGE_POSITION = 0 0 0
TOOL_CHANGE_QUILL_UP = 1
# Hardware Abstraction Layer section --------------------------------------------------
[HAL]
# The run script first uses halcmd to execute any HALFILE
# files, and then to execute any individual HALCMD commands.
#
# list of hal config files to run through halcmd
# files are executed in the order in which they appear
HALFILE = e3000.hal
#HALFILE = core_sim.hal
#HALFILE = sim_spindle_encoder.hal
#HALFILE = axis_manualtoolchange.hal
#HALFILE = simulated_home.hal
#HALFILE = check_xyz_constraints.hal
#HALFILE = cooling.hal
# list of halcmd commands to execute
# commands are executed in the order in which they appear
#HALCMD = save neta
# 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
# Trajectory planner section --------------------------------------------------
[TRAJ]
COORDINATES = X Y Z
LINEAR_UNITS = inch
ANGULAR_UNITS = degree
MAX_LINEAR_VELOCITY = 4
DEFAULT_LINEAR_ACCELERATION = 100
MAX_LINEAR_ACCELERATION = 100
POSITION_FILE = position.txt
[KINS]
KINEMATICS = trivkins
JOINTS = 3
# Axes sections ---------------
[AXIS_X]
MAX_VELOCITY = 4
MAX_ACCELERATION = 100.0
MIN_LIMIT = -10.0
MAX_LIMIT = 10.0
[AXIS_Y]
MAX_VELOCITY = 4
MAX_ACCELERATION = 100.0
MIN_LIMIT = -10.0
MAX_LIMIT = 10.0
[AXIS_Z]
MAX_VELOCITY = 4
MAX_ACCELERATION = 100.0
MIN_LIMIT = -8.0
MAX_LIMIT = 0.12
# Joints sections -------------
[JOINT_0]
TYPE = LINEAR
HOME = 0.000
MAX_VELOCITY = 5
MAX_ACCELERATION = 50.0
BACKLASH = 0.000
INPUT_SCALE = 4000
OUTPUT_SCALE = 1.000
FERROR = 0.050
MIN_FERROR = 0.010
MIN_LIMIT = -10.0
MAX_LIMIT = 10.0
HOME_OFFSET = 0.0
HOME_SEARCH_VEL = 0
HOME_LATCH_VEL = 0
HOME_USE_INDEX = YES
HOME_IGNORE_LIMITS = NO
HOME_SEQUENCE = 1
HOME_IS_SHARED = 1
[JOINT_1]
TYPE = LINEAR
HOME = 0.000
MAX_VELOCITY = 5
MAX_ACCELERATION = 50.0
BACKLASH = 0.000
INPUT_SCALE = 4000
OUTPUT_SCALE = 1.000
FERROR = 0.050
MIN_FERROR = 0.010
MIN_LIMIT = -10.0
MAX_LIMIT = 10.0
HOME_OFFSET = 0.0
HOME_SEARCH_VEL = 0
HOME_LATCH_VEL = 0
HOME_USE_INDEX = YES
HOME_IGNORE_LIMITS = NO
HOME_SEQUENCE = 1
[JOINT_2]
TYPE = LINEAR
HOME = 0.0
MAX_VELOCITY = 5
MAX_ACCELERATION = 50.0
BACKLASH = 0.000
INPUT_SCALE = 4000
OUTPUT_SCALE = 1.000
MIN_LIMIT = -8.0
# Normally the Z max should be 0.000!
# The only reason it's greater than 0 here is so that the splash screen
# gcode will run.
MAX_LIMIT = 0.12
FERROR = 0.50
MIN_FERROR = 0.10
HOME_OFFSET = 1.0
HOME_SEARCH_VEL = 0
HOME_LATCH_VEL = 0.0
HOME_USE_INDEX = YES
HOME_IGNORE_LIMITS = NO
HOME_SEQUENCE = 0
HOME_IS_SHARED = 1

View File

@@ -0,0 +1,36 @@
loadrt [KINS]KINEMATICS
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS
loadusr -W lcec_conf ethercat-conf.xml
loadrt lcec
###########################################################
# Functions servo-thread
###########################################################
addf lcec.read-all servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf lcec.write-all servo-thread
#########################################
#nets
#########################################
net emc-enable => iocontrol.0.emc-enable-in
sets emc-enable 1
net x-enable joint.0.amp-enable-out lcec.0.E3000.enable1-0
net x-pos-cmd joint.0.motor-pos-cmd lcec.0.E3000.commandedPosition1
net x-pos-fb joint.0.motor-pos-fb lcec.0.E3000.actualPosition1
net y-enable joint.1.amp-enable-out lcec.0.E3000.enable2-0
net y-pos-cmd joint.1.motor-pos-cmd lcec.0.E3000.commandedPosition2
net y-pos-fb joint.1.motor-pos-fb lcec.0.E3000.actualPosition2
net z-enable joint.2.amp-enable-out lcec.0.E3000.enable3-0
net z-pos-cmd joint.2.motor-pos-cmd lcec.0.E3000.commandedPosition3
net z-pos-fb joint.2.motor-pos-fb lcec.0.E3000.actualPosition3

View File

@@ -0,0 +1,95 @@
<masters>
<master idx="0" appTimePeriod="1000000" refClockSyncCycles="1000">
<slave idx="0" type="generic" vid="0xd0bed1d0" pid="0x00003000" name="E3000" configPdos="true">
<!--dcConf assignActivate="300" sync0Cycle="*1" sync0Shift="0"/-->
<!--MetalMusings EaserCAT 3000-->
<sdoConfig idx="2000" subIdx="0"><sdoDataRaw data ="10 27 00 00"/></sdoConfig> <!-- Base period (ns) 10000 (100 kHz) -->
<sdoConfig idx="2001" subIdx="0"><sdoDataRaw data ="00 00 48 43"/></sdoConfig> <!-- Steps per mm stepper 1. 200.0 = 43 48 00 00, use ieee float to hex converter -->
<sdoConfig idx="2002" subIdx="0"><sdoDataRaw data ="00 00 96 43"/></sdoConfig> <!-- Steps per mm stepper 2. 300.0 = 43 96 00 00, use ieee float to hex converter -->
<sdoConfig idx="2003" subIdx="0"><sdoDataRaw data ="00 00 96 c3"/></sdoConfig> <!-- Steps per mm stepper 3. -300.0 = c3 96 00 00, use ieee float to hex converter -->
<sdoConfig idx="2004" subIdx="0"><sdoDataRaw data ="00 00 fa c3"/></sdoConfig> <!-- Steps per mm stepper 4. -500.0 = c3 fa 00 00, use ieee float to hex converter -->
<!--MetalMusings EaserCAT 3000-->
<syncManager idx="0" dir="in"/>
<syncManager idx="1" dir="out"/>
<syncManager idx="2" dir="out">
<pdo idx="1600">
<!--Scale-->
<pdoEntry idx="7000" subIdx="00" bitLen="32" halPin="scale" halType="float-ieee"/>
</pdo>
<pdo idx="1601">
<!--Output4-->
<pdoEntry idx="7001" subIdx="00" bitLen="8" halPin="output4" halType="bit"/>
</pdo>
<pdo idx="1602">
<!--CommandedPosition1-->
<pdoEntry idx="7002" subIdx="00" bitLen="8" halPin="enable1" halType="bit"/>
</pdo>
<pdo idx="1603">
<!--CommandedPosition2-->
<pdoEntry idx="7003" subIdx="00" bitLen="8" halPin="enable2" halType="bit"/>
</pdo>
<pdo idx="1604">
<!--CommandedPosition3-->
<pdoEntry idx="7004" subIdx="00" bitLen="8" halPin="enable3" halType="bit"/>
</pdo>
<pdo idx="1605">
<!--CommandedPosition4-->
<pdoEntry idx="7005" subIdx="00" bitLen="8" halPin="enable4" halType="bit"/>
</pdo>
<pdo idx="1606">
<!--Enable1-->
<pdoEntry idx="7006" subIdx="00" bitLen="32" halPin="commandedPosition1" halType="float-ieee"/>
</pdo>
<pdo idx="1607">
<!--Enable2-->
<pdoEntry idx="7007" subIdx="00" bitLen="32" halPin="commandedPosition2" halType="float-ieee"/>
</pdo>
<pdo idx="1608">
<!--Enable3-->
<pdoEntry idx="7008" subIdx="00" bitLen="32" halPin="commandedPosition3" halType="float-ieee"/>
</pdo>
<pdo idx="1609">
<!--Enable4-->
<pdoEntry idx="7009" subIdx="00" bitLen="32" halPin="commandedPosition4" halType="float-ieee"/>
</pdo>
<pdo idx="160a">
<!--EncoderIn-->
<pdoEntry idx="700a" subIdx="01" bitLen="8" halPin="indexstatus" halType="u32"/>
<pdoEntry idx="700a" subIdx="02" bitLen="8" halPin="indexbyte" halType="u32"/>
<pdoEntry idx="700a" subIdx="03" bitLen="32" halPin="position" halType="float-ieee"/>
<pdoEntry idx="700a" subIdx="04" bitLen="32" halPin="out-frequency" halType="float-ieee"/>
</pdo>
</syncManager>
<syncManager idx="3" dir="in">
<pdo idx="1a00">
<!--Velocity-->
<pdoEntry idx="6000" subIdx="00" bitLen="32" halPin="velocity" halType="float-ieee"/>
</pdo>
<pdo idx="1a01">
<!--Frequency-->
<pdoEntry idx="6001" subIdx="00" bitLen="32" halPin="in-frequency" halType="float-ieee"/>
</pdo>
<pdo idx="1a02">
<!--Input8-->
<pdoEntry idx="6002" subIdx="00" bitLen="8" halPin="input8" halType="bit"/>
</pdo>
<pdo idx="1a03">
<!--ActualPosition1-->
<pdoEntry idx="6003" subIdx="00" bitLen="32" halPin="actualPosition1" halType="float-ieee"/>
</pdo>
<pdo idx="1a04">
<!--ActualPosition2-->
<pdoEntry idx="6004" subIdx="00" bitLen="32" halPin="actualPosition2" halType="float-ieee"/>
</pdo>
<pdo idx="1a05">
<!--ActualPosition3-->
<pdoEntry idx="6005" subIdx="00" bitLen="32" halPin="actualPosition3" halType="float-ieee"/>
</pdo>
<pdo idx="1a06">
<!--ActualPosition4-->
<pdoEntry idx="6006" subIdx="00" bitLen="32" halPin="actualPosition4" halType="float-ieee"/>
</pdo>
</syncManager>
</slave>
</master>
</masters>

View File

@@ -1,106 +0,0 @@
<slave idx="0" name="E3000" type="generic" vid="0xd0bed1d0" pid="0x00003000">
<!--MetalMusings EaserCAT 3000-->
<dcConf assignActivate="300" sync0Cycle="*1" sync0Shift="0"/>
<sdoConfig idx="2000" subIdx="0"><sdoDataRaw data ="10 27 00 00"/></sdoConfig> <!-- Base period (ns) 10000 (100 kHz) -->
<syncManager idx="0" dir="in"/>
<syncManager idx="1" dir="out"/>
<syncManager idx="2" dir="out">
<pdo idx="1600">
<pdoEntry idx="7000" subIdx="00" bitLen="32" halPin="Scale" halType="float-ieee"/>
</pdo>
<pdo idx="1601">
<pdoEntry idx="7001" subIdx="00" bitLen="8" halType="complex">
<complexEntry bitLen="1" halPin="out-1" halType="bit"/>
<complexEntry bitLen="1" halPin="out-2" halType="bit"/>
<complexEntry bitLen="1" halPin="out-3" halType="bit"/>
<complexEntry bitLen="1" halPin="out-4" halType="bit"/>
</pdoEntry>
</pdo>
<pdo idx="1602">
<pdoEntry idx="7002" subIdx="00" bitLen="32" halPin="CommandedPosition1" halType="float-ieee"/>
</pdo>
<pdo idx="1603">
<pdoEntry idx="7003" subIdx="00" bitLen="32" halPin="CommandedPosition2" halType="float-ieee"/>
</pdo>
<pdo idx="1604">
<pdoEntry idx="7004" subIdx="00" bitLen="32" halPin="CommandedPosition3" halType="float-ieee"/>
</pdo>
<pdo idx="1605">
<pdoEntry idx="7005" subIdx="00" bitLen="32" halPin="CommandedPosition4" halType="float-ieee"/>
</pdo>
<pdo idx="1606">
<pdoEntry idx="7006" subIdx="00" bitLen="32" halPin="StepsPerMM1" halType="float-ieee"/>
</pdo>
<pdo idx="1607">
<pdoEntry idx="7007" subIdx="00" bitLen="32" halPin="StepsPerMM2" halType="float-ieee"/>
</pdo>
<pdo idx="1608">
<pdoEntry idx="7008" subIdx="00" bitLen="32" halPin="StepsPerMM3" halType="float-ieee"/>
</pdo>
<pdo idx="1609">
<pdoEntry idx="7009" subIdx="00" bitLen="32" halPin="StepsPerMM4" halType="float-ieee"/>
</pdo>
<pdo idx="160a">
<pdoEntry idx="700a" subIdx="00" bitLen="32" halPin="MaxAcceleration1" halType="float-ieee"/>
</pdo>
<pdo idx="160b">
<pdoEntry idx="700b" subIdx="00" bitLen="32" halPin="MaxAcceleration2" halType="float-ieee"/>
</pdo>
<pdo idx="160c">
<pdoEntry idx="700c" subIdx="00" bitLen="32" halPin="MaxAcceleration3" halType="float-ieee"/>
</pdo>
<pdo idx="160d">
<pdoEntry idx="700d" subIdx="00" bitLen="32" halPin="MaxAcceleration4" halType="float-ieee"/>
</pdo>
<pdo idx="160e">
<pdoEntry idx="700e" subIdx="00" bitLen="8" halPin="Enable1" halType="bit"/>
</pdo>
<pdo idx="160f">
<pdoEntry idx="700f" subIdx="00" bitLen="8" halPin="Enable2" halType="bit"/>
</pdo>
<pdo idx="1610">
<pdoEntry idx="7010" subIdx="00" bitLen="8" halPin="Enable3" halType="bit"/>
</pdo>
<pdo idx="1611">
<pdoEntry idx="7011" subIdx="00" bitLen="8" halPin="Enable4" halType="bit"/>
</pdo>
</syncManager>
<syncManager idx="3" dir="in">
<pdo idx="1a00">
<pdoEntry idx="6000" subIdx="01" bitLen="32" halPin="Velocity" halType="float-ieee"/>
</pdo>
<pdo idx="1a01">
<pdoEntry idx="6001" subIdx="01" bitLen="32" halPin="Frequency" halType="float-ieee"/>
</pdo>
<pdo idx="1a01">
<pdoEntry idx="6001" subIdx="01" bitLen="8" halPin="DI1" halType="u32"/>
<pdoEntry idx="6001" subIdx="02" bitLen="8" halPin="DI2" halType="u32"/>
<pdoEntry idx="6001" subIdx="03" bitLen="8" halPin="DI3" halType="u32"/>
<pdoEntry idx="6001" subIdx="04" bitLen="8" halPin="DI4" halType="u32"/>
</pdo>
<pdo idx="1a02">
<pdoEntry idx="6002" subIdx="00" bitLen="8" halType="complex">
<complexEntry bitLen="1" halPin="in-1" halType="bit"/>
<complexEntry bitLen="1" halPin="in-2" halType="bit"/>
<complexEntry bitLen="1" halPin="in-3" halType="bit"/>
<complexEntry bitLen="1" halPin="in-4" halType="bit"/>
<complexEntry bitLen="1" halPin="in-5" halType="bit"/>
<complexEntry bitLen="1" halPin="in-6" halType="bit"/>
<complexEntry bitLen="1" halPin="in-7" halType="bit"/>
<complexEntry bitLen="1" halPin="in-8" halType="bit"/>
</pdoEntry>
</pdo>
<pdo idx="1a03">
<pdoEntry idx="6003" subIdx="01" bitLen="32" halPin="ActualPosition1" halType="float-ieee"/>
</pdo>
<pdo idx="1a04">
<pdoEntry idx="6004" subIdx="01" bitLen="32" halPin="ActualPosition2" halType="float-ieee"/>
</pdo>
<pdo idx="1a05">
<pdoEntry idx="6005" subIdx="01" bitLen="32" halPin="ActualPosition3" halType="float-ieee"/>
</pdo>
<pdo idx="1a06">
<pdoEntry idx="6006" subIdx="01" bitLen="32" halPin="ActualPosition4" halType="float-ieee"/>
</pdo>
</syncManager>
</slave>