Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions configs/sim/axis/sim-latency-test-base-and-servo/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Axis simulator with built in base-thread and servo-thread latency test running in parallel

232 changes: 232 additions & 0 deletions configs/sim/axis/sim-latency-test-base-and-servo/axis_mm.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
# 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 = $Revision$

# Name of machine, for use with display, etc.
MACHINE = Machinekit Latency test simulator

# 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., xemc
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
# Prefix to be used
PROGRAM_PREFIX = ../../../nc_files/

# Introductory graphic
INTRO_GRAPHIC = machinekit.gif
INTRO_TIME = 10

EDITOR = gedit

INCREMENTS = 1 mm, .01 in, .1mm, 1 mil, .1 mil, 1/8000 in
[FILTER]
PROGRAM_EXTENSION = .png,.gif,.jpg Grayscale Depth Image
PROGRAM_EXTENSION = *.py Python Script
PROGRAM_EXTENSION = .dxf,.DXF 2D ACad/QCad Drawing
PROGRAM_FILTER = python2.7
dxf = /root/emc2/configs/#<hal-test-sim/dxf2gcode.py
DXF = dxf2gcode.py
png = image-to-gcode
gif = image-to-gcode
jpg = image-to-gcode
py = python2.7

[USER_COMMANDS]
USER0 = #-f sample.hal
USER1 = G0 X0 Y0 Z0
USER2 = G0 X5 Y5 Z5
USER3 = G0 X10 Y10 Z10
USER4 = G0 X15 Y15 Z15
USER5 = G0 X20 Y20 Z20
USER6 = G0 X25 Y25
USER7 = G0 X30 Y30
USER8 = $firefox "www.machinekit.io"
USER9 = $gedit
NUMBERKEYS = NO
DISABLE_PREVIEW = NO
LOAD_LASTFILE = YES


# 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]

FEATURES = 12

# File containing interpreter variables
PARAMETER_FILE = sim_mm.var

# Motion control section ------------------------------------------------------
[EMCMOT]

EMCMOT = motmod

# Timeout for comm to emcmot, in seconds
COMM_TIMEOUT = 1.0

# Interval between tries to emcmot, in seconds
COMM_WAIT = 0.010

# BASE_PERIOD is unused in this configuration but specified in core_sim.hal
BASE_PERIOD = 25000
# Servo task period, in nano-seconds
SERVO_PERIOD = 1000000

# 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 = core_sim.hal
HALFILE = sim_spindle_encoder.hal
HALFILE = simulated_home.hal
HALFILE = lat.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 =

HALUI = halui

# Trajectory planner section --------------------------------------------------
[TRAJ]

AXES = 3
COORDINATES = X Y Z
HOME = 0 0 0
LINEAR_UNITS = mm
ANGULAR_UNITS = degree
CYCLE_TIME = 0.010
DEFAULT_VELOCITY = 30.48
MAX_VELOCITY = 53.34
DEFAULT_ACCELERATION = 508
MAX_ACCELERATION = 508
POSITION_FILE = position_mm.txt

# Axes sections ---------------------------------------------------------------

# First axis
[AXIS_0]

TYPE = LINEAR
HOME = 0.000
MAX_VELOCITY = 30.48
MAX_ACCELERATION = 508
BACKLASH = 0.000
INPUT_SCALE = 157.48
OUTPUT_SCALE = 1.000
MIN_LIMIT = -9999
MAX_LIMIT = 9999
FERROR = 1.27
MIN_FERROR = .254
HOME_OFFSET = 0.0
HOME_SEARCH_VEL = 127
HOME_LATCH_VEL = 25.4
HOME_USE_INDEX = NO
HOME_IGNORE_LIMITS = NO
HOME_SEQUENCE = 1
HOME_IS_SHARED = 1

# Second axis
[AXIS_1]

