Hello Guest it is March 28, 2024, 10:08:53 PM

Author Topic: is macro B just as fast or faster than regular gcode?  (Read 2232 times)

0 Members and 1 Guest are viewing this topic.

is macro B just as fast or faster than regular gcode?
« on: June 22, 2017, 02:16:50 PM »
mach4 currently does not do inverse kinematics.
I would like to upgrade to mach4 industrial and use macro B programming to read the I J K vector values and convert them into angles in real time depending on the tool length

This is for my 5 axis self made machine.

currently the gcode I am using is based on angles. Which means everytime i use a tool with a different length i have to regenerate the gcode. This is getting very old for me.... im tired of working like this.

If i upgrade to mach4 industrial which includes macro B programming and i am able to do this...
will macro B run just as fast as regular gcode? or will i notice some delays?

i want to make a function that calculates the angle based on the vector values and the tool length, and then rotate my rotary heads accordingly and also move my linear axis to compensate for those rotations accordingly.

i hope this makes sense.

thanks!

Offline smurph

*
  • *
  •  1,544 1,544
  • "That there... that's an RV."
    • View Profile
Re: is macro B just as fast or faster than regular gcode?
« Reply #1 on: July 15, 2017, 03:32:29 PM »
Macro B is as fast as the interpreter is.  And the interpreter is pretty darned fast!  Not many big name CNC solutions can match the G code lines per second that Mach 4 can process.  However, it will depend a lot on the PC hardware.  Meaning, don't expect an Atom to process the same G code lines per second that an I7 will, etc...

So the delay will be proportional to the amount of G code lines that it takes to do your calculations.  But those G code lines will runs just as fast as regular G code lines.

Steve
Re: is macro B just as fast or faster than regular gcode?
« Reply #2 on: July 16, 2017, 12:51:19 AM »
thanks for the reply Steve.
lets say I wanted to program with lua macros instead of Fanuc macros.
how does that compare? will fanuc be faster?

or is that not a fair comparison?

thanks again.
« Last Edit: July 16, 2017, 12:55:48 AM by a3dcreator »

Offline smurph

*
  • *
  •  1,544 1,544
  • "That there... that's an RV."
    • View Profile
Re: is macro B just as fast or faster than regular gcode?
« Reply #3 on: July 16, 2017, 01:07:58 AM »
The LUA scripts is that they are only available in M codes.  In other words, you can't embed LUA script in the G code directly.  Otherwise, LUA is certainly fast.  Both Macro B and LUA scripted M code will break the CV chain, so the move right before them will be an exact stop move.  

With Macro B, one can write a subroutine and associate the sub with a G code.  Say your sub is called 9099 and it is written to take the IJK values.  You can then associate that sub with say G103 and call it in the program like G103 I_ J_ K_.

You could also call the sub with G65.  Like G65 P9099 I_ J_ K_.

So it is about up to the way you want to do it.  The M codes CAN take parameters too.  But probably the M code would do the calculation in LUA and then stuff the output into some #var range that you define.  Then you would need to write the G code to handle the movement that uses those #vars.

But it would be far easier to write a sub that calculates the desired values and moves the head/table all in G code.  I would prefer Macro B.  But...  it does come at a cost.  

Steve
Re: is macro B just as fast or faster than regular gcode?
« Reply #4 on: November 20, 2017, 08:44:36 AM »
I've never used Macro B Programming but I was doing some research on it yesterday.  Can it read read inputs from the controller to determine when the while loops should end?  If not, could you pass an M Code in the while loop that can read the input and change a #VAR to exit the while loop?
Chad Byrd
Re: is macro B just as fast or faster than regular gcode?
« Reply #5 on: November 20, 2017, 12:50:55 PM »
I Went ahead and made a topic out of my previous comment.
Chad Byrd