Switch relay in a defined x position

More
18 Jan 2022 18:40 #232311 by mgm
Success message it works great
You are the greatest guys thank you!

There was still some grumbling in one place but that could be fixed quickly.

Here again for the sake of completeness.
The following must be entered in the hal:

loadrt downdraft name=ddraft
addf ddraft servo-thread
net position axis.x.pos-cmd. => ddraft.position
net ddraft-trigger ddraft.trigger
setp ddraft cutover 800
setp ddraft cutoff 1200
The following user(s) said Thank You: rodw

Please Log in or Create an account to join the conversation.

More
18 Jan 2022 19:40 #232320 by rodw
great work, glad it works for you.
Custom components are so simple yet so few know they can be written

Please Log in or Create an account to join the conversation.

More
12 Jul 2022 13:43 #247139 by caretech

Isn't this something that the built-on "comp" or "wcomp" components can do?

linuxcnc.org/docs/2.8/html/man/man9/comp.9.html
linuxcnc.org/docs/2.8/html/man/man9/wcomp.9.html
 

Do you know of a code snippet anywhere as an example of how we might use comp or wcomp to trigger pins based on X axis position? I have built a 5 x 10 table and am building a zoned downdraft system for it with five zones. I want one zone open at a time based on position of the X axis; and a time delay so that open zones do not close for a few seconds after X has moved out of  a zone. I am not concerned with the position of Y.

Please Log in or Create an account to join the conversation.

More
12 Jul 2022 13:55 - 12 Jul 2022 14:07 #247143 by tommylight
RodW and another member have such a system in use, so it can be done.
How, i'll leave that to them to explain.
Found one of the topics:
forum.linuxcnc.org/plasma-laser/40517-do...gn-questions?start=0
Last edit: 12 Jul 2022 14:07 by tommylight. Reason: added link
The following user(s) said Thank You: caretech

Please Log in or Create an account to join the conversation.

More
12 Jul 2022 14:07 #247145 by caretech
I figured I'd probably take the component Rodw provided in this thread and modify it as needed for my table, but was wondering if there would be reasons why using built-in components would be better. For instance will the "halcompile" step be needed again after upgrading LinuxCNC? I built on MX Linux 21.

Then again, now it just occurred to me that as far as custom components go I'm using Rod's ohmic3.comp for ohmic probing with a THCAD-5. So... if custom components need to be reinstalled after upgrading I am not clear of that anyhow. I'll go study the downdraft component provided in the other thread some more.
The following user(s) said Thank You: tommylight

Please Log in or Create an account to join the conversation.

More
12 Jul 2022 14:12 - 12 Jul 2022 14:12 #247147 by mgm
I have a spindle support which is retracted and extended with a pneumatic cylinder. The cylinder is controlled via a relay which is controlled with a digital output of the Mesacard.

Attached is the comp file.
This is the hal entry
# --- Spindle support---
net position axis.x.pos-cmd => spport.position
net spport-trigger spport.trigger => hm2_7i76e.0.7i76.0.0.output-05
setp spport.on 700
setp spport.off 1900
 
Attachments:
Last edit: 12 Jul 2022 14:12 by mgm.
The following user(s) said Thank You: caretech

Please Log in or Create an account to join the conversation.

More
12 Jul 2022 15:13 - 12 Jul 2022 15:18 #247154 by itsme
loadrt wcomp names=wcomp_segment0,wcomp_segment1,wcomp_segment2,wcomp_segment3,wcomp_segment4,wcomp_segment5
loadrt not names=not_segment0,not_segment1,not_segment2,not_segment3,not_segment4,not_segment5

addf wcomp_segment0    servo-thread
addf wcomp_segment1    servo-thread
addf wcomp_segment2    servo-thread
addf wcomp_segment3    servo-thread
addf wcomp_segment4    servo-thread
addf wcomp_segment5    servo-thread

setp wcomp_segment0.min    -456
setp wcomp_segment0.max    -44
setp wcomp_segment1.min    -144
setp wcomp_segment1.max    268
setp wcomp_segment2.min    168
setp wcomp_segment2.max    580
setp wcomp_segment3.min    480
setp wcomp_segment3.max    892
setp wcomp_segment4.min    792
setp wcomp_segment4.max    1204
setp wcomp_segment5.min    1104
setp wcomp_segment5.max    1516

#SEGMENTS switching
net y_curr_pos axis.y.pos-cmd wcomp_segment0.in wcomp_segment1.in wcomp_segment2.in wcomp_segment3.in wcomp_segment4.in wcomp_segment5.in

net within_segment0 wcomp_segment0.out => not_segment0.in
net within_segment1 wcomp_segment1.out => not_segment1.in
net within_segment2 wcomp_segment2.out => not_segment2.in
net within_segment3 wcomp_segment3.out => not_segment3.in
net within_segment4 wcomp_segment4.out => not_segment4.in
net within_segment5 wcomp_segment5.out => not_segment5.in

# i use GPIO 11, 09, 10, 25, 08, 07 segment0-5, thats rpin 23, 21, 19, 22, 24, 26
net not_within_segment0 not_segment0.out => hal_pi_gpio.pin-23-out
net not_within_segment1 not_segment1.out => hal_pi_gpio.pin-21-out
net not_within_segment2 not_segment2.out => hal_pi_gpio.pin-19-out
net not_within_segment3 not_segment3.out => hal_pi_gpio.pin-22-out
net not_within_segment4 not_segment4.out => hal_pi_gpio.pin-24-out
net not_within_segment5 not_segment5.out => hal_pi_gpio.pin-26-out
I use a RPI4 and have to use inverted outputs, thus the not usage...
There are 6 (overlapping) segments configured on y axis.
Last edit: 12 Jul 2022 15:18 by itsme.
The following user(s) said Thank You: caretech

Please Log in or Create an account to join the conversation.

Time to create page: 0.099 seconds
Powered by Kunena Forum