Enable/disable backlash/screw compensation via G-Code (or hal)?

More
5 years 9 months ago #195971 by underscore
Is it possible to temporarily enable or disable the backlash compensation via GCode or HAL? I would like to only use backlash compensation for finishing passes and drill, for example.

Please Log in to join the conversation.

More
5 years 9 months ago #195989 by Aciera
You should be able to access your backlash value through the hal-pin '[strike]halui.0.backlash[/strike]' 'ini.0.backlash'. So try to connect that to the output of a mux2 with one input set to your joints backlash value and the other input set to zero. Then you can use say 'motion.digital-out-00' as your input selector on the mux2.
That should make it possible to set backlash the nonzero value using :
Code:
M66 E0 L0 ; force synch M64 P0 ; set motion.digital-out-00 M66 E0 L0 ; force synch

Or to zero using:
Code:
M66 E0 L0 ; force synch M65 P0 ; reset motion.digital-out-00 M66 E0 L0 ; force synch
I'm not sure if you need both queue busters (M66 E0 L0). But it won't hurt to use one before and one after switching the backlash value. If it's too much of a hassle to code this every time in the Gcode you could pack those three lines in a M-code remap.

Please Log in to join the conversation.

More
5 years 9 months ago #195998 by underscore
Thanks for the quick reply. Where do I find information about that halui pin? I can’t seem to locate it in linuxcnc.org/docs/devel/html/man/man1/halui.1.html

Please Log in to join the conversation.

More
5 years 9 months ago #196011 by Aciera
I'm sorry it's 'ini.0.backlash'.

[edit]

found something here:

linuxcnc.org/docs/html/man/man1/milltask.1.html

Please Log in to join the conversation.

More
5 years 9 months ago #196049 by underscore
Wow, I didn't know it was possible to overwrite the ini values from hal. Very useful! Thanks so much!

Please Log in to join the conversation.

More
5 years 9 months ago #196376 by underscore
My solution: ("g62.ngc"):
Code:
o<g62> sub (Enable backlash compensation on X and Y) (add to *.ini: REMAP=G62 modalgroup=1 argspec=P ngc=g62) (Requirements:) (In postgui.hal) (net x-backlash <= motion.analog-out-00 => ini.0.backlash) (net y-backlash <= motion.analog-out-01 => ini.1.backlash) (Recommended to add G62 P0 to the startup and abort.) o50 if [#<P> EQ 1] o100 if [EXISTS[#<_ini[joint_0]backlash>]] M68 E0 Q[#<_ini[joint_0]backlash>] o100 else (DEBUG, No backlash set in the ini file for JOINT_0) o100 endif o200 if [EXISTS[#<_ini[joint_1]backlash>]] M68 E1 Q[#<_ini[joint_1]backlash>] o200 else (DEBUG, No backlash set in the ini file for JOINT_1) o200 endif (PRINT, Backlash compensation enabled.) o50 elseif [#<P> EQ 0] M68 E0 Q0 M68 E1 Q0 o50 endif M66 E0 L0 (Queue buster) o<g62> endsub [1] M2

Please Log in to join the conversation.

Time to create page: 0.266 seconds
Powered by Kunena Forum