NEWS
LinuxCNC 2.5.2 Release
There are no translations available.

LinuxCNC 2.5.2 Update Released (changelog).
 
LinuxCNC 2.5.1 Release
There are no translations available.

LinuxCNC 2.5.1 Update Released (changelog). If the Package Manager does not prompt you to upgrade see this page.

 
LinuxCNC 2.5.0 Release
There are no translations available.

New major release (changelog). See the instructions to update your system from EMC 2.4 to LinuxCNC 2.5.
 
Home Forum Configuring LinuxCNC Advanced Configuration Mesa 7i77 and linear encoder tuning PID.

Welcome, Guest
Username: Password: Remember me

TOPIC: Mesa 7i77 and linear encoder tuning PID.

Re:Mesa 7i77 and linear encoder tuning PID. 21 Auo 2012 04:50 #23472

  • VNR
  • VNR's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 59
  • Thank you received: 2
  • Karma: 5
I set Cn-28 to 1 for the traces you see with the motor off the lathe, this seemed to help.
The range is 1 to 100, try with another values to see what happens.
Ok ... lets try “Chapter 3-5-8: Torque Feed-forward Function”
So, I use one of the 6 servo analogue outs connected to Tref.
I’m guessing something like:
net x-enable => pid.x.enable
net x-output => pid.x.output
net x-pos-cmd => pid.x.command
net x-vel-fb => pid.x.feedback-deriv
net x-pos-fb => pid.x.feedback
net x-Torque_Feed-forward => pid.x?????????????
HAL connection example:
net x-torque-ff pid.x.commandDD => hm2_5i25.0.7i77.0.1.analogout1
or
net x-torque-ff pid.x.errorD => hm2_5i25.0.7i77.0.1.analogout1
setp hm2_5i25.0.7i77.0.1.analogout0-scalemax [AXIS_0] Torque_Feed-forward_OUTPUT_SCALE
setp hm2_5i25.0.7i77.0.1.analogout0-minlim [AXIS_0] Torque_Feed-forward_OUTPUT_MIN_LIMIT
setp hm2_5i25.0.7i77.0.1.analogout0-maxlim [AXIS_0] Torque_Feed-forward_OUTPUT_MAX_LIMIT
net x-Torque_Feed-forward => hm2_5i25.0.7i77.0.1.analogout1
[AXIS_0]Torque_Feed-forward_OUTPUT_SCALE must be in INI file and in this case must be analogout1 not analogout0

Manual says: loadrt pid .... debug=1. I have never used that, so check to see what happens.
pid.N.errorD float ro (only if debug=1) Derivative of error. This is the value that is multiplied by Dgain to produce the Derivative term of the output.
pid.N.commandDD float ro (only if debug=1) Second derivative of command. This is the value that is multiplied by FF2 to produce the second order feed-forward term of the output.

Connect the hal oscilloscope to check to have values only on the accelerating/decelerating phase of the move. Must be 0 during the constant velocity phase of the trajectory. If this is not OK, we have to choose another output parameter of the PID or correct them doing some mathematics.
The administrator has disabled public write access.

Re:Mesa 7i77 and linear encoder tuning PID. 21 Auo 2012 09:10 #23497

  • ROG
  • ROG's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 61
  • Karma: 0
andypugh wrote:
ROG wrote:
what dictates if I’m in Velocity mode or torque mode in HAL .......????
I would hate to think I’m wasting my time and everybody else’s trying to tune a drive to respond in velocity mode output if Linuxcnc thinks it’s in torque mode!

HAL is a Hardware Abstraction Layer. It really does not care what the numbers mean. HAL itself has no concept of the difference between the different types of control.

If you have
net vel-cmd => pid.0.command
net fb encoder.0.velocity => pid,0.feedback
then that would be a velocity control loop. In this case vel-cmd would need to be derived from a higher-level PID controller, as the LinuxCNC Motion module only outputs position commands.

My config, when it is all together will have lines like

net cmd axis.0.motor-pos-cmd => pid.0.command
net fb encoder.0.position => pid.0.feedback
net drive pid.0.output => hm2_5i23.0.8i20.0.0.current

That's a direct position-to-current loop. It might not work very well. Time will tell.

OK .... I get the subtle differences between the two.

It’s a steep learning curve, when starting from scratch, even using Linux for the first time.
I confess that I haven’t entirely grasped the concept of “net this” and “setp that” in its entirety.
I’m sure it will all just click at some point.

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!)
The administrator has disabled public write access.

Re:Mesa 7i77 and linear encoder tuning PID. 21 Auo 2012 09:24 #23498

  • ROG
  • ROG's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 61
  • Karma: 0
"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.
The administrator has disabled public write access.

Re:Mesa 7i77 and linear encoder tuning PID. 21 Auo 2012 15:04 #23518

  • andypugh
  • andypugh's Avatar
  • NOW ONLINE
  • Moderator
  • Posts: 4146
  • Thank you received: 141
  • Karma: 130
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)
The administrator has disabled public write access.

Re:Mesa 7i77 and linear encoder tuning PID. 23 Auo 2012 00:45 #23570

  • ROG
  • ROG's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 61
  • Karma: 0
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.
The administrator has disabled public write access.

Re:Mesa 7i77 and linear encoder tuning PID. 23 Auo 2012 07:14 #23578

  • VNR
  • VNR's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 59
  • Thank you received: 2
  • Karma: 5
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
The administrator has disabled public write access.
Time to create page: 1.048 seconds
Powered by Kunena Forum
© 2013 LinuxCNC.org
Joomla! is Free Software released under the GNU General Public License.