Re: [Emc-users] steppers with encoders in closed loop
- Original Message - > From: "Valerio Bellizzomi" > To: "Enhanced Machine Controller (EMC)" > Sent: Tuesday, June 27, 2017 3:58:34 AM > Subject: Re: [Emc-users] steppers with encoders in closed loop > > I have the P parameter set to 1000 and the motors are quiet. > Previously > pncconf had set P to 1 and the motors made noise like hell and > vibrated. P = 1000 Will usually only work for an open loop stepper setup using the sudo feedback from the hardware stepgen. -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] steppers with encoders in closed loop
On Mon, 2017-06-26 at 16:27 -0400, tom-...@bgp.nu wrote: > Thanks Todd, your suggestion lead me to the issue. Turns out PNConfig sets > the P term to 1000 (and Deadband to 0.0) at which point I got a terrible nose > from the motors. Setting the P term down to 10, and setting Deadband to > 0.0005 has it running quite smoothly. Now to run Halscope and get the tuning > right… > > -Tom I have the P parameter set to 1000 and the motors are quiet. Previously pncconf had set P to 1 and the motors made noise like hell and vibrated. > > > > On Jun 26, 2017, at 10:28 AM, Todd Zuercher wrote: > > > > Maybe you've already tried this, but I would think the easiest way is to > > use PNCcofig to create an ordinary stepper configuration. It will set up a > > velocity mode config with the hardware stepgen sending the feedback to > > close the pid loop. Get that working. Then modify that config by adding > > the encoder reading, and replace the stepgen's feed back with the encoder's > > feedback to the pid loop and to the axis.N.pos-fb (or joint.N.pos-fb in > > Master) Then adjust the P tuning till it "works". I have such a setup on > > a machine using step/dir servos, and using it with step motors would be > > exactly the same (except for the PID tuning.) > > > > The trick is to only try making one major modification at a time. So first > > get a velocity mode stepgen config working (without encoder feedback), Then > > add encoder feedback (do it one axis at a time.) First get the DRO's > > working with the encoder feedback. Then connect the encoders to the PID > > loops. > > > > ----- Original Message ----- > > From: "Tom Easterday" > > To: "Enhanced Machine Controller (EMC)" > > Sent: Monday, June 26, 2017 8:37:47 AM > > Subject: Re: [Emc-users] steppers with encoders in closed loop > > > > Exactly, and any help in getting my stall detection and position tracking > > working using velocity mode would be greatly appreciated 😀 > > > > -Tom > > > >> On Jun 26, 2017, at 6:52 AM, Rene Hopf wrote: > >> > >> there is no benefit in using them in linuxcnc, apart from stall detection > >> or position tracking. > >> > > > > > > -- > > Check out the vibrant tech community on one of the world's most > > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > > ___ > > Emc-users mailing list > > Emc-users@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/emc-users > > > > -- > > Check out the vibrant tech community on one of the world's most > > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > > ___ > > Emc-users mailing list > > Emc-users@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/emc-users > > > -- > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > ___ > Emc-users mailing list > Emc-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/emc-users -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] steppers with encoders in closed loop
Latest plot (on X axis): http://bgp.nu/~tom/pub/pid-X-ff2.png -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] steppers with encoders in closed loop
Thanks Peter, It did help a small bit. Max f-error is now .00014 to .00015 (vs .00018 to .00019). That is a sensitive parameter. I played with FF2 = .001 (bad), .0006 (bad), .00055 ok but ferror was .00016-.00017, so I left it at .0005. -Tom > On Jun 26, 2017, at 7:35 PM, Peter C. Wallace wrote: > > You might improve the tuning a bit with a teeny amount of FF2 > > > maybe .0005 as a start -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] steppers with encoders in closed loop
On Mon, 26 Jun 2017, tom-...@bgp.nu wrote: Date: Mon, 26 Jun 2017 19:20:14 -0400 From: tom-...@bgp.nu Reply-To: "Enhanced Machine Controller (EMC)" To: "Enhanced Machine Controller (EMC)" Subject: Re: [Emc-users] steppers with encoders in closed loop And for those following along at home, I got the machine set up in velocity mode and the pid tuned fairly well. The following error is less than .0002 and the machine runs very nicely, and I can now Home to the index pulse on the encoder (which is where this all began)! Yay. Below are links to my .ini and .hal and plots of the f-error for each axis in case it helps someone in the future. Thanks, -Tom http://bgp.nu/~tom/pub/EMCO-CL.hal http://bgp.nu/~tom/pub/EMCO-CL.ini http://bgp.nu/~tom/pub/pid-X.png http://bgp.nu/~tom/pub/pid-Y.png http://bgp.nu/~tom/pub/pid-Z.png You might improve the tuning a bit with a teeny amount of FF2 maybe .0005 as a start -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Emc-users mailing list Emc-users@lists.sourceforge.net 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. -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] steppers with encoders in closed loop
And for those following along at home, I got the machine set up in velocity mode and the pid tuned fairly well. The following error is less than .0002 and the machine runs very nicely, and I can now Home to the index pulse on the encoder (which is where this all began)! Yay. Below are links to my .ini and .hal and plots of the f-error for each axis in case it helps someone in the future. Thanks, -Tom http://bgp.nu/~tom/pub/EMCO-CL.hal http://bgp.nu/~tom/pub/EMCO-CL.ini http://bgp.nu/~tom/pub/pid-X.png http://bgp.nu/~tom/pub/pid-Y.png http://bgp.nu/~tom/pub/pid-Z.png -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] steppers with encoders in closed loop
Thanks Todd, your suggestion lead me to the issue. Turns out PNConfig sets the P term to 1000 (and Deadband to 0.0) at which point I got a terrible nose from the motors. Setting the P term down to 10, and setting Deadband to 0.0005 has it running quite smoothly. Now to run Halscope and get the tuning right… -Tom > On Jun 26, 2017, at 10:28 AM, Todd Zuercher wrote: > > Maybe you've already tried this, but I would think the easiest way is to use > PNCcofig to create an ordinary stepper configuration. It will set up a > velocity mode config with the hardware stepgen sending the feedback to close > the pid loop. Get that working. Then modify that config by adding the > encoder reading, and replace the stepgen's feed back with the encoder's > feedback to the pid loop and to the axis.N.pos-fb (or joint.N.pos-fb in > Master) Then adjust the P tuning till it "works". I have such a setup on a > machine using step/dir servos, and using it with step motors would be exactly > the same (except for the PID tuning.) > > The trick is to only try making one major modification at a time. So first > get a velocity mode stepgen config working (without encoder feedback), Then > add encoder feedback (do it one axis at a time.) First get the DRO's working > with the encoder feedback. Then connect the encoders to the PID loops. > > - Original Message - > From: "Tom Easterday" > To: "Enhanced Machine Controller (EMC)" > Sent: Monday, June 26, 2017 8:37:47 AM > Subject: Re: [Emc-users] steppers with encoders in closed loop > > Exactly, and any help in getting my stall detection and position tracking > working using velocity mode would be greatly appreciated 😀 > > -Tom > >> On Jun 26, 2017, at 6:52 AM, Rene Hopf wrote: >> >> there is no benefit in using them in linuxcnc, apart from stall detection or >> position tracking. >> > > > -- > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > ___ > Emc-users mailing list > Emc-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/emc-users > > -- > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > ___ > Emc-users mailing list > Emc-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/emc-users -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] steppers with encoders in closed loop
Maybe you've already tried this, but I would think the easiest way is to use PNCcofig to create an ordinary stepper configuration. It will set up a velocity mode config with the hardware stepgen sending the feedback to close the pid loop. Get that working. Then modify that config by adding the encoder reading, and replace the stepgen's feed back with the encoder's feedback to the pid loop and to the axis.N.pos-fb (or joint.N.pos-fb in Master) Then adjust the P tuning till it "works". I have such a setup on a machine using step/dir servos, and using it with step motors would be exactly the same (except for the PID tuning.) The trick is to only try making one major modification at a time. So first get a velocity mode stepgen config working (without encoder feedback), Then add encoder feedback (do it one axis at a time.) First get the DRO's working with the encoder feedback. Then connect the encoders to the PID loops. - Original Message - From: "Tom Easterday" To: "Enhanced Machine Controller (EMC)" Sent: Monday, June 26, 2017 8:37:47 AM Subject: Re: [Emc-users] steppers with encoders in closed loop Exactly, and any help in getting my stall detection and position tracking working using velocity mode would be greatly appreciated 😀 -Tom > On Jun 26, 2017, at 6:52 AM, Rene Hopf wrote: > > there is no benefit in using them in linuxcnc, apart from stall detection or > position tracking. > -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] steppers with encoders in closed loop
Exactly, and any help in getting my stall detection and position tracking working using velocity mode would be greatly appreciated 😀 -Tom > On Jun 26, 2017, at 6:52 AM, Rene Hopf wrote: > > there is no benefit in using them in linuxcnc, apart from stall detection or > position tracking. > -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] steppers with encoders in closed loop
> On 26. Jun 2017, at 00:12, tom-...@bgp.nu wrote: > > I would like to attempt to get my machine with stepper motors running in > velocity mode with feedback from the encoders. this setup makes absolutely no sense. if the drive does not use the encoder, there is no benefit in using them in linuxcnc, apart from stall detection or position tracking. proper closed loop drives will use the encoder for commutation, and operate the stepper more like a servo. you cannot achieve that using your setup. Rene -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users
Re: [Emc-users] steppers with encoders in closed loop
On Sunday 25 June 2017 22:13:04 Tom Easterday wrote: > Gene, > Thanks for the response. The machine has been running great for years > on those values but in position mode, not in velocity mode. I > wouldn't think that any of the step-gen parameters would need to > change when changing to velocity mode...? I wouldn't either if its been running that way, but they are, shall we say, settings that can push the envelope. My motor drivers are generally in the 2M542 category, with a DM860 (junk, the microstep size mapping sucks) thrown in, and none of my steplengths are under 2000, with dir controls averaging twice that. The opto's in these drivers preclude more than a 200-250 kilohertz drive with the motor laying loose on the table. At a microstep divisor of 8, thats a leasurely 2000 rpm or so, with very little usable torque at those speeds. At the higher rotational speeds, the microstepping effect gets lost as the motors inductance becomes the current controlling factor. The driver can only do what its has the available voltage to do. > I suspect the PID parameters I am using, DEADBAND?, MAX_OUTPUT? (not > sure what these should be) or perhaps I have mis-wired, or not wired, > an encoder or velocity parameter in the Hal config Deadband we have been told, if its used in a stepper setup with encoders, must be greater than one step, else it will hunt. For servo's, I'd assume a deadband greater than the encoder resolution. I don't believe I'm using a non-zero value anyplace as my only encoders are for spindle control. Rigid tapping, threading etc. MAX_OUTPUT I normally use non-zero in pwm/pdm servo setups, to limit the PWM/PDM output duty cycle to around 98% as the driver needs the pulses for driver gate charging, and it it goes to a solid, 100% signal, the servo amp will shut itself off to protect the output transistors. I have 2 of the pico pwm-servo drivers running nominally 1 hp motors. Works well on both TLM and the G0704. The latter condition (missing hal connection) might be easier to see on a rockhopper report, but we don't have a viewer for those that will let you blow it up to a readable size, and then let you scan around on what would be if printed out and pasted up, nearly the size of a sheet of plywood. So I generally use the ctl-f (find) function of geany to check that sort of stuff. Unless you've a bare barn door to tack them to, a printout is a bit hard to store in the average shop. :) No clue if any of prattling on this helps but I hope so. > -Tom > > > On Jun 25, 2017, at 9:11 PM, Gene Heskett wrote: > >> On Sunday 25 June 2017 18:12:14 tom-...@bgp.nu wrote: > >> > >> I would like to attempt to get my machine with stepper motors > >> running in velocity mode with feedback from the encoders. Below > >> are the relevant parts of my Hal and Ini files for just the X-Axis. > >> I figured I would do one axis at a time. Currently nothing > >> happens when I try to jog the X axis except if I hold it long > >> enough it gives a following error. If I try to home it, it faults > >> with a following error. I was trying to look various parameters on > >> Halscope, triggering off of axis.0.f-error but nothing appears for > >> any of the pins I was monitoring. Are there any obvious errors in > >> the config below to start with? > >> > >> -Tom > >> > >> HAL > >> loadrt trivkins > >> loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD > >> num_joints=[TRAJ]AXES loadrt hostmot2 > >> loadrt hm2_7i43 config="firmware=hm2/7i43/SVST2_4_7I47B.BIT > >> num_encoders=3 num_pwmgens=0 num_stepgens=4" loadrt pid > >> names=pid.x,pid.y,pid.z > >> > >> addf hm2_7i43.0.read servo-thread > >> addf motion-command-handler servo-thread > >> addf motion-controller servo-thread > >> addf pid.x.do-pid-calcsservo-thread > >> addf pid.y.do-pid-calcsservo-thread > >> addf pid.z.do-pid-calcsservo-thread > >> addf hm2_7i43.0.write servo-thread > >> > >> > >> #*** > >> # AXIS X > >> #*** > >> # axis enable chain > >> > >> setppid.x.Pgain[AXIS_0]P > >> setppid.x.Igain[AXIS_0]I > >> setppid.x.Dgain[AXIS_0]D > >> setppid.x.bias[AXIS_0]BIAS > >> setppid.x.FF0[AXIS_0]FF0 > >> setppid.x.FF1[AXIS_0]FF1 > >> setppid.x.FF2[AXIS_0]FF2 > >> setppid.x.deadband[AXIS_0]DEADBAND > >> setppid.x.maxoutput[AXIS_0]MAX_OUTPUT > >> > >> net x-index-enable <=> pid.x.index-enable > >> net x-enable => pid.x.enable > >> net x-ouput => pid.x.output > >> net x-pos-cmd => pid.x.command > >> net x-vel-fb => pid.x.feedback-deriv > >> net x-pos-fb => pid.x.feedback > >> > >> # Step Gen signals/setup > >> setp hm2_7i43.0.stepgen.00.dirsetup[AXIS_0]DIRSETUP > >> setp hm2_7i43.0.stepgen.00.dirhold [AXIS_0]DIRHOLD > >> setp hm2_7i43.0.stepgen.00.steplen [AXIS_0]STEPLEN > >> setp hm2_7i43.0.stepgen.00.stepspace [A
Re: [Emc-users] steppers with encoders in closed loop
Gene, Thanks for the response. The machine has been running great for years on those values but in position mode, not in velocity mode. I wouldn't think that any of the step-gen parameters would need to change when changing to velocity mode...? I suspect the PID parameters I am using, DEADBAND?, MAX_OUTPUT? (not sure what these should be) or perhaps I have mis-wired, or not wired, an encoder or velocity parameter in the Hal config -Tom > On Jun 25, 2017, at 9:11 PM, Gene Heskett wrote: > >> On Sunday 25 June 2017 18:12:14 tom-...@bgp.nu wrote: >> >> I would like to attempt to get my machine with stepper motors running >> in velocity mode with feedback from the encoders. Below are the >> relevant parts of my Hal and Ini files for just the X-Axis. I figured >> I would do one axis at a time. Currently nothing happens when I try >> to jog the X axis except if I hold it long enough it gives a following >> error. If I try to home it, it faults with a following error. I was >> trying to look various parameters on Halscope, triggering off of >> axis.0.f-error but nothing appears for any of the pins I was >> monitoring. Are there any obvious errors in the config below to >> start with? >> >> -Tom >> >> HAL >> loadrt trivkins >> loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD >> num_joints=[TRAJ]AXES loadrt hostmot2 >> loadrt hm2_7i43 config="firmware=hm2/7i43/SVST2_4_7I47B.BIT >> num_encoders=3 num_pwmgens=0 num_stepgens=4" loadrt pid >> names=pid.x,pid.y,pid.z >> >> addf hm2_7i43.0.read servo-thread >> addf motion-command-handler servo-thread >> addf motion-controller servo-thread >> addf pid.x.do-pid-calcsservo-thread >> addf pid.y.do-pid-calcsservo-thread >> addf pid.z.do-pid-calcsservo-thread >> addf hm2_7i43.0.write servo-thread >> >> >> #*** >> # AXIS X >> #*** >> # axis enable chain >> >> setppid.x.Pgain[AXIS_0]P >> setppid.x.Igain[AXIS_0]I >> setppid.x.Dgain[AXIS_0]D >> setppid.x.bias[AXIS_0]BIAS >> setppid.x.FF0[AXIS_0]FF0 >> setppid.x.FF1[AXIS_0]FF1 >> setppid.x.FF2[AXIS_0]FF2 >> setppid.x.deadband[AXIS_0]DEADBAND >> setppid.x.maxoutput[AXIS_0]MAX_OUTPUT >> >> net x-index-enable <=> pid.x.index-enable >> net x-enable => pid.x.enable >> net x-ouput => pid.x.output >> net x-pos-cmd => pid.x.command >> net x-vel-fb => pid.x.feedback-deriv >> net x-pos-fb => pid.x.feedback >> >> # Step Gen signals/setup >> setp hm2_7i43.0.stepgen.00.dirsetup[AXIS_0]DIRSETUP >> setp hm2_7i43.0.stepgen.00.dirhold [AXIS_0]DIRHOLD >> setp hm2_7i43.0.stepgen.00.steplen [AXIS_0]STEPLEN >> setp hm2_7i43.0.stepgen.00.stepspace [AXIS_0]STEPSPACE >> setp hm2_7i43.0.stepgen.00.position-scale [AXIS_0]SCALE >> setp hm2_7i43.0.stepgen.00.maxaccel [AXIS_0]STEPGEN_MAXACCEL >> setp hm2_7i43.0.stepgen.00.maxvel [AXIS_0]STEPGEN_MAXVEL >> setp hm2_7i43.0.stepgen.00.step_type0 >> setp hm2_7i43.0.stepgen.00.control-type1 >> >> # --closed loop stepper signals-- >> net x-pos-cmd axis.0.motor-pos-cmd >> net x-output => hm2_7i43.0.stepgen.00.velocity-cmd >> net x-enable axis.0.amp-enable-out => hm2_7i43.0.stepgen.00.enable >> >> # ---Encoder feedback signals/setup--- >> setp hm2_7i43.0.encoder.00.counter-mode 0 >> setp hm2_7i43.0.encoder.00.filter 1 >> setp hm2_7i43.0.encoder.00.index-invert 0 >> setp hm2_7i43.0.encoder.00.index-mask 0 >> setp hm2_7i43.0.encoder.00.index-mask-invert 0 >> setp hm2_7i43.0.encoder.00.scale [AXIS_0]INPUT_SCALE >> >> net x-pos-fb <= hm2_7i43.0.encoder.00.position >> net x-vel-fb <= hm2_7i43.0.encoder.00.velocity >> net x-pos-fb => axis.0.motor-pos-fb >> net x-index-enable axis.0.index-enable <=> >> hm2_7i43.0.encoder.00.index-enable net x-pos-rawcounts <= >> hm2_7i43.0.encoder.00.rawcounts >> >> # ---setup home / limit switch signals--- >> net x-home-sw => axis.0.home-sw-in >> net x-neg-limit => axis.0.neg-lim-sw-in >> net x-pos-limit => axis.0.pos-lim-sw-in >> >> end HAL >> >> INI >> [EMC] >> MACHINE = EMCO >> DEBUG = 0 >> >> [DISPLAY] >> DISPLAY = axis >> EDITOR = gedit >> PYVCP = custom_pyvcp.xml >> POSITION_OFFSET = RELATIVE >> POSITION_FEEDBACK = ACTUAL >> MAX_FEED_OVERRIDE = 2.0 >> MAX_SPINDLE_OVERRIDE = 1.5 >> MIN_SPINDLE_OVERRIDE = 0.50 >> INTRO_GRAPHIC = linuxcnc.gif >> INTRO_TIME = 2 >> PROGRAM_PREFIX = /home/tom/linuxcnc/nc_files >> INCREMENTS = .1in .05in .01in .005in .001in .0005in .0001in >> POSITION_OFFSET = RELATIVE >> POSITION_FEEDBACK = ACTUAL >> DEFAULT_LINEAR_VELOCITY = 0.25 >> MAX_LINEAR_VELOCITY = 1.00 >> MIN_LINEAR_VELOCITY = 0.01 >> DEFAULT_ANGULAR_VELOCITY = 0.25 >> MAX_ANGULAR_VELOCITY = 1.00 >> MIN_ANGULAR_VELOCITY = 0.01 >> GEOMETRY = xyz >> >> [FILTER] >> PROGRAM_EXTENSION = .pn
Re: [Emc-users] steppers with encoders in closed loop
On Sunday 25 June 2017 18:12:14 tom-...@bgp.nu wrote: > I would like to attempt to get my machine with stepper motors running > in velocity mode with feedback from the encoders. Below are the > relevant parts of my Hal and Ini files for just the X-Axis. I figured > I would do one axis at a time. Currently nothing happens when I try > to jog the X axis except if I hold it long enough it gives a following > error. If I try to home it, it faults with a following error. I was > trying to look various parameters on Halscope, triggering off of > axis.0.f-error but nothing appears for any of the pins I was > monitoring. Are there any obvious errors in the config below to > start with? > > -Tom > > HAL > loadrt trivkins > loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD > num_joints=[TRAJ]AXES loadrt hostmot2 > loadrt hm2_7i43 config="firmware=hm2/7i43/SVST2_4_7I47B.BIT > num_encoders=3 num_pwmgens=0 num_stepgens=4" loadrt pid > names=pid.x,pid.y,pid.z > > addf hm2_7i43.0.read servo-thread > addf motion-command-handler servo-thread > addf motion-controller servo-thread > addf pid.x.do-pid-calcs servo-thread > addf pid.y.do-pid-calcs servo-thread > addf pid.z.do-pid-calcs servo-thread > addf hm2_7i43.0.write servo-thread > > > #*** > # AXIS X > #*** > # axis enable chain > > setp pid.x.Pgain [AXIS_0]P > setp pid.x.Igain [AXIS_0]I > setp pid.x.Dgain [AXIS_0]D > setp pid.x.bias [AXIS_0]BIAS > setp pid.x.FF0 [AXIS_0]FF0 > setp pid.x.FF1 [AXIS_0]FF1 > setp pid.x.FF2 [AXIS_0]FF2 > setp pid.x.deadband [AXIS_0]DEADBAND > setp pid.x.maxoutput [AXIS_0]MAX_OUTPUT > > net x-index-enable <=> pid.x.index-enable > net x-enable => pid.x.enable > net x-ouput => pid.x.output > net x-pos-cmd => pid.x.command > net x-vel-fb => pid.x.feedback-deriv > net x-pos-fb => pid.x.feedback > > # Step Gen signals/setup > setp hm2_7i43.0.stepgen.00.dirsetup[AXIS_0]DIRSETUP > setp hm2_7i43.0.stepgen.00.dirhold [AXIS_0]DIRHOLD > setp hm2_7i43.0.stepgen.00.steplen [AXIS_0]STEPLEN > setp hm2_7i43.0.stepgen.00.stepspace [AXIS_0]STEPSPACE > setp hm2_7i43.0.stepgen.00.position-scale [AXIS_0]SCALE > setp hm2_7i43.0.stepgen.00.maxaccel [AXIS_0]STEPGEN_MAXACCEL > setp hm2_7i43.0.stepgen.00.maxvel[AXIS_0]STEPGEN_MAXVEL > setp hm2_7i43.0.stepgen.00.step_type 0 > setp hm2_7i43.0.stepgen.00.control-type 1 > > # --closed loop stepper signals-- > net x-pos-cmd axis.0.motor-pos-cmd > net x-output => hm2_7i43.0.stepgen.00.velocity-cmd > net x-enable axis.0.amp-enable-out => hm2_7i43.0.stepgen.00.enable > > # ---Encoder feedback signals/setup--- > setp hm2_7i43.0.encoder.00.counter-mode 0 > setp hm2_7i43.0.encoder.00.filter 1 > setp hm2_7i43.0.encoder.00.index-invert 0 > setp hm2_7i43.0.encoder.00.index-mask 0 > setp hm2_7i43.0.encoder.00.index-mask-invert 0 > setp hm2_7i43.0.encoder.00.scale [AXIS_0]INPUT_SCALE > > net x-pos-fb <= hm2_7i43.0.encoder.00.position > net x-vel-fb <= hm2_7i43.0.encoder.00.velocity > net x-pos-fb => axis.0.motor-pos-fb > net x-index-enable axis.0.index-enable <=> > hm2_7i43.0.encoder.00.index-enable net x-pos-rawcounts <= > hm2_7i43.0.encoder.00.rawcounts > > # ---setup home / limit switch signals--- > net x-home-sw => axis.0.home-sw-in > net x-neg-limit => axis.0.neg-lim-sw-in > net x-pos-limit => axis.0.pos-lim-sw-in > > end HAL > > INI > [EMC] > MACHINE = EMCO > DEBUG = 0 > > [DISPLAY] > DISPLAY = axis > EDITOR = gedit > PYVCP = custom_pyvcp.xml > POSITION_OFFSET = RELATIVE > POSITION_FEEDBACK = ACTUAL > MAX_FEED_OVERRIDE = 2.0 > MAX_SPINDLE_OVERRIDE = 1.5 > MIN_SPINDLE_OVERRIDE = 0.50 > INTRO_GRAPHIC = linuxcnc.gif > INTRO_TIME = 2 > PROGRAM_PREFIX = /home/tom/linuxcnc/nc_files > INCREMENTS = .1in .05in .01in .005in .001in .0005in .0001in > POSITION_OFFSET = RELATIVE > POSITION_FEEDBACK = ACTUAL > DEFAULT_LINEAR_VELOCITY = 0.25 > MAX_LINEAR_VELOCITY = 1.00 > MIN_LINEAR_VELOCITY = 0.01 > DEFAULT_ANGULAR_VELOCITY = 0.25 > MAX_ANGULAR_VELOCITY = 1.00 > MIN_ANGULAR_VELOCITY = 0.01 > GEOMETRY = xyz > > [FILTER] > PROGRAM_EXTENSION = .png,.gif,.jpg Greyscale Depth Image > PROGRAM_EXTENSION = .py Python Script > png = image-to-gcode > gif = image-to-gcode > jpg = image-to-gcode > py = python > > [TASK] > TASK = milltask > CYCLE_TIME = 0.010 > > [RS274NGC] > PARAMETER_FILE = emc.var > > [EMCMOT] > EMCMOT = motmod > COMM_TIMEOUT = 1.0 > COMM_WAIT = 0.010 > #BASE_PERIOD = 5 > SERVO_PERIOD = 100 > > # [HOSTMOT2] > # This is for info only - config line is in the .hal file > # DRIVER0=hm2_7i43 > # BOARD0=7i43 > # CONFIG0="firmware=hm2/7i43/SVST2_4_7I47B.BIT num_encoders=3 > num_pwmgens=0 num_stepgens=4" > > [HAL] > HALUI = halui > HALFILE = EMCO-CL.hal > HALFILE = custom.ha
[Emc-users] steppers with encoders in closed loop
I would like to attempt to get my machine with stepper motors running in velocity mode with feedback from the encoders. Below are the relevant parts of my Hal and Ini files for just the X-Axis. I figured I would do one axis at a time. Currently nothing happens when I try to jog the X axis except if I hold it long enough it gives a following error. If I try to home it, it faults with a following error. I was trying to look various parameters on Halscope, triggering off of axis.0.f-error but nothing appears for any of the pins I was monitoring. Are there any obvious errors in the config below to start with? -Tom HAL loadrt trivkins loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES loadrt hostmot2 loadrt hm2_7i43 config="firmware=hm2/7i43/SVST2_4_7I47B.BIT num_encoders=3 num_pwmgens=0 num_stepgens=4" loadrt pid names=pid.x,pid.y,pid.z addf hm2_7i43.0.read servo-thread addf motion-command-handler servo-thread addf motion-controller servo-thread addf pid.x.do-pid-calcs servo-thread addf pid.y.do-pid-calcs servo-thread addf pid.z.do-pid-calcs servo-thread addf hm2_7i43.0.write servo-thread #*** # AXIS X #*** # axis enable chain setppid.x.Pgain [AXIS_0]P setppid.x.Igain [AXIS_0]I setppid.x.Dgain [AXIS_0]D setppid.x.bias [AXIS_0]BIAS setppid.x.FF0 [AXIS_0]FF0 setppid.x.FF1 [AXIS_0]FF1 setppid.x.FF2 [AXIS_0]FF2 setppid.x.deadband [AXIS_0]DEADBAND setppid.x.maxoutput [AXIS_0]MAX_OUTPUT net x-index-enable <=> pid.x.index-enable net x-enable => pid.x.enable net x-ouput => pid.x.output net x-pos-cmd => pid.x.command net x-vel-fb => pid.x.feedback-deriv net x-pos-fb => pid.x.feedback # Step Gen signals/setup setp hm2_7i43.0.stepgen.00.dirsetup[AXIS_0]DIRSETUP setp hm2_7i43.0.stepgen.00.dirhold [AXIS_0]DIRHOLD setp hm2_7i43.0.stepgen.00.steplen [AXIS_0]STEPLEN setp hm2_7i43.0.stepgen.00.stepspace [AXIS_0]STEPSPACE setp hm2_7i43.0.stepgen.00.position-scale [AXIS_0]SCALE setp hm2_7i43.0.stepgen.00.maxaccel[AXIS_0]STEPGEN_MAXACCEL setp hm2_7i43.0.stepgen.00.maxvel [AXIS_0]STEPGEN_MAXVEL setp hm2_7i43.0.stepgen.00.step_type0 setp hm2_7i43.0.stepgen.00.control-type 1 # --closed loop stepper signals-- net x-pos-cmd axis.0.motor-pos-cmd net x-output => hm2_7i43.0.stepgen.00.velocity-cmd net x-enable axis.0.amp-enable-out => hm2_7i43.0.stepgen.00.enable # ---Encoder feedback signals/setup--- setp hm2_7i43.0.encoder.00.counter-mode 0 setp hm2_7i43.0.encoder.00.filter 1 setp hm2_7i43.0.encoder.00.index-invert 0 setp hm2_7i43.0.encoder.00.index-mask 0 setp hm2_7i43.0.encoder.00.index-mask-invert 0 setp hm2_7i43.0.encoder.00.scale [AXIS_0]INPUT_SCALE net x-pos-fb <= hm2_7i43.0.encoder.00.position net x-vel-fb <= hm2_7i43.0.encoder.00.velocity net x-pos-fb => axis.0.motor-pos-fb net x-index-enable axis.0.index-enable <=> hm2_7i43.0.encoder.00.index-enable net x-pos-rawcounts <= hm2_7i43.0.encoder.00.rawcounts # ---setup home / limit switch signals--- net x-home-sw => axis.0.home-sw-in net x-neg-limit => axis.0.neg-lim-sw-in net x-pos-limit => axis.0.pos-lim-sw-in end HAL INI [EMC] MACHINE = EMCO DEBUG = 0 [DISPLAY] DISPLAY = axis EDITOR = gedit PYVCP = custom_pyvcp.xml POSITION_OFFSET = RELATIVE POSITION_FEEDBACK = ACTUAL MAX_FEED_OVERRIDE = 2.0 MAX_SPINDLE_OVERRIDE = 1.5 MIN_SPINDLE_OVERRIDE = 0.50 INTRO_GRAPHIC = linuxcnc.gif INTRO_TIME = 2 PROGRAM_PREFIX = /home/tom/linuxcnc/nc_files INCREMENTS = .1in .05in .01in .005in .001in .0005in .0001in POSITION_OFFSET = RELATIVE POSITION_FEEDBACK = ACTUAL DEFAULT_LINEAR_VELOCITY = 0.25 MAX_LINEAR_VELOCITY = 1.00 MIN_LINEAR_VELOCITY = 0.01 DEFAULT_ANGULAR_VELOCITY = 0.25 MAX_ANGULAR_VELOCITY = 1.00 MIN_ANGULAR_VELOCITY = 0.01 GEOMETRY = xyz [FILTER] PROGRAM_EXTENSION = .png,.gif,.jpg Greyscale Depth Image PROGRAM_EXTENSION = .py Python Script png = image-to-gcode gif = image-to-gcode jpg = image-to-gcode py = python [TASK] TASK = milltask CYCLE_TIME = 0.010 [RS274NGC] PARAMETER_FILE = emc.var [EMCMOT] EMCMOT = motmod COMM_TIMEOUT = 1.0 COMM_WAIT = 0.010 #BASE_PERIOD = 5 SERVO_PERIOD = 100 # [HOSTMOT2] # This is for info only - config line is in the .hal file # DRIVER0=hm2_7i43 # BOARD0=7i43 # CONFIG0="firmware=hm2/7i43/SVST2_4_7I47B.BIT num_encoders=3 num_pwmgens=0 num_stepgens=4" [HAL] HALUI = halui HALFILE = EMCO-CL.hal HALFILE = custom.hal POSTGUI_HALFILE = custom_postgui.hal [HALUI] MDI_COMMAND = G53 G0 X0 Y0 Z0 MDI_COMMAND = o call [TRAJ] AXES = 3 COORDINATES = X Y Z LINEAR_UNITS = inch ANGULAR_UNITS = degree CYCLE_TIME = 0.010 DEFAULT_VELOCITY = 0.5 MAX_LINEAR_VELOCITY = 2 DEFAULT_ANGULAR_VELOCITY = 0.25 MAX_ANGULAR_VELOCITY = 1.0 [EMCIO] EMCIO = io