- Posts: 25
- Thank you received: 0
REMAP=M6 modalgroup=6 python=atc_toolchange
1 year 3 weeks ago #336067
by Doc_emmet
REMAP=M6 modalgroup=6 python=atc_toolchange was created by Doc_emmet
Hello, I'm trying to run a Python file with REMAP=M6 modalgroup=6 python=atc_toolchange, but when I start Linuxcnc, I get the message: Hard Limits Are Reset To Active! The Python file doesn't say what could be causing this. Does anyone have an example of how I can run a Python file with REMAP=M6?
Please Log in to join the conversation.
1 year 3 weeks ago #336100
by Aciera
Replied by Aciera on topic REMAP=M6 modalgroup=6 python=atc_toolchange
I think that is just a GUI message (qtDragon?). What makes you think it is due to your remap?
Please Log in to join the conversation.
1 year 3 weeks ago #336110
by Doc_emmet
Replied by Doc_emmet on topic REMAP=M6 modalgroup=6 python=atc_toolchange
Hello, yes QtDragon, Linuxcnc is running without any problems. However, as soon as I insert the line REMAP=M6 modalgroup=6 python=atc_toolchange, Linuxcnc starts with a significant delay, then displays the error message "Hard Limits Are Reset To Active!" and I can't even use it. I call this test program with M6:
import linuxcnc
import time
def atc_toolchange(**words):
s = linuxcnc.stat()
if not all(axis.homed for axis in s.axis[
]): # XYZ
return linuxcnc.INTERP_OK
c = linuxcnc.command()
c.mdi("G53 G0 Z100")
while s.interp_state != linuxcnc.INTERP_IDLE:
s.poll()
time.sleep(0.05)
return linuxcnc.INTERP_OK
Thank you very much for your effort.
import linuxcnc
import time
def atc_toolchange(**words):
s = linuxcnc.stat()
if not all(axis.homed for axis in s.axis[
]): # XYZreturn linuxcnc.INTERP_OK
c = linuxcnc.command()
c.mdi("G53 G0 Z100")
while s.interp_state != linuxcnc.INTERP_IDLE:
s.poll()
time.sleep(0.05)
return linuxcnc.INTERP_OK
Thank you very much for your effort.
Please Log in to join the conversation.
1 year 3 weeks ago #336113
by Aciera
Replied by Aciera on topic REMAP=M6 modalgroup=6 python=atc_toolchange
Have you started your config from a terminal to check for errors in the terminal output?
Also some of your remap code looks a bit odd (eg. 'linuxcnc.INTERP_OK)
You might want to have a look at some examples:
github.com/LinuxCNC/linuxcnc/blob/master...rted/python/remap.py
Code:
$ linuxcnc
Also some of your remap code looks a bit odd (eg. 'linuxcnc.INTERP_OK)
You might want to have a look at some examples:
github.com/LinuxCNC/linuxcnc/blob/master...rted/python/remap.py
Please Log in to join the conversation.
1 year 3 weeks ago #336119
by Doc_emmet
Replied by Doc_emmet on topic REMAP=M6 modalgroup=6 python=atc_toolchange
this is my new test file remap_m6:
#!/usr/bin/env python3
from interpreter import INTERP_OK, INTERP_EXECUTE_FINISH, INTERP_ERROR
print(">>> remap_m6.py wird geladen <<<")
def remap_m6(self, **words):
try:
tool_number = words.get('t', 1)
print(f">>> M6 Werkzeugwechsel aufgerufen: T{tool_number} <<<")
# Sofort fertig melden
yield INTERP_EXECUTE_FINISH
except Exception as e:
print("Fehler in remap_m6:", e)
yield INTERP_ERROR
yield INTERP_OK
But this is supposedly not executable?
'remap_m6' is not a Python callable function - 49:REMAP = M6 modalgroup=6 python=remap_m6
I've already made some Python scripts that work, so why is it so different when called with M6?
#!/usr/bin/env python3
from interpreter import INTERP_OK, INTERP_EXECUTE_FINISH, INTERP_ERROR
print(">>> remap_m6.py wird geladen <<<")
def remap_m6(self, **words):
try:
tool_number = words.get('t', 1)
print(f">>> M6 Werkzeugwechsel aufgerufen: T{tool_number} <<<")
# Sofort fertig melden
yield INTERP_EXECUTE_FINISH
except Exception as e:
print("Fehler in remap_m6:", e)
yield INTERP_ERROR
yield INTERP_OK
But this is supposedly not executable?
'remap_m6' is not a Python callable function - 49:REMAP = M6 modalgroup=6 python=remap_m6
I've already made some Python scripts that work, so why is it so different when called with M6?
Please Log in to join the conversation.
1 year 3 weeks ago #336124
by Doc_emmet
Replied by Doc_emmet on topic REMAP=M6 modalgroup=6 python=atc_toolchange
Can you create a small Python file (as simple as possible) that when I call it via REMAP = M6 modalgroup=6 python=remap_m6 , for example, only moves the Z-axis by 10mm
Please Log in to join the conversation.
1 year 3 weeks ago #336149
by Aciera
Replied by Aciera on topic REMAP=M6 modalgroup=6 python=atc_toolchange
Your last test file works fine for me.
Sounds like you might not have things set up right in your ini file.
Do you have TOPLEVEL defined correctly in the [PYTHON] section (your path might be different):
Sounds like you might not have things set up right in your ini file.
Do you have TOPLEVEL defined correctly in the [PYTHON] section (your path might be different):
Code:
[PYTHON]
PATH_PREPEND= python
# import the following Python module
TOPLEVEL= python/toplevel.py
Please Log in to join the conversation.
1 year 3 weeks ago #336173
by Doc_emmet
Replied by Doc_emmet on topic REMAP=M6 modalgroup=6 python=atc_toolchange
Hello, what is the content of toplevel.py?
import oword
import remap
import oword
import remap
Please Log in to join the conversation.
1 year 3 weeks ago #336182
by Aciera
Replied by Aciera on topic REMAP=M6 modalgroup=6 python=atc_toolchange
have a look at the example config in the 'sim/axis/remap' folder:
github.com/LinuxCNC/linuxcnc/tree/master...emap/getting-started
github.com/LinuxCNC/linuxcnc/tree/master...emap/getting-started
Please Log in to join the conversation.
Time to create page: 0.099 seconds
