Gremlin rewrite for OpenGL ES and possible optimization

More
2 years 4 months ago #303498 by alex_sar
Hi All,

I tried to rewrite Gremlin - make new widget based on existing code and contribute it. It made with using of recent OpenGL ES API (shaders/vertex buffers/etc.). The code is not ready to show yet, but I got all parts working and it is possible to make it handling bigger g-code files and do it fast enough. Currently big files simply excluded from preview. At first look, the problem is large Python trajectory arrays that filled one-by-one and then handled in Python again with lot of iterations. I rewrote it to use number of continous memory buffers (fixed size each) and it made a big change immediately. That is not the question, I hope I can show results soon. Just want to ask if anyone have interest in this new widget?

Another big deal is number of calls between C++ code and Python code. I did not measure it yet, but gcodemodule.cc does calls like this for any point in trajectory:
Code:
PyObject *result = callmethod(callback, "straight_feed", "fffffffff", x, y, z, a, b, c, u, v, w); // gcodemodule.cc:340

When it repeated n*thousand times, it becomes a bottleneck for sure. My idea is to modify method
Code:
static PyObject *parse_file(PyObject *self, PyObject *args) {
and add an optional parameter for this to accept C method pointers for "straight_feed", "traverse", etc. So when this parameter passed, it will call C callbacks instead of python methods and do not do all this Python variable conversion back and forth.  Something like this
Code:
if (straight_feed_callback) {   (*straight_feed_callback)(x, y, z, a, b, c, u, v, w); } else {   PyObject *result =   callmethod(callback, "straight_feed", "fffffffff",   x, y, z, a, b, c, u, v, w);   if(result == NULL) interp_error ++;   Py_XDECREF(result); }
I believe this may be a huge performance win and I hope it does not violate any LinuxCNC development guidelines.
My question is to project maintainers. If I make this change and submit to Github to merge, will it be accepted? 

Please Log in to join the conversation.

More
2 years 4 months ago #303499 by PCW
Not a developer but sounds great especially
for complex gcode or slower machines.

Probably best in a separate branch initially.
 

Please Log in to join the conversation.

More
2 years 4 months ago #303500 by tommylight

If I make this change and submit to Github to merge, will it be accepted? 
If you do not try, you will never know.
:)

Please Log in to join the conversation.

More
2 years 4 months ago #303506 by alex_sar

Please Log in to join the conversation.

More
2 years 4 months ago #303516 by MennilTossFlykune
I am very interested in seeing it. Is it a drop-in replacement for glcanon.py?

Please Log in to join the conversation.

More
2 years 4 months ago #303537 by alex_sar
Yes, that is the goal.

One thing that is still 100% unclear for me is foam cutter visualization. There is some magic code in Gremlin for this. I never worked with such kind of machines. Is there any LinuxCNC documentation regarding foam cutter setup? Or may be one can explain in short?

Please Log in to join the conversation.

More
2 years 4 months ago #303538 by Aciera
Have a look at the foam simulation config 'configs/sim/axis/foam/axis_foam.ini'.

 

Attachment not found



Basically it produces two separate previews, one for XY and one for UV

[edit]
Note that the Z,W height comes from the gcode lines (there are no actual Z or W axes)
(AXIS,XY_Z_POS,5)
(AXIS,UV_Z_POS,30)

[edit2]
The idea is that the two cones represent the end of a hot wire cutting through styrofoam
 

Attachment not found


 

Please Log in to join the conversation.

More
2 years 4 months ago #303543 by alex_sar
Thank you, that is clear now!

Please Log in to join the conversation.

More
3 months 1 day ago #348210 by alex_sar
Hi all! Long time no speak.   Finally, I was able to finish this transition. There is the PR:  github.com/LinuxCNC/linuxcnc/pull/4293 Any feedback is welcome!

Please Log in to join the conversation.

Time to create page: 0.104 seconds
Powered by Kunena Forum