- Posts: 183
- Thank you received: 0
engraving depth setting in realtime
Please Log in to join the conversation.
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 to join the conversation.
wicki wrote: 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
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")
Please Log in to join the conversation.
I just added
HALCMD = loadrt offset
HALCMD = loadusr /opt/emc2-dev/python/zadjust.py
to the -ini-file.
this also works....
Please Log in to join the conversation.
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 to join the conversation.
wicki wrote: 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 to join the conversation.
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 to join the conversation.
wicki wrote: 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.
Please Log in to join the conversation.
andypugh wrote: 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 to join the conversation.
