Running milltask (or gcode interp) without python?

More
05 Jan 2022 13:56 #230865 by mungkie
I  maybe should really have a more indepth look but thought better to ask first as it could save me lots of time?

The main question:
Is it possible to run gcode without python installed.

Basically I want run gcode, but I have no python, loadusr milltask fails, is there a way around this?

Background:
I have messed around with some low level stuff for drivers but never really had a full and proper understanding of how everything in linuxcnc fits together as I did not have the need, so here I try to explain my limited understanding...........

My understanding maybe wrong but this is what I think I know.

milltask interprets gcode and sends it wherever neccesary (traj planner?), I want to load/run a gcode I send EMC_TASK_PLAN_OPEN this goes through milltask?

src/emc/task and src/emc/rs274ngc have lots of python hooks. I tried configure --without-boost-python I think this does nothing???

I have not messed with linuxcnc since machinkit fork, I sort of remember iotaskintf.cc -> taskclass.cc???

machinekit and linuxcnc have diverged and both I have no idea pro/con anyone have overview of diffs (seems both add lots more dependencys on weird libs python/zmq/modbus/etc..)????

I have noidea but would it not be better to have HAL module for python into NML not pollute task planner, as this makes linuxcnc more modular and removed dependency on python to run gcode, also make other language bindings easier?

Is there going to be anything as nextgen gcode(taking account of tool/effector geometry and linkage(I could go into further guesses but this waste your time))

I try to keep this short to start, further ideas discussion, I will ellaborate if possible and neccesary.

I maybe look at the source this evening if no easy answer.

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

  • Todd Zuercher
  • Todd Zuercher's Avatar
  • Away
  • Platinum Member
  • Platinum Member
More
05 Jan 2022 16:09 #230873 by Todd Zuercher
Replied by Todd Zuercher on topic Running milltask (or gcode interp) without python?
Maybe this might be a better question to ask on the developers mailing list?

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

More
05 Jan 2022 18:03 #230882 by cmorley
You asked quite a few vaguish questions so I'll try to answer what I think you want.
Can linuxcnc run gcode without python dependency. I would say no.
You dont have to use python to interpret gcode but I've python hooks are baked in to allow remap of m and g codes.

Why do you wish to exclude python?

Python code for HAL is a different instance of python then the python used for the interpreter. The interpreter starts it's very own instance of python.

As for what would be best practice ... there are many things that are suboptimal but we only have so many devs that understand enough to make deep changes. Most just tack on what works and is needed. But ultimately it does work pretty well for well beyond what it was intended for.

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

More
06 Jan 2022 00:55 #230915 by mungkie
Yeah, seems difficult I don't know enough about python c++ to put some sort of wrapper on it and recompiling the rs274 and task dirs without python seems to break something.

It seems to load the milltasknopy and I can jog axes and readback positions but there is no position update when I load a gcode file and run it, but also no errors.

I have wasted the whole evening on this and rather annoyed, if anyone with more experience can try running this and give some pointers I maybe will continue?

I have attached the hacked code test as tar.bz2 unzip in linuxcnc root dir and should create test ini/hal files and two extra directory in src/emc (I downloaded master from github).

just cd into rs274ngc_nopy and task_nopy and type make should create the lib file and milltasknopy, and then try
scripts/linuxcnc milltasknopy.ini
in rip environment.
  [attachment=42719]milltasknopy.tgz[/attachment]
Attachments:

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

More
06 Jan 2022 01:02 #230916 by mungkie
I get the feeling the attachment failed as it wanted a zip or tgz and I just changed the extension, so here is a zip of the tbz

File Attachment:

File Name: milltasknopy.zip
File Size:244 KB
Attachments:

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

More
06 Jan 2022 01:48 #230919 by cmorley
You never really answered why you want to remove python.
I would ask the same question if someone wanted to get rid of c or c++ too.

What is you ultimate goal here?

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

More
06 Jan 2022 14:35 #230963 by mungkie

You never really answered why you want to remove python.
I would ask the same question if someone wanted to get rid of c or c++ too.

What is you ultimate goal here?
 

Ultimately eternal life by evolving into pure coherent controlled energy.

I really find that difficult to answer without wasting even more time though.
I suppose this maybe due to efficiency of language or information transfer, in the begining it has to be put into words.

