engraving depth setting in realtime

More
18 Mar 2016 06:48 #71847 by wicki
thanks - I think halmodule is what I want ;-)

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

More
18 Mar 2016 09:22 #71849 by wicki
OK - it works.
thats nice... thank you.

Now it would be fine to start the script at startup of linuxCNC.
I tried
[PYTHON]
TOPLEVEL = /opt/emc2-dev/pytest.py


but it results in
...cant instantiate Python plugin....

the script is simple:

#!/usr/bin/python
import hal, time, serial

h = hal.component("passthrough")
h.newpin("in", hal.HAL_FLOAT, hal.HAL_IN)
h.newpin("Zdist", hal.HAL_FLOAT, hal.HAL_OUT)
h.ready()
f=1;

ser = serial.Serial('/dev/ttyUSB0', 115200, timeout=1)

try:
while 1:
s = ser.readline()
s=s[1]+s[2]+s[3]+s[4]
snum=float(s)/50
snum=int(snum)
print snum
f=f+1;
time.sleep(1)
h = snum;

except KeyboardInterrupt:
ser.close()
raise SystemExit

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

More
18 Mar 2016 10:38 #71853 by andypugh

Now it would be fine to start the script at startup of linuxCNC.
I tried
[PYTHON]
TOPLEVEL = /opt/emc2-dev/pytest.py


That syntax is for re-mapping G-code commands.

Loading your new module is actually rather easier than that. just add
loadusr passthrough
to the HAL file.

You probably want to change the component name, and the file name and component name need to match. (ie, a file called zadjust.py and h = hal.component("zadjust")
The following user(s) said Thank You: wicki

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

More
18 Mar 2016 18:05 #71876 by wicki
real nice ;-)

I just added

HALCMD = loadrt offset
HALCMD = loadusr /opt/emc2-dev/python/zadjust.py

to the -ini-file.

this also works....

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

More
23 Mar 2016 20:02 #72068 by wicki
The engraving-depth-probe is working now.
But I need some help again.

There is one question remaining:

A python-script sets the fine-position of the z-axis via z-offset when engraving.
But the fine-tuning took some time.
So, if the value of the z-axis reaches the engraving-depth, x/y-axes start to
move, but the fine-setting (by z-offset) is not finished.

What is the right way to pause x/y-move until z-offset-position is reached?

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

More
27 Mar 2016 10:41 #72207 by andypugh

A python-script sets the fine-position of the z-axis via z-offset when engraving.
But the fine-tuning took some time.
So, if the value of the z-axis reaches the engraving-depth, x/y-axes start to
move, but the fine-setting (by z-offset) is not finished.


This might be a fundamental problem due to the XY moves being handled by the realtime system and the offset happening in a user-space Python module. Or it might not be anything to do with this.

What is the right way to pause x/y-move until z-offset-position is reached?


Have a look at motion.feed-inhibit
linuxcnc.org/docs/2.7/html/man/man9/motion.9.html

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

More
28 Mar 2016 07:44 #72238 by wicki

Have a look at motion.feed-inhibit
linuxcnc.org/docs/2.7/html/man/man9/motion.9.html


Yes, it works - for all axes at the same time.
But its not possible to stop the movement of only a single axis with
motion.xxx - or I have not found these option....

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

More
28 Mar 2016 09:47 #72239 by andypugh

Yes, it works - for all axes at the same time.


That shouldn't matter, your Z-offsetting is not happening as an axis move, it is an offset to the motor position.
The following user(s) said Thank You: wicki

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

More
28 Mar 2016 10:24 #72240 by wicki

That shouldn't matter, your Z-offsetting is not happening as an axis move, it is an offset to the motor position.


Yes! Thats it.
I had not tried to move z by offset while motion.feed-inhibit is true....

Thank you ;-)

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

Time to create page: 0.123 seconds
Powered by Kunena Forum