Skip to content

PID Calibration Tool Throws Errors With Variable Name Expansion #4165

@NoGare

Description

@NoGare

Good day,
I'm running into an issue when trying to run the calibration tool (as my servo's need additional tuning). In my view, I feel that this issue might be a result of variable name expansion - where the tool does not like the fact the way I've setup my .HAL file - but I cannot confirm this.
LinuxCNC version: 2.9.8
OS: Debian 13

Steps to Reproduce: Within any GUI, launch the calibration tool. If a refresh is attempted or any value is attempted to be saved - a variation on the below error occurs. If I manually hardcode the value of mesa_pwm_pin instead of using variable expansion, it no longer complains and moves on to complaining about the next use of variable expansion (e.g. 'MESA_encoder_PIN'). 

Expected Behavior: Calibration tool should function without requiring a full edit of my .HAL file.

Thank you in advance for your time, or any work around you can suggest - apologizes if this is simply an error on my end.

Regards -

Error from Calibration Tool:

invalid command name ".main.top.fpage2.next-(mesa_pwm_pin).dither true"
    while executing
"$labelname-$name configure -state $entrystate"
    (procedure "iniTuneButtonpress" line 34)
    invoked from within
"iniTuneButtonpress refresh"
    invoked from within
".main.top.fpage2.buttons.refresh invoke"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 [list $w invoke]"
    (procedure "tk::ButtonUp" line 22)
    invoked from within
"tk::ButtonUp .main.top.fpage2.buttons.refresh"
    (command bound to event)

Offending Lines in .HAL file that error is referencing

#PWM Generator setup
setp hm2_[MESA](BOARD).0.pwmgen.[JOINT_2](MESA_PWM_PIN).dither true
setp hm2_[MESA](BOARD).0.pwmgen.[JOINT_2](MESA_PWM_PIN).output-type 1 #PWM pin0
setp hm2_[MESA](BOARD).0.pwmgen.[JOINT_2](MESA_PWM_PIN).offset-mode 1 # offset mode so 50% = 0
setp hm2_[MESA](BOARD).0.pwmgen.[JOINT_2](MESA_PWM_PIN).scale [JOINT_2]SCALE

# position command and feedback
net joint-2-pos-cmd <= joint.2.motor-pos-cmd
net joint-2-pos-cmd => pid.z.command

net joint-2-pos-fb <= hm2_[MESA](BOARD).0.encoder.[JOINT_2](MESA_encoder_PIN).position
net joint-2-pos-fb => joint.2.motor-pos-fb
net joint-2-pos-fb => pid.z.feedback

# PID Output
net joint.2.output <= pid.z.output
net joint.2.output => hm2_[MESA](BOARD).0.pwmgen.[JOINT_2](MESA_PWM_PIN).value

# Encoder Setup
setp hm2_[MESA](BOARD).0.encoder.[JOINT_2](MESA_encoder_PIN).scale [JOINT_2](ENCODER_SCALE)
setp hm2_[MESA](BOARD).0.encoder.[JOINT_2](MESA_encoder_PIN).counter-mode 0
setp hm2_[MESA](BOARD).0.encoder.[JOINT_2](MESA_encoder_PIN).filter 1
setp hm2_[MESA](BOARD).0.encoder.[JOINT_2](MESA_encoder_PIN).index-invert 0
setp hm2_[MESA](BOARD).0.encoder.[JOINT_2](MESA_encoder_PIN).index-mask 0
setp hm2_[MESA](BOARD).0.encoder.[JOINT_2](MESA_encoder_PIN).index-mask-invert 0

From main.ini where I define the variables to be expanded.

[JOINT_2]
# MESA_PWM_PIN & MESA_encoder_PIN are the pin numbers used on the 7I97T MESA board for this axis 
# Z and Y Mesa Pins swapped for vertical machining
MESA_PWM_PIN = 01
MESA_encoder_PIN = 01
CARD = 0
TAB = 1
AXIS = Z
...

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions