- Posts: 19899
- Thank you received: 4655
Making M62/M63 codes failsafe
- andypugh
- Offline
- Moderator
-
Less
More
4 years 3 months ago #247363
by andypugh
There is motion.current-vel to save a step there. Still need the wcomp, and will go true during jogs and rapids.
This might be a good choice, as it remains zero during jogs.
You could also use motion.program-line which is zero when a program is not tunning (and during a toolchange / pause)
Using motion-type needs a bit of HAL logic or possibly a custom component depending on what you are comfortable with.
It's slightly inconvenient that the motion-type is a signed integer, as most of the bit-twiddling components want an unsigned int. So first I think you would need to use conv_s32_u32 to convert.
linuxcnc.org/docs/stable/html/man/man9/conv_s32_u32.9.html
Then I think what I would use might be slightly non obvious, mux_generic. mux_generic can take an unsigned int as an input and have a defined output for each value. If configured as a bit output then you can select the output separately for each motion-type, and can save the and2 by wiring the laser enable through it
linuxcnc.org/docs/stable/html/man/man9/mux_generic.9.html
This passes-through the signal laser-enable to laser-enable-interlocked to be used elsewhere if the motion-type is 2 or 3, and sends zero otherwise.
Replied by andypugh on topic Making M62/M63 codes failsafe
I had the similar problem but a different application. Solved with a small component. net x-vel-cmd and net y-vel-cmd to this component, and check if there is any movement (non-zero).
There is motion.current-vel to save a step there. Still need the wcomp, and will go true during jogs and rapids.
have look at motion.motion-type 1: Traverse , 2: Linear feed, 3: Arc feed
This might be a good choice, as it remains zero during jogs.
You could also use motion.program-line which is zero when a program is not tunning (and during a toolchange / pause)
Using motion-type needs a bit of HAL logic or possibly a custom component depending on what you are comfortable with.
It's slightly inconvenient that the motion-type is a signed integer, as most of the bit-twiddling components want an unsigned int. So first I think you would need to use conv_s32_u32 to convert.
linuxcnc.org/docs/stable/html/man/man9/conv_s32_u32.9.html
Then I think what I would use might be slightly non obvious, mux_generic. mux_generic can take an unsigned int as an input and have a defined output for each value. If configured as a bit output then you can select the output separately for each motion-type, and can save the and2 by wiring the laser enable through it
linuxcnc.org/docs/stable/html/man/man9/mux_generic.9.html
Code:
loadrt conv_s32_u32
loadrt mux_generic config=bb8
...
addf conv_s32_u32.0 servo-thread
addf mux-gen.0 servo-thread
...
net s32_type motion.motion-type => conv_s32_u32.0.in
net u32-type conv_s32_u32.out => mux-gen.00.sel-int
setp mux-gen.00.in-bit-00 0
setp mux-gen.00.in-bit-01 0
net laser-enable mux-gen.00.in-bit-02
net laser-enable mux-gen.00.in-bit-03
setp mux-gen.00.in-bit-04 0
setp mux-gen.00.in-bit-05 0
setp mux-gen.00.in-bit-06 0
setp mux-gen.00.in-bit-07 0
net laser-enable-interlocked mux-gen.00.out-bit
This passes-through the signal laser-enable to laser-enable-interlocked to be used elsewhere if the motion-type is 2 or 3, and sends zero otherwise.
Please Log in or Create an account to join the conversation.
- Limedodge
- Offline
- Senior Member
-
Less
More
- Posts: 40
- Thank you received: 1
4 years 3 months ago #247396
by Limedodge
Replied by Limedodge on topic Making M62/M63 codes failsafe
Yeah, I spent some time thinking about bit banging the motion-type route. That may be the way to go, but It had occured to me there may be a simpler solution.
NOT the motion-teleop-mode to flip the bit
AND2 motion.teleop-mode with motion.motion-enable
This protects against both conditions I'm worried about
1. "joint X following error" shut down
In this case motion.motion-enable = False and motion.teleop-mode = False (bit flipped to True)
AND2 function = False
2. Manual stop mid lasing path
In this case motion.motion-enable = True and motion.teleop-mode = True (bit flipped to False)
AND2 function = False
Under normal operation both motion.motion-enabled = True and motion.teleop-mode = False (bit flipped to True)
AND2 function = True
Seems like that should catch both of those conditions above with only 2 bitwise operations
Of course there's an additional AND2 with the M62 output pin for actual firing. All 3 conditions need to be true in order to fire
Am I'm missing something? Some condition I'm not covered for? Since it's a laser and glavos, I'm not really doing any jogging. Nor will I ever need to fire the laser when it's not running a program. That's how deep holes are made
NOT the motion-teleop-mode to flip the bit
AND2 motion.teleop-mode with motion.motion-enable
This protects against both conditions I'm worried about
1. "joint X following error" shut down
In this case motion.motion-enable = False and motion.teleop-mode = False (bit flipped to True)
AND2 function = False
2. Manual stop mid lasing path
In this case motion.motion-enable = True and motion.teleop-mode = True (bit flipped to False)
AND2 function = False
Under normal operation both motion.motion-enabled = True and motion.teleop-mode = False (bit flipped to True)
AND2 function = True
Seems like that should catch both of those conditions above with only 2 bitwise operations
Of course there's an additional AND2 with the M62 output pin for actual firing. All 3 conditions need to be true in order to fire
Am I'm missing something? Some condition I'm not covered for? Since it's a laser and glavos, I'm not really doing any jogging. Nor will I ever need to fire the laser when it's not running a program. That's how deep holes are made
Please Log in or Create an account to join the conversation.
- cmorley
- Offline
- Moderator
-
Less
More
- Posts: 7368
- Thank you received: 2181
4 years 3 months ago #247426
by cmorley
Replied by cmorley on topic Making M62/M63 codes failsafe
This might be helpful:
linuxcnc.org/docs/devel/html/remap/remap...g_dealing_with_abort
linuxcnc.org/docs/devel/html/remap/remap...g_dealing_with_abort
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
-
Less
More
- Posts: 19899
- Thank you received: 4655
4 years 3 months ago #247500
by andypugh
(If you MDI a G0 you probably don't want the laser to enable.)
The setp mux-gen.00input.NN 0 lines are optional, I put them there so that there was a clear table to configure.
Replied by andypugh on topic Making M62/M63 codes failsafe
Possibly. My solution is only two components and is relatively easy to modify if you decide you want laser on G0 too.Am I'm missing something?
(If you MDI a G0 you probably don't want the laser to enable.)
The setp mux-gen.00input.NN 0 lines are optional, I put them there so that there was a clear table to configure.
Please Log in or Create an account to join the conversation.
Time to create page: 0.162 seconds