Another servo tuning

More
4 years 6 months ago #240687 by andypugh
Replied by andypugh on topic Another servo tuning
It is possible that these spikes are happening every servo period, and correspond to the position error due to the servo thread latency.
(Though it would have to be an aliasing problem, as there are 200 servo periods per square on the time axis)

You could switch to the approach commonly used with the Mesa stepgens of running them in velocity mode with a PID component. You then run a fixed P of 1000 and FF1 of 1.0 and the servo thread jitter is accounted for a little better.

But: Do you still have encoders? What do you see if you use those for feedback?

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

More
4 years 6 months ago #240882 by myval
Replied by myval on topic Another servo tuning
I have some work for the machine at the moment so I had to go back to original settings and slow it down again.
It is set like servo drives are in position control and linux is set like this:

#*******************
#  AXIS X JOINT 0
#*******************

setp   pid.x.Pgain     [JOINT_0]P
setp   pid.x.Igain     [JOINT_0]I
setp   pid.x.Dgain     [JOINT_0]D
setp   pid.x.bias      [JOINT_0]BIAS
setp   pid.x.FF0       [JOINT_0]FF0
setp   pid.x.FF1       [JOINT_0]FF1
setp   pid.x.FF2       [JOINT_0]FF2
setp   pid.x.deadband  [JOINT_0]DEADBAND
setp   pid.x.maxoutput [JOINT_0]MAX_OUTPUT
setp   pid.x.error-previous-target true
# This setting is to limit bogus stepgen
# velocity corrections caused by position
# feedback sample time jitter.
setp   pid.x.maxerror 0.012700

net    x-index-enable    <=>    pid.x.index-enable
net    x-enable        =>    pid.x.enable
net    x-pos-cmd        =>    pid.x.command
net    x-pos-fb        =>    pid.x.feedback
net    x-output        <=    pid.x.output

# Step Gen signals/setup

setp    hm2_7i95.0.stepgen.00.dirsetup            [JOINT_0]DIRSETUP
setp    hm2_7i95.0.stepgen.00.dirhold            [JOINT_0]DIRHOLD
setp    hm2_7i95.0.stepgen.00.steplen            [JOINT_0]STEPLEN
setp    hm2_7i95.0.stepgen.00.stepspace            [JOINT_0]STEPSPACE
setp    hm2_7i95.0.stepgen.00.position-scale    [JOINT_0]STEP_SCALE
setp    hm2_7i95.0.stepgen.00.step_type            0
setp    hm2_7i95.0.stepgen.00.control-type        1                                #0 position/ 1 velocity
setp    hm2_7i95.0.stepgen.00.maxaccel            [JOINT_0]STEPGEN_MAXACCEL
setp    hm2_7i95.0.stepgen.00.maxvel            [JOINT_0]STEPGEN_MAXVEL

# ---closedloop stepper signals---

net    x-pos-cmd    <=    joint.0.motor-pos-cmd
net    x-vel-cmd    <=    joint.0.vel-cmd
net    x-output    =>    hm2_7i95.0.stepgen.00.velocity-cmd
net    x-pos-fb    =>    joint.0.motor-pos-fb
net    x-enable    <=    joint.0.amp-enable-out
net    x-enable    =>    hm2_7i95.0.stepgen.00.enable

# ---Encoder feedback signals/setup---

#setp    hm2_7i95.0.encoder.muxed-sample-frequency 2000000

setp    hm2_7i95.0.encoder.00.counter-mode            0
setp    hm2_7i95.0.encoder.00.filter                1
setp    hm2_7i95.0.encoder.00.index-invert            0
setp    hm2_7i95.0.encoder.00.index-mask            0
setp    hm2_7i95.0.encoder.00.index-mask-invert        0
setp    hm2_7i95.0.encoder.00.scale                    [JOINT_0]ENCODER_SCALE

net    x-pos-fb        <=    hm2_7i95.0.encoder.00.position
net    x-vel-fb        <=    hm2_7i95.0.encoder.00.velocity
net    x-index-enable    joint.0.index-enable    <=>    hm2_7i95.0.encoder.00.index-enable
net x-pos-rawcounts        <=  hm2_7i95.0.encoder.00.rawcounts

If I don't use linear scales as feedback it drifts (X axis to the left/ negative direction)

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

Time to create page: 0.303 seconds
Powered by Kunena Forum