It turns out the most reliable way for Linuxcnc to control a hardware stepgen 
(like is used in a Mesa card (like your 6i25) is to treat it like a sudo servo 
using a PID loop to close a position loop between Linuxcnc and the hardware 
stepgenerator.  Supposedly this helps to cancel out some problems caused by 
variance latency times.  Since this isn't a true servo loop, there is no tuning 
of the PID numbers, they are precisely calculated from known variables, so you 
do not need to mess with the default settings for the PID.

The hardware stepgen is capable of working with pure position commands also 
(without using the PID).  But smarter minds than me figured out a long time ago 
that the other way works slightly better.   So I'd suggest leaving it be.

It also has the advantage of, if you decide to add real position feedback for a 
true closed loop system, every thing you need is already set up in the config.  
All you need to do is replace the stepgen's  position feedback with the real 
postiong feedback, then retune the PID loop. 

Todd Zuercher
P. Graham Dunn Inc.
630 Henry Street 
Dalton, Ohio 44618
Phone:  (330)828-2105ext. 2031

-----Original Message-----
From: Ed W <li...@wildgooses.com> 
Sent: Wednesday, February 26, 2020 12:58 PM
To: Enhanced Machine Controller (EMC) <emc-users@lists.sourceforge.net>
Subject: [Emc-users] Making progress

[EXTERNAL EMAIL] Be sure links are safe.

Hi, I've made good progress converting my little OmioCNC X6 from Mach3 to 
LinuxCNC. I think I owe a writeup at some point, but I still have a few 
glitches before I'm ready to do that.

First thing which I'm worrying about is that having run pncconf, it generates 
an output for my open loop steppers which involves a PID type setup, eg here is 
my X axis from the ini


    [AXIS_X]
    MAX_VELOCITY = 100.0
    MAX_ACCELERATION = 750.0
    MIN_LIMIT = -0.01
    MAX_LIMIT = 355.0

    [JOINT_0]
    TYPE = LINEAR
    HOME = 0.0
    FERROR = 1.0
    MIN_FERROR = 0.01
    MAX_VELOCITY = 100.0
    MAX_ACCELERATION = 750.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 = 125.00
    STEPGEN_MAXACCEL = 937.50
    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
    # these are in nanoseconds
    DIRSETUP   = 10000
    DIRHOLD    = 10000
    STEPLEN    = 5000
    STEPSPACE  = 5000
    STEP_SCALE = 320.0
    MIN_LIMIT = -0.01
    MAX_LIMIT = 355.0
    HOME_OFFSET = -5.000000
    HOME_SEARCH_VEL = -33.333333
    HOME_LATCH_VEL = 0.500000
    HOME_FINAL_VEL = 33.333333
    HOME_USE_INDEX = NO
    HOME_IGNORE_LIMITS = YES
    HOME_SEQUENCE = 1


The corresponding .hal (again by pncconf) is as follows:


    #*******************
    #  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
    setp   pid.x.maxerror .0005

    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_5i25.0.stepgen.00.dirsetup        [JOINT_0]DIRSETUP
    setp   hm2_5i25.0.stepgen.00.dirhold         [JOINT_0]DIRHOLD
    setp   hm2_5i25.0.stepgen.00.steplen         [JOINT_0]STEPLEN
    setp   hm2_5i25.0.stepgen.00.stepspace       [JOINT_0]STEPSPACE
    setp   hm2_5i25.0.stepgen.00.position-scale  [JOINT_0]STEP_SCALE
    setp   hm2_5i25.0.stepgen.00.step_type        0
    setp   hm2_5i25.0.stepgen.00.control-type     1
    setp   hm2_5i25.0.stepgen.00.maxaccel [JOINT_0]STEPGEN_MAXACCEL
    setp   hm2_5i25.0.stepgen.00.maxvel [JOINT_0]STEPGEN_MAXVEL
    setp   hm2_5i25.0.stepgen.00.step.invert_output   true
    setp   hm2_5i25.0.stepgen.00.direction.invert_output   true

    # ---closedloop stepper signals---

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

    # ---setup home / limit switch signals---

    net min-home-x     =>  joint.0.home-sw-in
    net min-home-x     =>  joint.0.neg-lim-sw-in
    net x-pos-limit     =>  joint.0.pos-lim-sw-in


What would someone experienced recommend I do here? This is a simple openloop 
stepper machine, no feedback or position sensors. Just a 6i25 to a basic 
breakout board, going to a chinese 556 stepper driver clone and onto some small 
steppers on a 6040 type of machine?

Is there any disadvantage (or advantage) to leaving all the PID and closed loop 
stuff in here?


Thanks

Ed W



_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to