Is there a way to set virtual soft limits?
- vmihalca
- Offline
- Platinum Member
Less
More
- Posts: 344
- Thank you received: 21
16 Jan 2022 19:10 #232048
by vmihalca
Is there a way to set virtual soft limits? was created by vmihalca
Hello,
I am trying to set some programmatic virtual soft limits so that I don't bump the cross slide into the tailstock when its closer to the spindle.
By looking at the methods found here: linuxcnc.org/docs/2.6/html/common/python-interface.html
I was thinking I could use the following functions to do this, but instead I get an error message telling me I have exceeded positive soft limit, and that the axis must be unhomed, jogged into limits, rehomed.
I was looking over these methods:set_max_limit(int, float)set max position limit for a given axisset_min_limit()set min position limit for a given axis
I am trying to set some programmatic virtual soft limits so that I don't bump the cross slide into the tailstock when its closer to the spindle.
By looking at the methods found here: linuxcnc.org/docs/2.6/html/common/python-interface.html
I was thinking I could use the following functions to do this, but instead I get an error message telling me I have exceeded positive soft limit, and that the axis must be unhomed, jogged into limits, rehomed.
I was looking over these methods:set_max_limit(int, float)set max position limit for a given axisset_min_limit()set min position limit for a given axis
Please Log in or Create an account to join the conversation.
- Aciera
- Away
- Administrator
Less
More
- Posts: 4021
- Thank you received: 1733
25 Jan 2022 15:37 #233079
by Aciera
Replied by Aciera on topic Is there a way to set virtual soft limits?
Limit values are accessible from hal. But you will have to force a resync when changing the values:
Example:
#*******************************************************************************
# SETUP SWAPPING OF LIMITS
#*******************************************************************************
# ---switch limits x_pos and z_neg between kinematics---
# Note: Since the ini. pins do not exist until the gui is loaded
# ini.x.max_limit and ini.z.min_limit are set in "custom_postgui.hal !
net kinematic-nontriv <= kinstype.is-1 => not.kins.in
net kinematic-triv <= not.kins.out
setp mux.limit_x_pos.in0 [AXIS_X]MAX_LIMIT
setp mux.limit_x_pos.in1 999999
net kinematic-nontriv => mux.limit_x_pos.sel => mux.limit_z_neg.sel
net limit-x-pos-set <= mux.limit_x_pos.out
setp mux.limit_z_neg.in0 [AXIS_Z]MIN_LIMIT
setp mux.limit_z_neg.in1 -999999
net limit-z-neg-set <= mux.limit_z_neg.out
The switch is done using a remap:
M66 E0 L0 ; force synch
M64 P#<OFFSET_SEL_PIN> ; set XYZBC x- and z-offset to current position
M68 E#<SWITCHKINS_PIN> Q#<kinstype> ; set kinstype value
M65 P#<OFFSET_SEL_PIN> ; reset x-z-offset pin to 0
M66 E0 L0 ; force synch
Note that this comes from a configuration using switchable kinematics which you don't need but it might give you an idea about how to proceed with your particular situation.
Example:
#*******************************************************************************
# SETUP SWAPPING OF LIMITS
#*******************************************************************************
# ---switch limits x_pos and z_neg between kinematics---
# Note: Since the ini. pins do not exist until the gui is loaded
# ini.x.max_limit and ini.z.min_limit are set in "custom_postgui.hal !
net kinematic-nontriv <= kinstype.is-1 => not.kins.in
net kinematic-triv <= not.kins.out
setp mux.limit_x_pos.in0 [AXIS_X]MAX_LIMIT
setp mux.limit_x_pos.in1 999999
net kinematic-nontriv => mux.limit_x_pos.sel => mux.limit_z_neg.sel
net limit-x-pos-set <= mux.limit_x_pos.out
setp mux.limit_z_neg.in0 [AXIS_Z]MIN_LIMIT
setp mux.limit_z_neg.in1 -999999
net limit-z-neg-set <= mux.limit_z_neg.out
The switch is done using a remap:
M66 E0 L0 ; force synch
M64 P#<OFFSET_SEL_PIN> ; set XYZBC x- and z-offset to current position
M68 E#<SWITCHKINS_PIN> Q#<kinstype> ; set kinstype value
M65 P#<OFFSET_SEL_PIN> ; reset x-z-offset pin to 0
M66 E0 L0 ; force synch
Note that this comes from a configuration using switchable kinematics which you don't need but it might give you an idea about how to proceed with your particular situation.
The following user(s) said Thank You: vmihalca
Please Log in or Create an account to join the conversation.
Time to create page: 0.059 seconds