I supose the main factors in messing with this python thing is newtons first and thermal S.

I am not trying to start a fork tongue, but it seemed trying to compile python for my system was a huge amount more work than trying to get linuxcnc to work with python stripped out. I am probably wrong, and this is just a hobby project so will probably be dumped in the trash in a few weeks or days depending on stuff?

Obviously you know what you are talking about and are hoping to get me to find a solution using python, unfortunately I am trying to find a solution without using python (I think that means no dependency on python is part of the ultimate goal).

I know everything is complicated and linuxcnc is a pretty large codebase and I know I don't understand it properly, and unfortunately every new addition adds more complexity, sometimes with people reimplementing wheels that are already in the system only because they did not understand what had already been implemented, sometimes people implementing things suboptimally becuase it was the only way that could be seen to easily get what was required.

Anyways thanks for trying to help cmorely, I am probably going to mess around with things a bit more and see what I can misunderstand or learn.Bababadalgharaghtakamminarronnkonnbronntonnerronntuonnthunntrovarrhounawnskawntoohoohoordenenthurnuk


 

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

More
06 Jan 2022 23:45 #230999 by cakeslob
Well, what ever you reasons are, and without knowing what im talking about, I will go out on a limb and say you probably cant. I base this answer solely on what I have read from grotius. I dont know how to use a computer, but I know grotius knows how. He has some kind of issue with the python involved with linuxcnc, so he has been working on something sans python, i think it was something realtime related, but most of the things he says are too complicated for me to understand. So without knowing what Im talking about I will assume you cannot run lcnc without python.
I recommend reading through his threads on the forum, and checking out his github page

forum.linuxcnc.org/47-hal-examples/43333-hal-core?start=0

github.com/grotius-cnc/hal-core

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

More
07 Jan 2022 04:39 #231012 by cmorley
I asked the question because it sounded like an XY question.
en.wikipedia.org/wiki/XY_problem

If you want to make linuxcnc python-less just because, sounds fine by me - but you're not gonna get much help. Python is an important part of the project.
(I'd be happier if linuxcnc was tcl-less but some people like it.)

If you having problem compiling python libraries - you probably could get some help there.
You must be using an odd (to us) distribution.

Chris

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

More
07 Jan 2022 20:10 #231055 by mungkie
So I did not really mess much last night other than a quick check on what I had actually done to the code that I hacked.

previously I just #ifdef PYTHONO out anything that referenced python after initially trying to puzzle out what     
callmethod and Py_XDECREF
did and then thinking it was too much work to figure out so ignore it until I test.

So the test did not work and I am looking at the defines for the python 'callmethod'  below it sort of looks like it should be calling some function in an external python script, but maybe it is just changing the data in the straight_feed struct???????

I should probably ask someone in the devel mailing list, but does anyone know what "callmethod" does, I have never used CPython/PyObject and don't really want to learn so hoping a quick hack can suffice, maybe I will just try to change the  straight_feed struct which I guess is the real location of the motion position target?

I initially assumed the globals  _pos_x=x; _pos_y=y; _pos_z=z;    _pos_a=a; _pos_b=b; _pos_c=c;    _pos_u=u; _pos_v=v; _pos_w=w;
set the target?

I am guessing the string "straight_list" searches for pointer to straight_feed in some global queued_canon struct?

I will keep on messing......
#define callmethod(o, m, f, ...) PyObject_CallMethod((o), (char*)(m), (char*)(f), ## __VA_ARGS__)
void STRAIGHT_FEED(int line_number,
                   double x, double y, double z,
                   double a, double b, double c,
                   double u, double v, double w) {
    _pos_x=x; _pos_y=y; _pos_z=z;
    _pos_a=a; _pos_b=b; _pos_c=c;
    _pos_u=u; _pos_v=v; _pos_w=w;
    if(metric) { x /= 25.4; y /= 25.4; z /= 25.4; u /= 25.4; v /= 25.4; w /= 25.4; }
    maybe_new_line(line_number);
    if(interp_error) return;
#ifdef PYTHONO
    PyObject *result =
        callmethod(callback, "straight_feed", "fffffffff",
                            x, y, z, a, b, c, u, v, w);
    if(result == NULL) interp_error ++;
    Py_XDECREF(result);
#endif
}






 

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

Time to create page: 0.074 seconds
Powered by Kunena Forum