Import LinuxCNC source tree

This commit is contained in:
Wang Dequan
2026-08-20 06:17:39 +08:00
commit 2c814634c3
9429 changed files with 10556013 additions and 0 deletions

3
tests/lathe/.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
sim.var
sim.var.bak

2
tests/lathe/checkresult Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/sh
exit 0 # test failure is indicated by test.sh exit value

102
tests/lathe/lathe.ini Normal file
View File

@@ -0,0 +1,102 @@
[EMC]
# The version string for this INI file.
VERSION = 1.1
DEBUG = 0x7fffffff
[DISPLAY]
DISPLAY = ./test-ui.py
[FILTER]
#No Content
[RS274NGC]
PARAMETER_FILE = sim.var
USER_M_PATH = ./subs
[EMCMOT]
EMCMOT = motmod
COMM_TIMEOUT = 4.0
BASE_PERIOD = 600000
SERVO_PERIOD = 1000000
[TASK]
TASK = milltask
CYCLE_TIME = 0.001
MDI_QUEUED_COMMANDS=10000
[HAL]
HALFILE = LIB:core_sim.hal
HALFILE = LIB:simulated_home.hal
HALFILE = LIB:lathe.hal
POSTGUI_HALFILE = postgui.hal
[TRAJ]
NO_FORCE_HOMING=1
AXES = 3
COORDINATES = X Z
LINEAR_UNITS = inch
ANGULAR_UNITS = degree
DEFAULT_LINEAR_VELOCITY = 1.2
MAX_LINEAR_VELOCITY = 4
[KINS]
KINEMATICS = trivkins
JOINTS = 3
[AXIS_X]
MIN_LIMIT = -10.0
MAX_LIMIT = 10.0
MAX_VELOCITY = 3.333334
MAX_ACCELERATION = 20.0
[JOINT_0]
TYPE = LINEAR
HOME = 0.000
MAX_VELOCITY = 3.333334
MAX_ACCELERATION = 20.0
BACKLASH = 0.000
INPUT_SCALE = 4000
OUTPUT_SCALE = 1.000
MIN_LIMIT = -10.0
MAX_LIMIT = 10.0
FERROR = 0.050
MIN_FERROR = 0.010
HOME_OFFSET = 1.0
HOME_SEARCH_VEL = 5.0
HOME_LATCH_VEL = 1.0
HOME_USE_INDEX = NO
HOME_IGNORE_LIMITS = NO
HOME_SEQUENCE = 0
[AXIS_Z]
MIN_LIMIT = -2.0
MAX_LIMIT = 4.0
MAX_VELOCITY = 3.333334
MAX_ACCELERATION = 20.0
[JOINT_1]
# JOINT_1: not used, home immediately:
HOME_SEARCH_VEL = 0
HOME_LATCH_VEL = 0
HOME_USE_INDEX = NO
HOME_SEQUENCE = 0
[JOINT_2]
TYPE = LINEAR
HOME = 0.0
MAX_VELOCITY = 3.333334
MAX_ACCELERATION = 20.0
BACKLASH = 0.000
INPUT_SCALE = 4000
OUTPUT_SCALE = 1.000
MIN_LIMIT = -2.0
MAX_LIMIT = 4.0
FERROR = 0.050
MIN_FERROR = 0.010
HOME_OFFSET = 1.0
HOME_SEARCH_VEL = 5.0
HOME_LATCH_VEL = 1.0
HOME_USE_INDEX = NO
HOME_IGNORE_LIMITS = NO
HOME_SEQUENCE = 1

76
tests/lathe/test-ui.py Executable file
View File

@@ -0,0 +1,76 @@
#!/usr/bin/env python3
import linuxcnc
import linuxcnc_util
import hal
import time
import sys
import os
import math
# this is how long we wait for linuxcnc to do our bidding
timeout = 5.0
# unbuffer stdout
sys.stdout = os.fdopen(sys.stdout.fileno(), 'w')
#
# connect to LinuxCNC
#
c = linuxcnc.command()
e = linuxcnc.error_channel()
s = linuxcnc.stat()
l = linuxcnc_util.LinuxCNC(command=c, status=s, error=e)
c.state(linuxcnc.STATE_ESTOP_RESET)
c.state(linuxcnc.STATE_ON)
c.mode(linuxcnc.MODE_MANUAL)
c.home(-1)
l.wait_for_home(joints=[1,0,1,0,0,0,0,0,0])
#
# do some jogs in manual mode
#
l.jog_axis('x', -0.5)
l.jog_axis('x', 0.0)
l.jog_axis('z', -0.5)
l.jog_axis('z', 0.0)
#
# do some MDI commands
#
c.mode(linuxcnc.MODE_MDI)
gcode = 'g0 x2 z2'
print("running gcode: {}".format(gcode))
c.mdi(gcode)
c.wait_complete()
l.wait_for_axis_to_stop_at('x', 2);
l.wait_for_axis_to_stop_at('z', 2);
gcode = 'g0 x-2'
print("running gcode: {}".format(gcode))
c.mdi(gcode)
c.wait_complete()
l.wait_for_axis_to_stop_at('x', -2);
l.wait_for_axis_to_stop_at('z', 2);
gcode = 'g0 z-2'
print("running gcode: {}".format(gcode))
c.mdi(gcode)
c.wait_complete()
l.wait_for_axis_to_stop_at('x', -2);
l.wait_for_axis_to_stop_at('z', -2);
sys.exit(0)

3
tests/lathe/test.sh Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
exec linuxcnc -r lathe.ini