Spindle speed variation ssv for chatter control

More
5 years 8 months ago #197722 by robertspark

PCW wrote: A _very_ minimal example:

loadrt siggen
addf siggen.0.update servo thread

setp siggen.0.frequency 1 # 1 Hz
setp siggen.0.amplitude 50 # +-50 RPM

net spindle-speed => siggen.0.offset
net mod_spindle_speed <= siggen.0.sine
net mod_spindle_speed => your-spindle-hardware-speed-pin


thanks

this shows just what I needed as I sort of get linuxcnc but with the above example it shows how to load the component, add it to the thread, set the parameters, and then apply those to an existing net / wire and output it.

thanks, invaluable (it's one thing reading the manual but another to see a simple example of just the one element instead of all the other bits / components which can obfuscate what you are trying to understand or break it down to )
The following user(s) said Thank You: rodw, Catch22

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

More
5 years 8 months ago - 5 years 8 months ago #197723 by andypugh
The next step would be to set up some custom M-codes to turn the behaviour on and off.

For example a file called M100 to turn it on.
Code:
#! /bin/bash #!/bin/bash frequency=$1 amplitude=$2 halcmd setp siggen.0.reset 0 halcmd setp siggen.0.frequency $frequency halcmd setp siggen.0.amplitude $amplitude exit 0

Save that code to a file called "m100" in your nc_files folder (probably. I am not at a LinuxCNC machine at the moment. Check the docs above as regards the search path). Then make the file executable. (right-click on it in the GUI and select properties)
Then
Code:
M100 P2 Q20
would enable the feature at 2Hz and 20 rpm amplitude.

You might also want an M101 to turn it off
Code:
#! /bin/bash halcmd setp siggen.0.reset 1 return 0
Last edit: 5 years 8 months ago by andypugh. Reason: There is no "enable" for siggen
The following user(s) said Thank You: akb1212, Catch22, robertspark, anfänger

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

More
5 years 8 months ago #197724 by robertspark
thanks Andy, again invaluable for a simple thing and to see how it's implimented

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

More
5 years 8 months ago #197729 by andypugh

robertspark wrote: thanks Andy, again invaluable for a simple thing and to see how it's implimented


It would have been better if it was correct.

siggen does not have an "enable" but it does have a "reset" which locks the output to (offset + 0) which is what we want.

I have edited my example.
The following user(s) said Thank You: rodw, Catch22

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

More
5 years 8 months ago - 5 years 8 months ago #197730 by rodw
Andy has proposed a nice elegant solution but you could also use M67/M68 and M62/M63 or M64/M65 which would not require the bash scripts
Code:
net frequency <= motion.analog-output-00 net amplitude <= motion.analog-output-01 net frequency => siggen.0.frequency net amplitude => siggen.0.amplitude net sigenable <= motion.digital-output-00 net sigenable => siggen.0.reset
Ref:
Digital output linuxcnc.org/docs/html/gcode/m-code.html#mcode:m62-m65
Analog output linuxcnc.org/docs/html/gcode/m-code.html#mcode:m67

It just goes to show there are many ways to skin a cat in Linuxcnc.

Wait till we show you how to write your own components if you are that way inclined!
Last edit: 5 years 8 months ago by rodw. Reason: update to use reset
The following user(s) said Thank You: Catch22, robertspark, anfänger

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

More
5 years 8 months ago #197731 by andypugh

rodw wrote: It just goes to show there are many ways to skin a cat in Linuxcnc.


Including, it seems, remapping the "S" command.
linuxcnc.org/docs/html/remap/remap.html#...ng_codes_s_m0_m1_m60

So with a bit of work behind the scenes you could use "M3 S1000 P2 Q20" (or, possibly, any other letters as the control words, but probably not the obvious "F" and "A" as those have specific meanings.)
The following user(s) said Thank You: rodw, Catch22

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

Time to create page: 0.449 seconds
Powered by Kunena Forum