On Sat, 3 Oct 2009, Eric H. Johnson wrote:

> Date: Sat, 3 Oct 2009 11:11:35 -0400
> From: Eric H. Johnson <ejohn...@camalytics.com>
> Reply-To: "Enhanced Machine Controller (EMC)"
>     <emc-users@lists.sourceforge.net>
> To: "'Enhanced Machine Controller (EMC)'" <emc-users@lists.sourceforge.net>
> Subject: [Emc-users] PWM tuning with hostmot2 and 7i33
> 
> 2> Tuning the servo motors
>
> I am using the 7i43 Anything I/O card with the 7i33 quad analog servo
> interface.
>
> I am having a devil of a time getting anything close to smooth motion from
> the motors in the PID tuning. I start, as I usually do by bringing up P, but
> I start to get oscillations with a P value of about 20. If I use this value
> to have it move to a position, it will over or undershoot the position by
> 1/2" (2500 encoder counts or 6/10ths of a turn of the motor shaft). The
> motor is not coupled to the load at this point. Increasing P to about 160
> stiffens it up to the point where one would think it would get within an
> encoder count or two of the demanded position, however there is still a
> strong oscillation of about +/- 0.1" (500 encoder counts or roughly 1/10th
> turn of the motor shaft).
>
> I then try bringing up I and D, but it is generally making little difference
> until the values are large enough that it makes it worse. The basic problem
> is that it is so bad I am having trouble even establishing a starting point
> from which it will get better or worse. This is a retrofit of a system which
> previously used a Galil 1800 series motion controller, and where tuning with
> that system was no big deal. Galil does have a rather nice piece of tuning
> software, but I don't recall even needing that.

My opinion is that you should _NEVER_ use _ANY_ I until you are within a gnats 
eyelash of perfect tuning. It really just gets in the way.

I would make a test fixture so you can take a step motion, increase P until it 
overshoots in response to the step, add D until theres no or very little 
overshoot and repeat (increasing P and D) until you get good response to the 
step input.

Then I would make another test with a long cruise, and adjust FF1 for minimum 
error.

Only at this point would I start adding some I

>
> Additionally, about six months ago I replaced an EMC system using the VTI
> board (plus a 5i20 which only drove the laser) to use exclusively the 5i20
> and 7i33 with the hostmot2 drivers. With the VTI card, tuning was a snap
> because it ran smoothly for a large range of PID values. When I switched it
> over to the 5i20, I again had a devil of a time getting it tuned, but
> finally got something reasonably acceptable, but never as good as when using
> the VTI board. It will still occasionally hum at idle for example, which
> never happened under the previous configuration.
>
> At the time, I thought it might be due to the PWM frequency, which I had to
> set to 25Khz, as that was the maximum frequency acceptable to the laser.
> With this configuration, there is no laser, so I have pwm_frequency set to
> 193Khz and pdm_frequency set to 6Mhz.

PDM at 6 MHz is correct, but is it selected (PWM is default)

>
> I keep thinking it is some value other than the PID values which is throwing
> me, but so far I do not see it. I have included the relevant sections of the
> ini and hal files for the axis I am trying to tune below.
>
> ------------------------->ini file<---------------------------------
> [AXIS_1]
>
> TYPE =                                        LINEAR
> HOME =                                        0.000
> MAX_VELOCITY =                       10.0
> MAX_ACCELERATION =           40.0
> BACKLASH =                               0.000
> INPUT_SCALE =                        -5555
> OUTPUT_SCALE =                    1.000
> OUTPUT_OFFSET =                      0.0
> MIN_LIMIT =                                  0.0
> MAX_LIMIT =                            180.0
> FERROR =                                    100.0
> MIN_FERROR =                             0.4
> HOME_OFFSET =                        0.10
> HOME_SEARCH_VEL =             0.10
> HOME_LATCH_VEL =               -0.01
> HOME_USE_INDEX =                  NO
> HOME_IGNORE_LIMITS =        YES
> MAX_OUTPUT =                           1.0
> # PID tuning params
> DEADBAND =                      0.000015
> P =                                               150.00
> I =                                                       0.0
> D =                                                   0.00
> FF0 =                                             0.000
> FF1 =                                             1.000
> FF2 =                             0.0
> BIAS =                                           0.000
> ------------------------->ini file<---------------------------------
>
> ------------------------->hal file<---------------------------------
> # standard components
> loadrt pid num_chan=3
>
> addf pid.0.do-pid-calcs                    servo-thread
> addf pid.1.do-pid-calcs                    servo-thread
> addf pid.2.do-pid-calcs                    servo-thread
>
> setp hm2_7i43.0.pwmgen.pwm_frequency       193000
> setp hm2_7i43.0.pwmgen.pdm_frequency       6000000
>
Heres probably a minor problem, are you using PWM or PDM?