TYPE = LINEAR
HOME = 0.000
MAX_VELOCITY = 30.48
MAX_ACCELERATION = 508
BACKLASH = 0.000
INPUT_SCALE = 157.48
OUTPUT_SCALE = 1.000
MIN_LIMIT = -9999
MAX_LIMIT = 9999
FERROR = 1.27
MIN_FERROR = .254
HOME_OFFSET = 0.0
HOME_SEARCH_VEL = 127
HOME_LATCH_VEL = 25.4
HOME_USE_INDEX = NO
HOME_IGNORE_LIMITS = NO
HOME_SEQUENCE = 1

# Third axis
[AXIS_2]

TYPE = LINEAR
HOME = 0.0
MAX_VELOCITY = 30.48
MAX_ACCELERATION = 508
BACKLASH = 0.000
INPUT_SCALE = 157.48
OUTPUT_SCALE = 1.000
MIN_LIMIT = -9999
MAX_LIMIT = 9999
FERROR = 1.27
MIN_FERROR = .254
HOME_OFFSET = 25.4
HOME_SEARCH_VEL = 127
HOME_LATCH_VEL = 25.4
HOME_USE_INDEX = NO
HOME_IGNORE_LIMITS = NO
HOME_SEQUENCE = 0
HOME_IS_SHARED = 1

# 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_mm.tbl
TOOL_CHANGE_POSITION = 0 0 50.8

[IOTOOL]

IOTOOL = iocontrol

Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# HAL config file to check vel/acc constraints
#
loadrt wcomp names=wcomp_xacc,wcomp_xvel,wcomp_yacc,wcomp_yvel,wcomp_zacc,wcomp_zvel

addf wcomp_xacc servo-thread
addf wcomp_xvel servo-thread
addf wcomp_yacc servo-thread
addf wcomp_yvel servo-thread
addf wcomp_zacc servo-thread
addf wcomp_zvel servo-thread

net Xacc => wcomp_xacc.in
net Xvel => wcomp_xvel.in
net Yacc => wcomp_yacc.in
net Yvel => wcomp_yvel.in
net Zacc => wcomp_zacc.in
net Zvel => wcomp_zvel.in

net acc-ok-x <= wcomp_xacc.out
net vel-ok-x <= wcomp_xvel.out
net acc-ok-y <= wcomp_yacc.out
net vel-ok-y <= wcomp_yvel.out
net acc-ok-z <= wcomp_zacc.out
net vel-ok-z <= wcomp_zvel.out

setp wcomp_xacc.max 50.001
setp wcomp_xacc.min -50.001
setp wcomp_xvel.max 5.001
setp wcomp_xvel.min -5.001
setp wcomp_yacc.max 50.001
setp wcomp_yacc.min -50.001
setp wcomp_yvel.max 5.001
setp wcomp_yvel.min -5.001
setp wcomp_zacc.max 50.001
setp wcomp_zacc.min -50.001
setp wcomp_zvel.max 5.001
setp wcomp_zvel.min -5.001

loadrt match8 names=match_all

addf match_all servo-thread

net acc-ok-x => match_all.a0
setp match_all.b0 1
net vel-ok-x => match_all.a1
setp match_all.b1 1
net acc-ok-y => match_all.a2
setp match_all.b2 1
net vel-ok-y => match_all.a3
setp match_all.b3 1
net acc-ok-z => match_all.a4
setp match_all.b4 1
net vel-ok-z => match_all.a5
setp match_all.b5 1

setp match_all.a6 0
setp match_all.a7 0
setp match_all.b6 0
setp match_all.b7 0

setp match_all.in 1

net constraints-ok <= match_all.out
56 changes: 56 additions & 0 deletions configs/sim/axis/sim-latency-test-base-and-servo/core_sim.hal
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# core HAL config file for simulation

# first load all the RT modules that will be needed
# kinematics
loadrt trivkins
loadrt tp
# motion controller, get name and thread periods from ini file
loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES kins=trivkins tp=tp
# load 6 differentiators (for velocity and accel signals
loadrt ddt names=ddt_x,ddt_xv,ddt_y,ddt_yv,ddt_z,ddt_zv
# load additional blocks
loadrt hypot names=vel_xy,vel_xyz

