Mesa 7i77 and linear encoder tuning PID.

More
21 Aug 2012 16:24 #23498 by ROG
"The range is 1 to 100, try with another values to see what happens"

I arrived at “1” after trying 1-20 in steps of 1 and 20-100 in step of 2 – with servo on and off the machine - so this isn’t for the lack of trying!

I’ll try some of the examples you ve kindly come up with and see what happens in halscope to start with.
Thankfully the param for the torque ref on the drive is scalable so i can start with small amounts and see what happens.
fingers crossed ...

I’ll report findings.

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

More
21 Aug 2012 22:04 #23518 by andypugh
ROG wrote:

So, as my drives respond (supposedly) by increasing the servo rotational speed, hence velocity of the axis proportionally with the output of PID-X, which relies on velocity from the encoder, for feedback – then as far as my HAL config is concerned, that constitutes velocity mode.
(Bit of a eureka moment for me there!)


Absolutely. (though if the feedback to your HAL PID is really the encoder velocity, then there is a problem :-)

Typically a PID commands something one level removed from the desired quantity. So you command velocity and feed-back position, or command valve PWM and feed-back oil pressure, or command valve position and feed-back coolant temperature. (the last two are not entirely random examples that I am baking in southern italy to test at the moment)

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

More
23 Aug 2012 07:45 #23570 by ROG
Update

Ok ... in ini - I’ve got

[AXIS_0]
Torque_Feed-forward_OUTPUT_SCALE = -100
Torque_Feed-forward_ OUTPUT_MIN_LIMIT -10.0
Torque_Feed-forward_ OUTPUT_MAX_LIMIT 10.0

In HAL I’ve got

loadrt pid names=pid.x,pid.z,pid.s Debug =1

setp hm2_5i25.0.7i77.0.1.analogout3-scalemax [AXIS_0] Torque_Feed-forward_OUTPUT_SCALE
setp hm2_5i25.0.7i77.0.1.analogout3-minlim [AXIS_0] Torque_Feed-forward_ OUTPUT_MIN_LIMIT
setp hm2_5i25.0.7i77.0.1.analogout3-maxlim [AXIS_0] Torque_Feed-forward_ OUTPUT_MAX_LIMIT

net x-torque-ff pid.x.commandDD => hm2_5i25.0.7i77.0.1.analogout3

Basically, I get a square wave “pulse” at the beginning of the move, and the end of the move, pulse width is the same as during the acceleration phase.
analogout3 is connected to the torque ref input on the drive and toque feed forward is enabled.

If I plot pid.x.commandDD in Halscope, it has a value of 350 (regardless of scale)
If I plot hm2_5i25.0.7i77.0.1.analogout3 is showing a value of 350 (regardless of scale)

Although the scaling appears to be working, as I had to add the minus sign as the output was reversed. So despite this scaling appearing to work, the value of pid.x.commandDD & analogout3 is either zero or 350 in Halscope, forming a square wave for the duration of the acceleration period.

Any ideas why 350 seems to be a constant and where this figure comes from? (Just thought .. acceleration is set to 350 in ini)
Any thoughts why analogout3 plots with a value of 350 when it should be scaled?

I haven’t had chance to assess whether this is going to cure the problem yet but it is definitely adding some grunt to the acceleration phase (amoujt of grunt changing with scaling).

I’ll do some more tinkering tonight and upload some plots of the results.

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

More
23 Aug 2012 14:14 #23578 by VNR
May you plot pid.x.error, pid.x.output, encoder velocity, axis.0.axis-vel-com, pid.x.commandDD and pid.N.errorD during the acceleration phase ?
Try to use the same scale in the graph of requested velocity and feedback velocity, is easier to see and analyse. The goal is to match the real velocity to the requested velocity. As example use www.linuxcnc.org/index.php/english/compo...mit=6&start=12#20671

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

More
24 Aug 2012 08:51 #23609 by ROG
A lot going on ...

No tuning as such attempted, just looking at the effect of the torque ref.
You can see the output of a3 which is enabling additional torque at the drive.
The Linear encoder begins moving 3-4 ms after the acceleration ramp begins.
But velocity rapidly fall away as soon as the torque FF us over and the PID wakes up and takes over.


Attachments:

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

More
24 Aug 2012 08:52 #23610 by ROG
Attachments:

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

More
24 Aug 2012 09:01 #23611 by andypugh
The linear encoder lag probably won't matter if you just use that as a "tweak" to the main (rotary encoder) control loop.

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

More
24 Aug 2012 17:04 #23635 by VNR

Any ideas why 350 seems to be a constant and where this figure comes from? (Just thought .. acceleration is set to 350 in ini) Any thoughts why analogout3 plots with a value of 350 when it should be scaled?

It comes from acceleration parameter of the axis in INI file (I supuse it ;) )
It is not scaled because is before the multiplication with FF2. There is no commandDD * FF2 value available at pid component. May be you want to rewrite the source code and add it.

No tuning as such attempted, just looking at the effect of the torque ref.
You can see the output of a3 which is enabling additional torque at the drive.
The Linear encoder begins moving 3-4 ms after the acceleration ramp begins.
But velocity rapidly fall away as soon as the torque FF us over and the PID wakes up and takes over.

1) Use the velocity of the encoder instead of the linear scale for feedback purpose. May be you want to plot both in order to compare them.
2) errorD is not 0 when the velocity is constant. Perhaps you would like to do some mathematics to use errorD and commandDD as input to the torque reference (only in the acceleration/deceleration phase, you have to cut off errorD when commandDD is 0). May be adding some scaling parameters for each will help you to do the tests.

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

More
24 Aug 2012 17:43 #23638 by ROG
“There is no commandDD * FF2 value available at pid component. May be you want to rewrite the source code and add it.”

Sometimes I forget, I set out to make a scale model of an engine … ended up making / rebuilding the machines so I could make the model engine, then configuration of the CNC control and everything that goes with it, so I can control the machine I rebuilt ….. to build the model engine ……. Editing source code for the control and re-compiling is a step too far! I’ve forgotten what it was I set out to do! :S


“1) Use the velocity of the encoder instead of the linear scale for feedback purpose. May be you want to plot both in order to compare them.
2) errorD is not 0 when the velocity is constant. Perhaps you would like to do some mathematics to use errorD and commandDD as input to the torque reference (only in the acceleration/deceleration phase, you have to cut off errorD when commandDD is 0). May be adding some scaling parameters for each will help you to do the tests”


This is way beyond my capabilities, please explain ….. how do I add the two, D and DD and then scale ….

I get the principle … and I get the math’s, I just have no idea how to do that in HAL

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

More
25 Aug 2012 01:05 #23645 by andypugh
ROG wrote:

Sometimes I forget, I set out to make a scale model of an engine … ended up making / rebuilding the machines so I could make the model engine, then configuration of the CNC control and everything that goes with it, so I can control the machine I rebuilt ….. to build the model engine ……. Editing source code for the control and re-compiling is a step too far! I’ve forgotten what it was I set out to do!


I was going to make a clock :-)

However, I quite like writing code, and I just see it as another facet of the same hobby. I like that I can choose to do whatever part of it I fancy at the time.
The clock seems further away than ever, though.

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

Time to create page: 0.110 seconds
Powered by Kunena Forum