If you are using PWM with 193 KHz you will only have 10 bits of resolution
With the 7I33, PDM at 6 MHz is the suggested mode (so the PWM setting is 
irrelevant) PDM will get you 13 bit resolution over the +-10V span, but I dont 
see where you are choosing PDM mode...



>
> # ################
> # Y [1] Axis
> # ################
>
> # axis enable chain
> newsig emcmot.01.enable bit
> sets emcmot.01.enable FALSE
> net emcmot.01.enable => pid.1.enable
> net emcmot.01.enable => hm2_[HOSTMOT2](BOARD).0.pwmgen.01.enable
> # net YEnable => hm2_[HOSTMOT2](BOARD).0.pwmgen.01.enable
> net emcmot.01.enable <= axis.1.amp-enable-out
>
> # encoder feedback
> setp hm2_[HOSTMOT2](BOARD).0.encoder.01.counter-mode 0
> setp hm2_[HOSTMOT2](BOARD).0.encoder.01.filter 1
> setp hm2_[HOSTMOT2](BOARD).0.encoder.01.index-invert 0
> setp hm2_[HOSTMOT2](BOARD).0.encoder.01.index-mask 0
> setp hm2_[HOSTMOT2](BOARD).0.encoder.01.index-mask-invert 0
>
> setp  hm2_[HOSTMOT2](BOARD).0.encoder.01.scale  [AXIS_1]INPUT_SCALE
> net motor.01.pos-fb hm2_[HOSTMOT2](BOARD).0.encoder.01.position =>
> pid.1.feedback
> net motor.01.pos-fb => axis.1.motor-pos-fb #push copy back to Axis GUI
>
> # set PID loop gains from inifile
> setp pid.1.Pgain [AXIS_1]P
> setp pid.1.Igain [AXIS_1]I
> setp pid.1.Dgain [AXIS_1]D
> setp pid.1.bias [AXIS_1]BIAS
> setp pid.1.FF0 [AXIS_1]FF0
> setp pid.1.FF1 [AXIS_1]FF1
> setp pid.1.FF2 [AXIS_1]FF2
> setp pid.1.deadband [AXIS_1]DEADBAND
> setp pid.1.maxoutput [AXIS_1]MAX_VELOCITY
>
> # position command signals
> setp hm2_[HOSTMOT2](BOARD).0.pwmgen.01.output-type 1 #pwm on pin1, dir on
> pin2
> setp hm2_[HOSTMOT2](BOARD).0.pwmgen.01.scale [AXIS_1]OUTPUT_SCALE
>
> net emcmot.01.pos-cmd axis.1.motor-pos-cmd => pid.1.command
> net motor.01.command  pid.1.output  =>
> hm2_[HOSTMOT2](BOARD).0.pwmgen.01.value
> # net YVel => hm2_[HOSTMOT2](BOARD).0.pwmgen.01.value
> ------------------------->hal file<---------------------------------
>
> Any ideas would be appreciated,
> Eric
>

Peter Wallace
Mesa Electronics

(\__/)
(='.'=) This is Bunny. Copy and paste bunny into your
(")_(") signature to help him gain world domination.


------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to