Files
linuxcncAllWasm/configs/sim/axis/axis_mm_scurve.ini
2026-08-20 06:17:39 +08:00

277 lines
8.7 KiB
INI

# ========================================================
# S-CURVE MOTION PLANNING CONFIGURATION EXAMPLE
# ========================================================
#
# This file demonstrates how to configure S-curve (jerk-limited)
# motion planning in LinuxCNC. S-curve planning produces smoother
# acceleration profiles that can reduce machine vibration and
# improve surface finish.
#
# IMPORTANT: S-curve planning is OPTIONAL.
# Traditional trapezoidal acceleration is used when:
# - PLANNER_TYPE = 0, OR
# - MAX_LINEAR_JERK = 0
#
# NOTE: If MAX_LINEAR_JERK is not specified, it defaults to 1e9 (1 billion),
# which effectively disables jerk limiting while still using S-curve calculations.
# This produces motion similar to trapezoidal but not identical.
#
# ========================================================
[EMC]
VERSION = 1.1
MACHINE = scurve_example
DEBUG = 0
[DISPLAY]
JOG_AXES = XYZ
GEOMETRY = XYZ
DISPLAY = axis
CYCLE_TIME = 0.200
POSITION_OFFSET = RELATIVE
POSITION_FEEDBACK = ACTUAL
MAX_FEED_OVERRIDE = 2.0
PROGRAM_PREFIX = M-Codes
INTRO_GRAPHIC = linuxcnc.gif
INTRO_TIME = 5
EDITOR = gedit
[EMCMOT]
EMCMOT = motmod
COMM_TIMEOUT = 1.0
COMM_WAIT = 0.010
BASE_PERIOD = 150000
SERVO_PERIOD = 1000000
[TASK]
TASK = milltask
CYCLE_TIME = 0.010
[HAL]
HALUI = halui
HALFILE = axis_mm_scurve.hal
[TRAJ]
# --------------------------------------------------------
# S-curve Planner Configuration
# --------------------------------------------------------
# PLANNER_TYPE: Select the acceleration profile shape
# 0 = Trapezoidal (traditional - constant acceleration)
# 1 = S-curve (smoother - limited jerk/derivative of acceleration)
# Default: 0 (trapezoidal)
#
# NOTE: This parameter can be changed at RUNTIME via HAL pin:
# ini.traj_planner_type (allows switching on-the-fly)
PLANNER_TYPE = 1
# MAX_LINEAR_JERK: Maximum rate of change of acceleration
# Units: machine-units/second^3 (e.g., mm/s^3 or inch/s^3)
#
# Setting this to 0 disables S-curve planning regardless of PLANNER_TYPE
# If not specified, defaults to 1e9 (effectively no jerk limiting)
# Maximum allowed value is 1e9 (values above are automatically clamped)
#
# Recommended starting values (adjust based on your machine):
# - Light/rigid machines: 1000-10000
# - Heavy/flexible machines: 100-1000
# - Very rigid machines: 10000-100000
#
# Higher values = sharper acceleration changes (closer to trapezoidal)
# Lower values = smoother acceleration changes (more gradual)
#
# NOTE: This parameter can be changed at RUNTIME via HAL pin:
# ini.traj_max_jerk (allows tuning on-the-fly)
MAX_LINEAR_JERK = 10000.0
# --------------------------------------------------------
# Standard TRAJ parameters (still required with S-curve)
# --------------------------------------------------------
COORDINATES = X Y Z
LINEAR_UNITS = mm
ANGULAR_UNITS = deg
CYCLE_TIME = 0.010
DEFAULT_LINEAR_VELOCITY = 100.0
MAX_LINEAR_VELOCITY = 300.0
DEFAULT_LINEAR_ACCELERATION = 500.0
MAX_LINEAR_ACCELERATION = 1000.0
# to be able to run gcodes and MDI without homing
NO_FORCE_HOMING = 1
ARC_BLEND_ENABLE = 1
ARC_BLEND_FALLBACK_ENABLE = 0
ARC_BLEND_OPTIMIZATION_DEPTH = 50
ARC_BLEND_RAMP_FREQ = 20
ARC_BLEND_GAP_CYCLES = 4
[EMCIO]
EMCIO = io
CYCLE_TIME = 0.100
[KINS]
# 5axiskins misnomer 1 more joint for W
KINEMATICS = trivkins
JOINTS = 3
[RS274NGC]
# File containing interpreter variables
PARAMETER_FILE = scurve_example.var
# ========================================================
# JOINT CONFIGURATION
# ========================================================
# Each joint can have its own jerk limit. If not specified,
# the joint uses the axis/trajectory jerk limits.
[JOINT_0]
TYPE = LINEAR
HOME = 0.0
MAX_VELOCITY = 300.0
MAX_ACCELERATION = 1000.0
HOME_SEQUENCE = 0
# MAX_JERK: Maximum jerk for this joint
# Units: machine-units/second^3
# Default: 0.0 (disabled, uses trapezoidal)
#
# This should match or be higher than the trajectory jerk
# to avoid limiting coordinated motion.
MAX_JERK = 10000.0
#MIN_LIMIT = -200.0 #disabled to give more space for testing g-codes
#MAX_LIMIT = 200.0 #disabled to give more space for testing g-codes
# ========================================================
# HOMING CONFIGURATION FOR S-CURVE
# ========================================================
# WARNING: When using S-curve motion (PLANNER_TYPE=1), you MUST set
# HOME_SEARCH_VEL and HOME_LATCH_VEL significantly SLOWER than you
# would with trapezoidal motion planning.
#
# S-curve motion requires MORE DISTANCE to decelerate due to the
# jerk-limited acceleration profile. If homing velocities are too
# high, the axis may overshoot and hit hard limits or sensor limits.
#
# RECOMMENDED: Start with 50% or less of the velocities you would
# use with trapezoidal planning, then increase cautiously.
#
# Example homing configuration (adjust for your machine):
#HOME_SEARCH_VEL = 5.0 # Velocity for initial limit switch search
#HOME_LATCH_VEL = 1.0 # Velocity for precise homing (slower)
#HOME_OFFSET = 0.0 # Distance from switch to home position
#HOME_USE_INDEX = NO # Use encoder index pulse for homing
#HOME_IGNORE_LIMITS = NO # Ignore limit switches during homing move
# ========================================================
[JOINT_1]
TYPE = LINEAR
HOME = 0.0
MAX_VELOCITY = 300.0
MAX_ACCELERATION = 1000.0
MAX_JERK = 10000.0
#MIN_LIMIT = -200.0 #disabled to give more space for testing g-codes
#MAX_LIMIT = 200.0 #disabled to give more space for testing g-codes
HOME_SEQUENCE = 0
# WARNING: S-curve homing requires SLOWER velocities than trapezoidal!
# See JOINT_0 for detailed homing configuration examples.
#HOME_SEARCH_VEL = 5.0
#HOME_LATCH_VEL = 1.0
[JOINT_2]
TYPE = LINEAR
HOME = 0.0
MAX_VELOCITY = 200.0
MAX_ACCELERATION = 800.0
MAX_JERK = 10000.0
#MIN_LIMIT = -100.0 #disabled to give more space for testing g-codes
#MAX_LIMIT = 100.0 #disabled to give more space for testing g-codes
HOME_SEQUENCE = 0
# WARNING: S-curve homing requires SLOWER velocities than trapezoidal!
# See JOINT_0 for detailed homing configuration examples.
#HOME_SEARCH_VEL = 4.0
#HOME_LATCH_VEL = 0.8
# ========================================================
# AXIS CONFIGURATION
# ========================================================
[AXIS_X]
#MIN_LIMIT = -200.0 #disabled to give more space for testing g-codes
#MAX_LIMIT = 200.0 #disabled to give more space for testing g-codes
MAX_VELOCITY = 300.0
MAX_ACCELERATION = 1000.0
# MAX_JERK: Maximum jerk for coordinated motion on this axis
# Units: machine-units/second^3
# Default: 0.0 (disabled)
MAX_JERK = 10000.0
[AXIS_Y]
#MIN_LIMIT = -200.0 #disabled to give more space for testing g-codes
#MAX_LIMIT = 200.0 #disabled to give more space for testing g-codes
MAX_VELOCITY = 300.0
MAX_ACCELERATION = 1000.0
MAX_JERK = 10000.0
[AXIS_Z]
#MIN_LIMIT = -100.0 #disabled to give more space for testing g-codes
#MAX_LIMIT = 100.0 #disabled to give more space for testing g-codes
MAX_VELOCITY = 200.0
MAX_ACCELERATION = 800.0
MAX_JERK = 10000.0
# ========================================================
# TUNING GUIDELINES
# ========================================================
#
# 1. START WITH TRAPEZOIDAL (PLANNER_TYPE=0)
# - Verify your machine works correctly with traditional planning
# - Note any vibration or resonance issues
#
# 2. ENABLE S-CURVE WITH CONSERVATIVE VALUES
# - Set PLANNER_TYPE = 1
# - Start with low MAX_LINEAR_JERK (e.g., 100-500)
# - Jerk should typically be 10-100x your acceleration value
#
# 3. GRADUALLY INCREASE JERK
# - Increase MAX_LINEAR_JERK in steps of 2-3x
# - Test with simple moves and observe:
# * Motor current/torque
# * Vibration levels
# * Following errors
# * Surface finish quality
#
# 4. FIND OPTIMAL VALUE
# - Too low: Motion becomes sluggish, cycle time increases
# - Too high: Approaches trapezoidal behavior, loses smoothness
# - Optimal: Smooth motion without excessive deceleration
#
# 5. VERIFY COORDINATED MOTION
# - Test circular interpolation (G2/G3)
# - Check complex 3D toolpaths
# - Verify axis jerk limits don't constrain trajectory jerk
#
# ========================================================
# TROUBLESHOOTING
# ========================================================
#
# SYMPTOM: No difference between PLANNER_TYPE=0 and PLANNER_TYPE=1
# SOLUTION: Verify MAX_LINEAR_JERK > 0 and MAX_JERK > 0 for all joints/axes
#
# SYMPTOM: Motion is too slow with S-curve enabled
# SOLUTION: Increase MAX_LINEAR_JERK value
#
# SYMPTOM: Following errors increase with S-curve
# SOLUTION: Decrease MAX_LINEAR_JERK or increase PID I-gain
#
# SYMPTOM: Vibration/resonance at certain speeds
# SOLUTION: Adjust MAX_LINEAR_JERK to avoid resonant frequencies
# Consider using different jerk values for different axes
#
# ========================================================