Thanks Peter

I made your suggestion and Axis start without error but when I try to move the 
axis nothing happen the motor don't move
If I turn the motor shaft i see the value changing in the axis and put an error 
so  the encoder signal work
did you have a stepmotor closed loop config to compare what wrong on mine
Thanks again for your great help



Cordialement

Moustapha Elhima

Le 5 juin 2014 à 15:37, "Peter C. Wallace" <[email protected]> a écrit :

> On Thu, 5 Jun 2014, ELHIMA Moustapha wrote:
> 
>> Date: Thu, 5 Jun 2014 01:47:43 -0700 (PDT)
>> From: ELHIMA Moustapha <[email protected]>
>> To: "[email protected]" <[email protected]>,
>>    emc2 <[email protected]>
>> Subject: [Emc-users] Step motor in closed loop
>> 
>> 
>> Dear All,
>> 
>> I'm back to get some help, I've tried to use my 2 phases 1.8° 12Nm stepmotor 
>> in closed loop on linuxcnc
>> I have connected 600 lines encoder to get the feedback for my stone
>> lathe. This encoder is connected directly to the back of the motor
>> My driver is a leadshine MD2278 with a selector to set 400 step/rev 
>> (default) to 10000 step/rev so it's possible to adjust the encoder 
>> resolution (2400pts/rev) to the encoder (2400 pulse/rev)
>> 
>> I have tried to use the etch-servo config to control my step motor as servo 
>> motor
>> 
>> When I tried to move the motor I have a fallowing error I have tried to
>> change the parameters in the INI file but it doesn't really change
>> My important axis is the A axis Can someone can give me help ?
>> 
>> There are my config file I've removed the other axis because that will be 
>> same for the other axis :
>> 
>> thanks a lot
>> 
> The step drive needs a step generator tha has step/dir signals, not a PWM 
> generator
> 
> Heres what I would do, using similar servo system hal/ini files
> 
> set your input scale to encoder counts/turn
> set your output scale to step drive steps/turn
> 
> setup a stepgen component in velocity mode (ctrl_type=v)
> setup a pid component
> (FF1 = 1, P = ~50, everything else 0)
> 
> connect the  stepgen.N.velocity pin to the PID output
> 
> set the ferror and min ferror parameters to large values to start
> 
> 
>> HAL
>> 
>> # load realtime modules
>> # kinematics
>> loadrt trivkins
>> loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD 
>> servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES
>> loadrt hal_parport cfg="0x378 out"
>> loadrt encoder num_chan=1
>> loadrt pid num_chan=1
>> loadrt pwmgen output_type=1
>> loadrt ddt count=2
>> loadrt constant count=1
>> 
>> # define the order of
>> execution for RT code
>> addf parport.0.read            base-thread
>> addf encoder.update-counters   base-thread
>> addf pwmgen.make-pulses        base-thread
>> addf parport.0.write           base-thread
>> 
>> 
>> addf encoder.capture-position  servo-thread
>> addf motion-command-handler    servo-thread
>> addf motion-controller         servo-thread
>> addf pid.0.do-pid-calcs        servo-thread
>> addf
>> constant.0                servo-thread
>> addf pwmgen.update             servo-thread
>> addf ddt.0                     servo-thread
>> addf ddt.1                     servo-thread
>> 
>> # hook stuff together
>> newsig Apos-fb float
>> 
>> setp encoder.0.position-scale [AXIS_3]INPUT_SCALE
>> 
>> net enc0A encoder.0.phase-A <= parport.0.pin-10-in
>> net enc0B encoder.0.phase-B <= parport.0.pin-11-in
>> 
>> linksp Apos-fb <= encoder.0.position
>> 
>> newsig Avel-cmd float
>> 
>> linksp Apos-fb => pid.0.feedback
>> linksp Apos-fb => axis.3.motor-pos-fb
>> 
>> linksp Avel-cmd <= pid.0.output
>> 
>> linksp Avel-cmd => pwmgen.0.value
>> 
>> newsigApwm bit
>> linkps pwmgen.0.pwm Apwm
>> 
>> newsig Adir bit
>> 
>> linkps pwmgen.0.dir => Adir
>> 
>> linksp Adir    => parport.0.pin-05-out
>> #linksp Adir    => parport.0.pin-07-out
>> setp parport.0.pin-07-out-invert TRUE
>> linksp Apwm => parport.0.pin-04-out
>> 
>> setp pid.0.maxoutput 1.0
>> 
>> # the values below come from the ini
>> setp pid.0.Pgain [AXIS_3]P
>> setp pid.0.Igain [AXIS_3]I
>> setp pid.0.Dgain [AXIS_3]D
>> setp pid.0.bias [AXIS_3]BIAS
>> setp pid.0.FF0 [AXIS_3]FF0
>> setp pid.0.FF1 [AXIS_3]FF1
>> setp pid.0.FF2 [AXIS_3]FF2
>> setp pid.0.deadband [AXIS_3]DEADBAND
>> 
>> newsig Apos-cmd float
>> linksp Apos-cmd <= axis.3.motor-pos-cmd
>> linkps pid.0.command <= Apos-cmd
>> newsig Aenable bit
>> 
>> linkps axis.3.amp-enable-out => Aenable
>> linksp Aenable => pid.0.enable
>> linksp Aenable => pwmgen.0.enable
>> 
>> net estop-loop iocontrol.0.user-enable-out iocontrol.0.emc-enable-in
>> 
>> newsig Avel float
>> newsig Aacc float
>> linksp Apos-cmd => ddt.0.in
>> linkps ddt.0.out => Avel
>> linksp Avel => ddt.1.in
>> linkps ddt.1.out => Aacc
>> 
>> net tool-prep-loop iocontrol.0.tool-prepare iocontrol.0.tool-prepared
>> net tool-change-loop iocontrol.0.tool-change iocontrol.0.tool-changed
>> 
>> 
>> INI
>> [EMC]
>> 
>> #- Version of this INI file
>> VERSION =               $Revision$
>> 
>> #+ Name of machine, for use with display, etc.
>> MACHINE =               EMC-ETCH-SERVO
>> 
>> #+ Debug level, 0 means no messages. See src/emc/nml_int/emcglb.h for others
>> DEBUG = 0
>> 
>> [DISPLAY]
>> 
>> #+ Name of display program, e.g., xemc
>> DISPLAY =              axis
>> CYCLE_TIME =           
>> 0.200
>> OPEN_FILE = ""
>> 
>> #- Path to help file
>> HELP_FILE =             doc/help.txt
>> 
>> #- Initial display setting for position, RELATIVE or MACHINE
>> POSITION_OFFSET =       RELATIVE
>> 
>> #- Initial display setting for position, COMMANDED or ACTUAL
>> POSITION_FEEDBACK =     ACTUAL
>> 
>> #+ Highest value that will be allowed for feed override, 1.0 = 100%
>> MAX_FEED_OVERRIDE =     10
>> 
>> #- Prefix to be used
>> PROGRAM_PREFIX = /home/elhima/emc2/nc_files
>> 
>> #- Introductory graphic
>> INTRO_GRAPHIC =         emc2.gif
>> INTRO_TIME =            5
>> 
>> # Editor to be used with Axis
>> EDITOR = gedit
>> 
>> [TASK]
>> 
>> # Name of task controller program, e.g., milltask
>> TASK =                  milltask
>> 
>> #- Cycle time, in seconds, that task controller will sleep between
>> polls
>> CYCLE_TIME =            0.010
>> 
>> [RS274NGC]
>> 
>> #- File containing interpreter variables
>> PARAMETER_FILE =        etch.var
>> 
>> [EMCMOT]
>> 
>> #- Name of the motion
>> controller to use (only one exists for nontrivkins)
>> EMCMOT =              motmod
>> 
>> #- Timeout for comm to emcmot, in seconds
>> COMM_TIMEOUT =          1.0
>> 
>> #- Interval between tries to emcmot, in seconds
>> COMM_WAIT =             0.010
>> 
>> #+ Base task period, in nanosecs - this is the fastest thread in the machine
>> BASE_PERIOD =                100000
>> #- Servo task period, in nanosecs - will be rounded to an int multiple of 
>> BASE_PERIOD
>> SERVO_PERIOD
>> =               1000000
>> 
>> [HAL]
>> 
>> HALFILE =                    etch.hal
>> 
>> [TRAJ]
>> #+ machine specific settings
>> AXES =                  4
>> COORDINATES =           A
>> HOME =                  0 0
>> LINEAR_UNITS =          mm
>> ANGULAR_UNITS =         degree
>> CYCLE_TIME =            0.010
>> DEFAULT_VELOCITY =      1
>> MAX_VELOCITY =          30
>> DEFAULT_ACCELERATION =  15.0
>> MAX_ACCELERATION =      20.0
>> 
>> ###############################################################################
>> # Axes sections
>> ###############################################################################
>> 
>> [AXIS_3]
>> 
>> TYPE
>> =                                      ANGULAR
>> HOME =                                     0.000
>> MAX_VELOCITY =                       30
>> MAX_ACCELERATION =              50
>> BACKLASH =                              0.000
>> INPUT_SCALE =                          6.666666667    #### (600x4=2400/360)
>> OUTPUT_SCALE =                     1.000
>> MIN_LIMIT
>> =                              -9999
>> MAX_LIMIT =                             9999
>> FERROR =                                 1
>> MIN_FERROR =                         0.3
>> HOME_OFFSET =                        0.0
>> HOME_SEARCH_VEL =                0.0
>> HOME_LATCH_VEL =                 0.0
>> HOME_USE_INDEX =                 NO
>> HOME_IGNORE_LIMITS
>> =             NO
>> P =                                                  1
>> I =                                                  0
>> D =                                                  0
>> BIAS =                                         0.0
>> FF0
>> =                                             0
>> FF1 =                                              1
>> FF2 =                                            0.0
>> DEADBAND=                                0.3
>> 
>> ###############################################################################
>> # section for main IO controller parameters
>> ###############################################################################
>> [EMCIO]
>> 
>> #- Name of IO controller
>> program, e.g., io
>> EMCIO =         io
>> 
>> #- cycle time, in seconds
>> CYCLE_TIME =            0.100
>> 
>> #- tool table file
>> TOOL_TABLE =            etch.tbl
>> 
>>  
>> Cordialement,
>> 
>> Moustapha Elhima
>> +33 6 09 99 21 97
>> P Penser à préserver l'environnement avant d'imprimer ce message. Merci
>> ------------------------------------------------------------------------------
>> Learn Graph Databases - Download FREE O'Reilly Book
>> "Graph Databases" is the definitive new guide to graph databases and their
>> applications. Written by three acclaimed leaders in the field,
>> this first edition is now available. Download your free book today!
>> http://p.sf.net/sfu/NeoTech
>> _______________________________________________
>> Emc-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/emc-users
>> 
> 
> Peter Wallace
> Mesa Electronics
> 
> (\__/)
> (='.'=) This is Bunny. Copy and paste bunny into your
> (")_(") signature to help him gain world domination.
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their 
> applications. Written by three acclaimed leaders in the field, 
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/NeoTech
> _______________________________________________
> Emc-developers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/emc-developers

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their 
applications. Written by three acclaimed leaders in the field, 
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to