Remapping M100-M199 in Python

More
8 years 8 months ago #106579 by sqmathlete
Replied by sqmathlete on topic Remapping M100-M199 in Python
Hi Andy,

All good! I see the error when linuxcnc starts up.

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

More
8 years 8 months ago #106589 by andypugh
Replied by andypugh on topic Remapping M100-M199 in Python
Interesting.

I think that means that the remap file is being found.
What happens if you comment-out the "from interpreter import *" line in your code?
(And is that what the offending line actually says)

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

More
8 years 8 months ago #106792 by sqmathlete
Replied by sqmathlete on topic Remapping M100-M199 in Python
It does seem like the remap.py file is being seen. After I commented out " from interpreter import * "
and ran linuxcnc in a terminal I get the following
Code:
/linuxcnc-dev/configs/ecat-lathe-1.0/ecat-lathe-1.0.ini:66: executing 'import sys sys.path.insert(0,"python")' PythonPlugin: Python '2.7.3 (default, Nov 24 2017, 16:38:25) [GCC 4.7.2]' is_callable(remap.m141) = TRUE NML_INTERP_LIST(0x82f94e8)::append(nml_msg_ptr{size=88,type=EMC_TRAJ_SET_G5X}) : list_size=2, line_number=0 NML_INTERP_LIST(0x82f94e8)::append(nml_msg_ptr{size=84,type=EMC_TRAJ_SET_G92}) : list_size=3, line_number=0 NML_INTERP_LIST(0x82f94e8)::append(nml_msg_ptr{size=20,type=EMC_TRAJ_SET_ROTATION}) : list_size=4, line_number=0 is_callable(__init__) = FALSE Bad character ',' used Interpreter stack: - int Interp::read_one_item(char*, int*, block_pointer, double*) - int Interp::read_items(block_pointer, char*, double*) - int Interp::parse_line(char*, block_pointer, setup_pointer) - int Interp::_read(const char*) emcTaskPlanInit() returned 5 is_callable(__delete__) = FALSE Trying to fix bindings Left PrevChar {} Trying to fix bindings Right NextChar {} Trying to fix bindings Up PrevLine {} Trying to fix bindings Down NextLine {} Trying to fix bindings Home LineStart {} Trying to fix bindings End LineEnd {} note: MAXV max: 250.000 units/sec 15000.000 units/min note: LJOG max: 250.000 units/sec 15000.000 units/min note: LJOG default: 50.000 units/sec 3000.000 units/min waiting for s.joints<0>, s.kinematics_type<0> waiting for s.joints<0>, s.kinematics_type<0> waiting for s.joints<0>, s.kinematics_type<0> waiting for s.joints<0>, s.kinematics_type<0> waiting for s.joints<0>, s.kinematics_type<0> waiting for s.joints<0>, s.kinematics_type<0> waiting for s.joints<0>, s.kinematics_type<0> waiting for s.joints<0>, s.kinematics_type<0> waiting for s.joints<0>, s.kinematics_type<0> A configuration error is preventing LinuxCNC from starting. More information may be available when running from a terminal. Shutting down and cleaning up LinuxCNC...

I also tried the other way that you suggested earlier "an executable python file" in my m-codes folder (M140). Linuxcnc will start up fine but if I import either the interpreter or emccannon module I get an error saying that these modules
Code:
Issuing EMC_SYSTEM_CMD -- ( +30,+268, +0,m-codes/M140\032-1.000000\032-1.000000,) Emit interp-run Emit interp-run Traceback (most recent call last): File "m-codes/M140", line 4, in <module> from interpreter import * ImportError: No module named interpreter emcSystemCmd: system command 2785 exited abnormally with value 1

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

More
8 years 8 months ago #106797 by andypugh
Replied by andypugh on topic Remapping M100-M199 in Python
For reasons I am not 100% clear on you can't import emccannon or interpreter into a standalone Python script, they are only available inside code that is part of a remap.

This looks fishy: Bad character ',' used

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

More
8 years 7 months ago #106870 by sqmathlete
Replied by sqmathlete on topic Remapping M100-M199 in Python
Thanks!

After a very long search I found the "," ... in an unrelated line just below my REMAP section. Doh!
Unfortunately, now that I have a few things working I have more questions. I am making a bit of progress though so I will hold off for now and get back to you.

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

Time to create page: 0.250 seconds
Powered by Kunena Forum