Orient tuning, no spindle lock/brake

More
09 Nov 2021 18:44 - 09 Nov 2021 18:48 #225863 by Michael
Trying to finalize the orient with M19 and have everything really close. Currently when I orient the spindle will hold in a range of 3 encoder counts (+-.18 degrees) Spindle has a 500 quadrature encoder so its 2000ppr with an index. This accuracy is sufficient enough to trigger the default value for "orient.is-oriented". This disables the orient component and the spindle enable is shut off. 

When this happens the spindle "kicks" slightly once power is released. 1 out of 10 times this "kick" is as much as 10 or more encoder counts or almost 2 degrees. Since there is no mechanical spindle brake or lock to hold it in place the orient is very inconsistent. 

I have been up and down the tuning of the pid and can't get rid of the last little flutter that causes this kick when power is released. Any ideas?

Current tuning:
P = 5100.0
I = 300.0
D = 85.0
FF0 = 0.0
FF1 = 0.0
FF2 = 0.0
BIAS = 0.0
DEADBAND = 0.0
MAX_OUTPUT = 800.0
Attachments:
Last edit: 09 Nov 2021 18:48 by Michael.

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

More
09 Nov 2021 19:14 #225864 by PCW
Does it still "kick" if you disable the PID when orient is complete?

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

More
09 Nov 2021 19:32 - 09 Nov 2021 19:33 #225865 by Michael
net spindle-in-pos <= orient.is-oriented
net spindle-in-pos => spindle.0.is-oriented

This clears the original enable and moves out of M19. This is when it kicks. Is there a better way to do it? Any ideas on how to get it to settle on the final encoder count, deadband didn't work.
Last edit: 09 Nov 2021 19:33 by Michael.

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

More
09 Nov 2021 19:45 #225866 by andypugh
As an alternative to what PCW suggested, perhaps the answer is to leave the PID enabled.

In either case, I think we need to look at the pid enable logic.

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

More
09 Nov 2021 20:00 #225869 by Michael
I was tossing around the idea of keeping the PID on to hold the spindle till the tool change was complete. I may have over thought it however. What I came up with was a second orient component that would be activated by:

net orient-brake-enable spindle.0.locked => orient.brake.enable

and then use the same PID loop and would be cleared at the end of the toolchange.ngc with an M5

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

More
09 Nov 2021 23:34 #225896 by andypugh
You can probably just enable the PID with an or2 component on the current pin (spindle.0.orient?) and spindle.0.locked

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

More
09 Nov 2021 23:59 - 10 Nov 2021 00:52 #225899 by Michael
I see what you are getting at. Very much simpler then the way I had been thinking. Will that work even though the orient.enable gets shut off?

I did go go through with making a secondary orient component to hold the spindle for the duration of the tool change. In the process of doing so I realized what may be causing some of my issue. I have a bunch of stuff out of order.

net spindle-output        mux2.0.out  =>  hm2_7i92.0.7i77.0.1.analogout5

Is at the top with orient pid below it. The orient-pid.output is above the actual orient-pid and a bunch of other stuff. Does this cause the PID calculations to be off since it will have to go through a couple servo threads to read/write values? I noticed that when I added the second orient comp that my pid tuning was way off. The second component was hacked even more then the first one.

Update: I tried to or2 the spindle.0.orient and spindle.0.locked to the orient-pid.enable but that didn't prevent the kick. It also did not cause the spindle to hold position. Just completed orientation with spindle.0.lock on
Last edit: 10 Nov 2021 00:52 by Michael.

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

More
10 Nov 2021 00:56 #225900 by PCW
The order of the net statements is not important, but the order of the addf's is critical
to avoid pipeline delays. Any PID input  processing components should be addf'ed
before the PID component, and any PID output processing components, should be addf'ed
after the PID component (but before the hm2_xxx write)
 
The following user(s) said Thank You: Michael

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

More
10 Nov 2021 01:27 #225904 by Michael
So then:
addf orient should be above
addf orient-pid.do-pid-calcs

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

More
10 Nov 2021 02:31 - 10 Nov 2021 02:40 #225912 by Michael
Thank you.

I got this working. And was able to create an electronic brake for the spindle through the single orient component. I was not able to get rid of the kick that happened when the orient-pid disabled or remove the couple encoder count wiggle that is present on the position loop. These are my pid settings:
P = 6000
I = 300
D = 90
FF0 = 0
FF1 = 0
FF2 = 0
BIAS = 0
DEADBAND = 0
MAX_OUTPUT = 800

Anything higher than that and the problem would only get worse. Any reason why it can't hold dead on at the index? Here is the relevant section of hal to create the electric spindle break. In a nut shell spindle.o.orient and spindle.0.locked will both enable the entire orient component. The first one starts the sequence and the next one holds the spindle after orient is complete. The toolchange.ngc will clear the whole sequence with an M5 at the end. It will also spin the spindle for half a second the first time a tool change is requested to get the spindle-index-enable correct.
Hal snip:
#   M19 trigger orient.enable; orient-pid enable; spinena; select analogout
net spindle-orient    <=  spindle.0.orient
net spindle-orient    =>  or2.1.in0        #to orient enable
net spindle-orient    =>  and2.0.in0        #to spindle is oriented

net orient-lock        <=  spindle.0.locked
net orient-lock        =>  or2.1.in1        #to orient ennable

net orient-enable    <=  or2.1.out
net orient-enable    =>  orient.enable
net orient-enable    =>  orient-pid.enable
net orient-enable    =>  or2.0.in1        #to spindle enable
net orient-enable    =>  mux2.0.sel

#   M19 orient angle R in to orient component
net orient-angle    spindle.0.orient-angle  =>  orient.angle

#   M19 orient mode P in to orient component default 0
net orient-mode    spindle.0.orient-mode  =>  orient.mode


setp   orient-pid.Pgain             [TUNE]P
setp   orient-pid.Igain             [TUNE]I
setp   orient-pid.Dgain             [TUNE]D
setp   orient-pid.bias              [TUNE]BIAS
setp   orient-pid.FF0               [TUNE]FF0
setp   orient-pid.FF1               [TUNE]FF1
setp   orient-pid.FF2               [TUNE]FF2
setp   orient-pid.deadband          [TUNE]DEADBAND
setp   orient-pid.maxoutput         [TUNE]MAX_OUTPUT
setp   orient-pid.error-previous-target true

setp orient.tolerance 0.36

#   Encoder position into orient component and orient pid
net spindle-revs    =>  orient.position
net spindle-revs    =>  orient-pid.feedback

#   Orient component position into orient pid
net orient-command    orient.command  =>  orient-pid.command

#   Orient pid output to spindle analog
net spindle-orient-output    orient-pid.output  =>  mux2.0.in1

#   Orient component return that orient is complete
net orient-complete    <=  orient.is-oriented
net orient-complete    =>  and2.0.in1
net spindle-is-oriented    <=  and2.0.out
net spindle-is-oriented    =>  spindle.0.is-oriented

# spindle output is based on mux2 and sel bit
net spindle-vel-output        =>  mux2.0.in0
net spindle-output        mux2.0.out  =>  hm2_7i92.0.7i77.0.1.analogout5

# spindle enable from or2; either spindle-vel-enable or orient-enable
net spindle-vel-enable        =>  or2.0.in0
net spindle-enable        or2.0.out  =>  hm2_7i92.0.7i77.0.1.spinena
Attachments:
Last edit: 10 Nov 2021 02:40 by Michael.

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

Time to create page: 0.079 seconds
Powered by Kunena Forum