Configuration for rotary axis (7i76, stepper+encoder)

More
9 years 5 months ago #93178 by Marc_P
Hello
I have a problem to get my rotary axis to run.
I use a 5i25 with a 7i76. The stepper is connected with a pulley (ratio 1:6). On the other end of the stepper shaft is a Nanotec Encoder (WEDL5541B with 1000 CPR see here: en.nanotec.com/products/186-wedswedl-55413-channel-encoder/ ) directly fitted and connected to the 7i76 Encoder input (TB3 PIN 7-14).

HAL
Code:
#******************* # AXIS A #******************* setp pid.a.Pgain [AXIS_3]P setp pid.a.Igain [AXIS_3]I setp pid.a.Dgain [AXIS_3]D setp pid.a.bias [AXIS_3]BIAS setp pid.a.FF0 [AXIS_3]FF0 setp pid.a.FF1 [AXIS_3]FF1 setp pid.a.FF2 [AXIS_3]FF2 setp pid.a.deadband [AXIS_3]DEADBAND setp pid.a.maxoutput [AXIS_3]MAX_OUTPUT setp pid.a.error-previous-target true setp pid.a.maxerror 0 net a-index-enable <=> pid.a.index-enable net a-enable => pid.a.enable net a-pos-cmd => pid.a.command net a-vel-cmd => pid.a.command-deriv net a-pos-fb => pid.a.feedback net a-output => pid.a.output # Step Gen signals/setup setp hm2_5i25.0.stepgen.03.dirsetup [AXIS_3]DIRSETUP setp hm2_5i25.0.stepgen.03.dirhold [AXIS_3]DIRHOLD setp hm2_5i25.0.stepgen.03.steplen [AXIS_3]STEPLEN setp hm2_5i25.0.stepgen.03.stepspace [AXIS_3]STEPSPACE setp hm2_5i25.0.stepgen.03.position-scale [AXIS_3]STEP_SCALE setp hm2_5i25.0.stepgen.03.step_type 0 setp hm2_5i25.0.stepgen.03.control-type 1 setp hm2_5i25.0.stepgen.03.maxaccel [AXIS_3]STEPGEN_MAXACCEL setp hm2_5i25.0.stepgen.03.maxvel [AXIS_3]STEPGEN_MAXVEL # ---closedloop stepper signals--- net a-pos-cmd <= axis.3.motor-pos-cmd net a-vel-cmd <= axis.3.joint-vel-cmd net a-output <= hm2_5i25.0.stepgen.03.velocity-cmd #net a-pos-fb <= hm2_5i25.0.stepgen.03.position-fb net a-pos-fb => axis.3.motor-pos-fb net a-enable <= axis.3.amp-enable-out net a-enable => hm2_5i25.0.stepgen.03.enable # ---Encoder feedback signals/setup--- setp hm2_5i25.0.encoder.00.counter-mode 0 setp hm2_5i25.0.encoder.00.filter 1 setp hm2_5i25.0.encoder.00.index-invert 0 setp hm2_5i25.0.encoder.00.index-mask 0 setp hm2_5i25.0.encoder.00.index-mask-invert 0 setp hm2_5i25.0.encoder.00.scale [AXIS_3]ENCODER_SCALE net a-pos-fb <= hm2_5i25.0.encoder.00.position net a-vel-fb <= hm2_5i25.0.encoder.00.velocity net a-pos-fb => axis.3.motor-pos-fb net a-index-enable axis.3.index-enable <=> hm2_5i25.0.encoder.00.index-enable net a-pos-rawcounts <= hm2_5i25.0.encoder.00.rawcounts

INI
Code:
#******************** # Axis A #******************** [AXIS_3] TYPE = ANGULAR HOME = 0.0 FERROR = 10 MIN_FERROR = 1 MAX_VELOCITY = 360.0 MAX_ACCELERATION = 360.0 # The values below should be 25% larger than MAX_VELOCITY and MAX_ACCELERATION # If using BACKLASH compensation STEPGEN_MAXACCEL should be 100% larger. STEPGEN_MAXVEL = 450.00 STEPGEN_MAXACCEL = 450.00 P = 1000.0 I = 0.0 D = 0.0 FF0 = 0.0 FF1 = 1.0 FF2 = 0.0 BIAS = 0.0 DEADBAND = 0.0 MAX_OUTPUT = 0.0 ENCODER_SCALE = -66.6666 # these are in nanoseconds DIRSETUP = 2500 DIRHOLD = 2500 STEPLEN = 5000 STEPSPACE = 5000 STEP_SCALE = 33.3333 MIN_LIMIT = -999900.0 MAX_LIMIT = 999900.0 HOME_OFFSET = 0.0

My problem is that the stepper is flickering at the end of the position command and I don't know why and what setting can be useful to change.:(
I have uploaded a video to demonstrate:


Hope you understand my problem and have a idea for me.

Greetings
Marc

Please Log in to join the conversation.

More
9 years 5 months ago #93181 by tommylight
That is normal as you have to do some PID tuning, there are some nice tutorials here on the forum for that.
Start by adding a deadband value of 0.05, then lower the P value till you get no oscilation.
That is a servo system so it has to be tuned as such, although it uses a stepper motor.

Please Log in to join the conversation.

More
9 years 5 months ago #93186 by PCW
As tommylight says, you need to tune the PID parameters (mainly P)

The P value of 1000 is appropriate for open loop step motor systems since the position feedback comes from the
step generator and has close to zero delay in responding to velocity commands (since its electronic)

You have a real servo system with magnetic and inertial delays between command and feedback.
This means you can not have as high a P term and remain stable.

Please Log in to join the conversation.

More
9 years 5 months ago #93189 by Marc_P
Thanks to you. That help me further.
Now I must tune the axis and hope that I get a closed loop system.
A quick test -> Only with the deadband value I get the oscilation away but then if I move the axis for 1mm (degree?) the DRO shows different values. For exampe (with deadband 0.02) 1.000 / 2.010 / 3.000 / 3.990 / 5.010 / 6.015.
Can these values be right? And do you think a closed loop with my stepper and rotary encoder can work or is this thought completly nonsense?:unsure:

Marc

Please Log in to join the conversation.

More
9 years 5 months ago #93190 by PCW
Those values are expected with a deadband of .02 degrees (they are within +-.02 degrees)
Also consider that the step drives as configured can only resolve .03 degrees ( at stepscale = 33.333 steps/degree )
You could get a bit more resolution if you could increase the microstep ratio of the drive, but then the encoder resolution of .015 degrees would become the limitation.

If you dislike seeing the minor errors in actual step motor position, you could always set Axis to display
commanded position instead of feedback position (an option in the "View" menu)

Please Log in to join the conversation.

Time to create page: 0.083 seconds
Powered by Kunena Forum