# add motion controller functions to servo thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
# link the differentiator functions into the code
addf ddt_x servo-thread
addf ddt_xv servo-thread
addf ddt_y servo-thread
addf ddt_yv servo-thread
addf ddt_z servo-thread
addf ddt_zv servo-thread
addf vel_xy servo-thread
addf vel_xyz servo-thread

# create HAL signals for position commands from motion module
# loop position commands back to motion module feedback
net Xpos axis.0.motor-pos-cmd => axis.0.motor-pos-fb ddt_x.in
net Ypos axis.1.motor-pos-cmd => axis.1.motor-pos-fb ddt_y.in
net Zpos axis.2.motor-pos-cmd => axis.2.motor-pos-fb ddt_z.in

# send the position commands thru differentiators to
# generate velocity and accel signals
net Xvel ddt_x.out => ddt_xv.in vel_xy.in0
net Xacc <= ddt_xv.out
net Yvel ddt_y.out => ddt_yv.in vel_xy.in1
net Yacc <= ddt_yv.out
net Zvel ddt_z.out => ddt_zv.in vel_xyz.in0
net Zacc <= ddt_zv.out

# Cartesian 2- and 3-axis velocities
net XYvel vel_xy.out => vel_xyz.in1
net XYZvel <= vel_xyz.out

# estop loopback
net estop-loop iocontrol.0.user-enable-out iocontrol.0.emc-enable-in

# create signals for tool loading loopback
net tool-prep-loop iocontrol.0.tool-prepare iocontrol.0.tool-prepared
net tool-change-loop iocontrol.0.tool-change iocontrol.0.tool-changed


#net Xpos => sampler.0.pin.0
#net Ypos => sampler.1.pin.0
#net Zpos => sampler.2.pin.0
15 changes: 15 additions & 0 deletions configs/sim/axis/sim-latency-test-base-and-servo/lat.hal
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
loadrt timedelta count=2
addf timedelta.1 servo-thread
addf timedelta.0 base-thread

loadusr -Wn lat pyvcp lat.xml
net sl timedelta.1.max => lat.sl
net sj timedelta.1.jitter => lat.sj
net st timedelta.1.out => lat.st
net sv timedelta.1.avgerr => lat.sv
net bl timedelta.0.max => lat.bl
net bj timedelta.0.jitter => lat.bj
net bt timedelta.0.out => lat.bt
net bv timedelta.0.avgerr => lat.bv
net reset lat.reset => timedelta.0.reset timedelta.1.reset

12 changes: 12 additions & 0 deletions configs/sim/axis/sim-latency-test-base-and-servo/lat.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<pyvcp>
<title title="Machinekit - Inline Latency Test"/>
<axisoptions/>
<table>
<tablerow/><tablespan columns="6"/><label wraplength="6i" justify="left">
</label>
<tablerow/><label/><label text="Max Interval (ns)" font="Helvetica 12"/><label text="Max Jitter (ns)" font="Helvetica 12 bold"/><label text="Last interval (ns)" font="Helvetica 12"/><label text="Average Jitter(ns)" font="Helvetica 12 bold"/><label text=" "/>
<tablerow/><label text="Servo thread :"/><s32 halpin="sl"/><s32 halpin="sj" font="Helvetica 12 bold"/><s32 halpin="st"/><s32 halpin="sv" font="Helvetica 12 bold"/>
<tablerow/><label text="Base thread :"/><s32 halpin="bl"/><s32 halpin="bj" font="Helvetica 12 bold"/><s32 halpin="bt"/><s32 halpin="bv" font="Helvetica 12 bold"/>
<tablerow/><button text="Reset Statistics" halpin="reset"/>
</table>
</pyvcp>
Loading