Hi Tom,
Can you see it is nearly unstable?
Yes, I could see that, I just got excited with the progress and shot off that reply, sorry about that.
Describe what you did and what happened, not just the final plot.
Again, I apologies, I took too many things for granted and assumed that you'd be able to decipher things without giving you enough information.
Follow the steps here.
I went through the link you shared. It’s super comprehensive, and really well laid out, it clarified alot of the confusion I had.
Thank you very much!
I followed the steps and here is a breakup of everything I did and the results.
I connected the Drive and servo using a Kanalog, Kflop and Konnect.
Used the Kanalog for DAC out and Encoder feedback (A,B,Z Channel)
Used the Konnect to enable and disable the drive.
Then using the wiki that you shared I did the following.
1. Opened C Program Screen and ran Init.c to enable the Servo.
Code: Select all
#include "KMotionDef.h"
#include "AdjustSoftLimits.c"
#include "KflopToKMotionCNCFunctions.c"
#define QA 26 // define to which IO bits the AB signals are connected
#define QB 27
main()
{
ch0->InputMode = ENCODER_MODE;
ch0->OutputMode = DAC_SERVO_MODE;
ch0->Vel = 166666;
ch0->Accel = 833333;
ch0->Jerk = 3200000;
ch0->P = 0.09;
ch0->I = 0.00001;
ch0->D = 0;
ch0->FFAccel = 0;
ch0->FFVel = 0.001023;
ch0->MaxI = 2700;
ch0->MaxErr = 1000;
ch0->MaxOutput = 2047;
ch0->DeadBandGain = 0;
ch0->DeadBandRange = 0;
ch0->InputChan0 = 0;
ch0->InputChan1 = 0;
ch0->OutputChan0 = 48;
ch0->OutputChan1 = 48;
ch0->MasterAxis = -1;
ch0->LimitSwitchOptions = 0x100;
ch0->LimitSwitchNegBit = 0;
ch0->LimitSwitchPosBit = 0;
ch0->SoftLimitPos = 1e+09;
ch0->SoftLimitNeg = -1e+09;
ch0->InputGain0 = 1;
ch0->InputGain1 = 1;
ch0->InputOffset0 = 0;
ch0->InputOffset1 = 0;
ch0->OutputGain = 1;
ch0->OutputOffset = 7;
ch0->SlaveGain = 1;
ch0->BacklashMode = BACKLASH_OFF;
ch0->BacklashAmount = 0;
ch0->BacklashRate = 0;
ch0->invDistPerCycle = 1;
ch0->Lead = 0;
ch0->MaxFollowingError = 100000000;
ch0->StepperAmplitude = 20;
ch0->iir[0].B0 = 1;
ch0->iir[0].B1 = 0;
ch0->iir[0].B2 = 0;
ch0->iir[0].A1 = 0;
ch0->iir[0].A2 = 0;
ch0->iir[1].B0 = 1;
ch0->iir[1].B1 = 0;
ch0->iir[1].B2 = 0;
ch0->iir[1].A1 = 0;
ch0->iir[1].A2 = 0;
ch0->iir[2].B0 = 0.016609;
ch0->iir[2].B1 = 0.033219;
ch0->iir[2].B2 = 0.016609;
ch0->iir[2].A1 = 1.60679;
ch0->iir[2].A2 = -0.673229;
InitAux();
AddKonnect(0, &VirtualBits, VirtualBitsEx);
AddKonnect(1, VirtualBitsEx + 1, VirtualBitsEx + 2);
EnableAxis(0);
SetBit(152); // Amp Enable X
SetBit(48); // Enable Servo
}
2. Opened the ‘Configuration’ Screen and loaded KanalogDAC.mot
3. Opened the ‘Step Response’ Screen, set max limits (output to 2000, integrator to 200, error to 20,000) enabled the servo and began tuning.
4. Found Max Velocity: Selected a Large step size (100000), Large Acceleration (10,000,000), Larger Jerk (100,000,000). Plotting and monitoring a ‘Velocity, Output vs Time, secs’ graph, I slowly Increased ’V’ (Velocity) and P (Gain) in small increments until the motor was maxed out, (this was the most frightening I’ve done in my life). Then I dialed back ‘V’ to about 50% of the maximum Velocity and gradually reduced the P Gain till it was just a little more than what was needed for the motor to achieve 50% of its maximum velocity. Ie. 460,000
5. Found Max Acceleration: Plotting and monitoring a ‘Command, Position, Output Command vs Time, Sec’ Graph, I dialed down the value till I noticed that the ‘Red’ (Position Line) Stated to get affected (acceleration slowing down) and from that limit I dialed it down 20%. Ie. 7,200,000
6. Found the Max Jerk: Used the suggestion on your wiki and set J at A/0.020. ie. 360,000,000
7. Increased the Test Move Step ‘time’ to 0.9 second and ‘size’ to 120,000 position units to see the graph more clearly. Tweaked PID and motion profile and finally got this as a result.
8. Using the ‘Position Error, Output vs Time, secs’ graph, I set the ‘Max Following Error’ to 20% more than what was recorded. Ie. 4,800
Here are the screenshots of the ‘Filters’ screen as well
Also here is the resolution that you asked for as well.
~10000 position units per motor rev (disabled the axis and rotated the servo 360 degrees)
1:1 gear reduction from motor to lead screw
0.19685 inch (5 mm) lead screw pitch
Axis Resolution = 10,000 x 1 / 0.19685 = 50,800.1 steps/inch
I have 3 questions.
1. Do you have any feedback on the graph shown in step seven?
2. Also the drive manual states that the drive and motor is capable of (8388608 ppr) but when manually rotating the servo with an input gain of 1 it only records 10,000 position units.
3. Since all tuning begins with setting a maximum velocity and
The KFLOP parameters are used for 3rd order motions. These include things like: Jogging, Homing, and GCode Rapids (G0).
Does this mean that this tuning doesn't affect machine operations (G01 operations) when running a GCODE program?
If so does one need to do any motor tuning or any other procedures to optimize these other operations?