Spindle speed variation ssv for chatter control

More
04 Feb 2021 22:35 - 04 Feb 2021 23:35 #197689 by PCW
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
Last edit: 04 Feb 2021 23:35 by PCW. Reason: even more minimal
The following user(s) said Thank You: Catch22, robertspark

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

  • rodw
  • rodw's Avatar
  • Away
  • Platinum Member
  • Platinum Member
More
05 Feb 2021 04:43 #197705 by rodw
I started to look at this but PCW has done it already. If you read the docs
linuxcnc.org/docs/devel/html/man/man9/siggen.9.html
and review what each pin does will clarify what is happening.
The following user(s) said Thank You: Catch22

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

More
05 Feb 2021 11:09 #197722 by robertspark
Replied by robertspark on topic Spindle speed variation ssv for chatter control

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
05 Feb 2021 11:14 - 05 Feb 2021 11:41 #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.
#! /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
M100 P2 Q20
would enable the feature at 2Hz and 20 rpm amplitude.

You might also want an M101 to turn it off
#! /bin/bash
halcmd setp siggen.0.reset 1
return 0
Last edit: 05 Feb 2021 11:41 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
05 Feb 2021 11:21 #197724 by robertspark
Replied by robertspark on topic Spindle speed variation ssv for chatter control
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
05 Feb 2021 11:43 #197729 by andypugh

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.

  • rodw
  • rodw's Avatar
  • Away
  • Platinum Member
  • Platinum Member
More
05 Feb 2021 11:43 - 05 Feb 2021 11:46 #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
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: 05 Feb 2021 11:46 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
05 Feb 2021 11:52 #197731 by andypugh

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.

  • rodw
  • rodw's Avatar
  • Away
  • Platinum Member
  • Platinum Member
More
05 Feb 2021 12:08 #197733 by rodw

So with a bit of work behind the scenes you could use "M3 S1000 P2 Q20"


Steady up Andy, you'll have poor old Robert's head spinning!

But it is an interesting concept to explore... If you tried them all, you would learn a lot about Linuxcnc.
The following user(s) said Thank You: Catch22

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

More
05 Feb 2021 13:49 #197742 by robertspark
Replied by robertspark on topic Spindle speed variation ssv for chatter control

So with a bit of work behind the scenes you could use "M3 S1000 P2 Q20"


Steady up Andy, you'll have poor old Robert's head spinning!

But it is an interesting concept to explore... If you tried them all, you would learn a lot about Linuxcnc.


Thanks Gents

Not too many options please, head is already spinning and I am just starting out. Give it 6-12m and maybe I'll get to advance to the next class.

(too many options in Linux (not just the cnc bit) that becomes overwhelming to new users, yes I know it's flexibility and options.... sometimes just learning the basics is useful [I only learnt to use TAB in terminal to auto fill in the file names a month ago + '&' to start an instance using the same terminal window....... {I just can't remember how you start multiple instances from 1 terminal {something like '&6' but it didn't like that when I tried it}) All new stuff and good stuff to learn.

(I'd like to get into components but its baby steps + need, LCNC has so many options / components already, I can't think of something I need that doesn't already exist {yet})
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.159 seconds
Powered by Kunena Forum