Skip to content

Commit

Permalink
Use local instead of LIB:core_sim and define num_spindles based on te…
Browse files Browse the repository at this point in the history
…st config. Fix [JOINT_0] velocity and accel. Add [EMC]MACHINE to reduce warnings. Add [TRAJ]SPINDLES to tighten tests.
  • Loading branch information
JTrantow authored and andypugh committed Jan 5, 2025
1 parent a930c5c commit 53f4b7a
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 2 deletions.
51 changes: 51 additions & 0 deletions tests/linuxcncrsh/core_sim.hal
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# core HAL config file for simulation

# first load all the RT modules that will be needed
# kinematics
loadrt [KINS]KINEMATICS
# 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=[KINS]JOINTS num_spindles=[TRAJ]SPINDLES
# 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 joint.0.motor-pos-cmd => joint.0.motor-pos-fb ddt_x.in
net Ypos joint.1.motor-pos-cmd => joint.1.motor-pos-fb ddt_y.in
net Zpos joint.2.motor-pos-cmd => joint.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

6 changes: 4 additions & 2 deletions tests/linuxcncrsh/linuxcncrsh-test.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[EMC]
MACHINE = linuxcncrsh-test
VERSION = 1.1
DEBUG = 0x7FFFFFFF
RCS_DEBUG = 0xEF67FFFF
Expand Down Expand Up @@ -57,12 +58,13 @@ MAX_ACCELERATION = 100.0
[KINS]
KINEMATICS = trivkins
JOINTS = 3
SPINDLES = 2

[JOINT_0]
TYPE = LINEAR
HOME = 0.000
MAX_LINEAR_VELOCITY = 4
MAX_LINEAR_ACCELERATION = 100.0
MAX_VELOCITY = 4
MAX_ACCELERATION = 100.0
BACKLASH = 0.000
INPUT_SCALE = 4000
OUTPUT_SCALE = 1.000
Expand Down

0 comments on commit 53f4b7a

Please sign in to comment.