Is it possible to combine M67 and pyVCP?

More
05 Jan 2020 12:12 #154093 by aleksamc
I want to make for my analog signal (M67 E0 Q<power>) some regulation, similar to spinde regulation.

What we have for spindle:
We set rotation with M3 S### and after that we can decrease spindle rotation with buttons on panel.

I want to make the same for may analog output. Analog output should regulate power using PWM of laser.
Does it's possible to make such mathematical calculations in pyVCP?
I see my aim as:
1) I create scale in pyVCP with some value "k1"
2) I need to make math calculations P=k1*Q0; (it's floating point calculatiosns, Q0 - is output 0 of M67)
3) Connect P => pwmgen.0.value

And after that this calculations should be fast to work on flow of running G-code with G64 (maximum possible speed).
Does it's possible to realize it? What ways of doing it?

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

More
07 Jan 2020 15:11 #154216 by andypugh
One way would be to pass the M67 output through a HAL scale component and set the value of the gain pin of that module from Python code.

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

More
07 Jan 2020 21:02 #154257 by rodw
This post may be of interest to you.
forum.linuxcnc.org/plasma-laser/32691-settings-from-g-code-file

Here we had a real time component catching the M67/M68 analog value and sending it to the python screen handler for the Gmoccappy Plasma sim. This allowed setting of a GUI variable from gcode. And yes any maths becomes trivial in Python. (or in the component if real time is required).

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

More
09 Jan 2020 08:35 - 09 Jan 2020 08:36 #154417 by aleksamc
Thanks, I used "scale"
loadrt scale count=1
addf scale.0 servo-thread

net sc_in scale.0.in <= motion.analog-out-00
net sc_gn scale.0.gain
setp scale.0.offset 0
net laser_power scale.0.out => pwmgen.0.value
#where sc_gn comes from pyvcp.variable

As for rodw answer, it's very interesting, I must study it.
Last edit: 09 Jan 2020 08:36 by aleksamc.
The following user(s) said Thank You: rodw

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

More
26 Jan 2020 12:51 #155801 by bbsr_5a
woudent it be better to get LASER_Power over the Spindle RPM so you can TWEAK it in the GUI direct as Sliders Like AXIS
Spindle override USED

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

Time to create page: 0.086 seconds
Powered by Kunena Forum