Custom GUI models

More
05 Jun 2016 21:06 #75527 by danimal300
Custom GUI models was created by danimal300
Is there a collection of custom GUI models for spindle control? I really do not have the time to build one in glade, and I do not need anything complex. I am just hoping that someone has posted a couple that I could try out .

What I am looking for is a just a command speed and a real speed so I can see compare the difference between the two, and set the closed loop control and know that I am sending the right RPM value to the machine in the first place.

I had my spindle speed working manually, but as soon as I got the VFD up and running, the spindle speed bar on the standard GUI stopped working. I have no idea what changed, I did not change the encoder pins.

Thanks.

Please Log in or Create an account to join the conversation.

More
05 Jun 2016 22:01 #75530 by BigJohnT
Replied by BigJohnT on topic Custom GUI models
Zip up your configuration directory and post that as an attachment. When you added the VFD did you change anything?

JT
The following user(s) said Thank You: danimal300

Please Log in or Create an account to join the conversation.

More
05 Jun 2016 23:38 - 06 Jun 2016 17:59 #75532 by danimal300
Replied by danimal300 on topic Custom GUI models
My configuration is basically stock setup at this point. I created a new config file for testing and setup, and if I can get PID control of the spindle working, then I will start to migrate everything over and make this machine the new master.

With that said here is my Custom_postgui.hal:
setp scale.0.gain 60
setp lowpass.0.gain 1.500000
net spindle-velocity => lowpass.0.in
net spindle-fb-filtered-rps      lowpass.0.out  => abs.0.in
net spindle-fb-filtered-abs-rps  abs.0.out      => scale.0.in
net spindle-fb-filtered-abs-rpm  scale.0.out    => pyvcp.spindle-speed

# **** set up spindle at speed indicator ****

net spindle-cmd            =>  near.0.in1
net spindle-velocity       =>  near.0.in2
net spindle-at-speed       <=  near.0.out
setp near.0.scale 1.500000
net spindle-at-speed       => pyvcp.spindle-at-speed-led

and here is my main.hal:
# Generated by stepconf 1.1 at Sun Jun  5 15:45:39 2016
# If you make changes to this file, they will be
# overwritten when you run stepconf again
loadrt trivkins
loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES
loadrt probe_parport
loadrt hal_parport cfg="0x378 out"
setp parport.0.reset-time 1000
loadrt stepgen step_type=0,0,0
loadrt encoder num_chan=1
loadrt abs count=1
loadrt scale count=1
loadrt lowpass count=1
loadrt near
loadrt charge_pump
net estop-out charge-pump.enable iocontrol.0.user-enable-out
net charge-pump <= charge-pump.out
loadrt pwmgen output_type=1

addf parport.0.read base-thread
addf stepgen.make-pulses base-thread
addf encoder.update-counters base-thread
addf charge-pump base-thread
addf pwmgen.make-pulses base-thread
addf parport.0.write base-thread
addf parport.0.reset base-thread

addf stepgen.capture-position servo-thread
addf encoder.capture-position servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf stepgen.update-freq servo-thread
addf pwmgen.update servo-thread
addf abs.0 servo-thread
addf scale.0 servo-thread
addf lowpass.0 servo-thread
addf near.0 servo-thread

net spindle-cmd <= motion.spindle-speed-out => pwmgen.0.value
net spindle-on <= motion.spindle-on => pwmgen.0.enable
net spindle-pwm <= pwmgen.0.pwm
setp pwmgen.0.pwm-freq 0.0
setp pwmgen.0.scale 2600.0
setp pwmgen.0.offset 0.0
setp pwmgen.0.dither-pwm true
net spindle-at-speed => motion.spindle-at-speed
net spindle-ccw <= motion.spindle-reverse

setp encoder.0.position-scale 1.000000
setp encoder.0.counter-mode 1
net spindle-position encoder.0.position => motion.spindle-revs
net spindle-velocity encoder.0.velocity => motion.spindle-speed-in
net spindle-index-enable encoder.0.index-enable <=> motion.spindle-index-enable
net spindle-phase-a encoder.0.phase-A
net spindle-phase-b encoder.0.phase-B
net spindle-index encoder.0.phase-Z

net spindle-ccw => parport.0.pin-01-out
net xstep => parport.0.pin-02-out
setp parport.0.pin-02-out-reset 1
setp parport.0.pin-03-out-invert 1
net xdir => parport.0.pin-03-out
net ystep => parport.0.pin-04-out
setp parport.0.pin-04-out-reset 1
net ydir => parport.0.pin-05-out
net zstep => parport.0.pin-06-out
setp parport.0.pin-06-out-reset 1
net zdir => parport.0.pin-07-out
net astep => parport.0.pin-08-out
setp parport.0.pin-08-out-reset 1
net adir => parport.0.pin-09-out
net spindle-pwm => parport.0.pin-14-out
net charge-pump => parport.0.pin-16-out
net spindle-on => parport.0.pin-17-out
net spindle-phase-a <= parport.0.pin-10-in
net spindle-index <= parport.0.pin-11-in

setp stepgen.0.position-scale [AXIS_0]SCALE
setp stepgen.0.steplen 1
setp stepgen.0.stepspace 0
setp stepgen.0.dirhold 11200
setp stepgen.0.dirsetup 11200
setp stepgen.0.maxaccel [AXIS_0]STEPGEN_MAXACCEL
net xpos-cmd axis.0.motor-pos-cmd => stepgen.0.position-cmd
net xpos-fb stepgen.0.position-fb => axis.0.motor-pos-fb
net xstep <= stepgen.0.step
net xdir <= stepgen.0.dir
net xenable axis.0.amp-enable-out => stepgen.0.enable

setp stepgen.1.position-scale [AXIS_1]SCALE
setp stepgen.1.steplen 1
setp stepgen.1.stepspace 0
setp stepgen.1.dirhold 11200
setp stepgen.1.dirsetup 11200
setp stepgen.1.maxaccel [AXIS_1]STEPGEN_MAXACCEL
net ypos-cmd axis.1.motor-pos-cmd => stepgen.1.position-cmd
net ypos-fb stepgen.1.position-fb => axis.1.motor-pos-fb
net ystep <= stepgen.1.step
net ydir <= stepgen.1.dir
net yenable axis.1.amp-enable-out => stepgen.1.enable

setp stepgen.2.position-scale [AXIS_2]SCALE
setp stepgen.2.steplen 1
setp stepgen.2.stepspace 0
setp stepgen.2.dirhold 11200
setp stepgen.2.dirsetup 11200
setp stepgen.2.maxaccel [AXIS_2]STEPGEN_MAXACCEL
net zpos-cmd axis.2.motor-pos-cmd => stepgen.2.position-cmd
net zpos-fb stepgen.2.position-fb => axis.2.motor-pos-fb
net zstep <= stepgen.2.step
net zdir <= stepgen.2.dir
net zenable axis.2.amp-enable-out => stepgen.2.enable

net estop-out <= iocontrol.0.user-enable-out
net estop-out => iocontrol.0.emc-enable-in

loadusr -W hal_manualtoolchange
net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change
net tool-changed iocontrol.0.tool-changed <= hal_manualtoolchange.changed
net tool-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number
net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared
Last edit: 06 Jun 2016 17:59 by BigJohnT. Reason: add code tags

Please Log in or Create an account to join the conversation.

More
05 Jun 2016 23:42 - 05 Jun 2016 23:43 #75533 by danimal300
Replied by danimal300 on topic Custom GUI models
As far as I can tell, there is nothing pointing to pint 10 (encoder phase a) input in the custom_postgui.hal file. This makes me think that it should be there, but I am not sure how to write it in. I have gone through the hal tutorials, but I am still a newb at writing it, and it seems very unforgiving for troubleshooting. It seems like every change that I make results in a blanket failure and I cannot get my feet set writing hal files in a way that is progressing.
Last edit: 05 Jun 2016 23:43 by danimal300.

Please Log in or Create an account to join the conversation.

More
05 Jun 2016 23:46 #75534 by danimal300
Replied by danimal300 on topic Custom GUI models
Also more about my machine: g540 controller, Linuxcnc 2.6.5 hall magnetic switch resulting in 1 pulse per revolution for a spindle encoder. It is a LMS x3 with the spindle control board installed.

Please Log in or Create an account to join the conversation.

More
06 Jun 2016 00:27 #75535 by danimal300
Replied by danimal300 on topic Custom GUI models
I want to use this basic closed loop controller ( wiki.linuxcnc.org/cgi-bin/wiki.pl?Closed...pindle_Speed_Control) but I cannot get it to work with anything I do. It always fails on the first loadrt command, no matter what I do.

Please Log in or Create an account to join the conversation.

More
07 Jun 2016 10:38 - 07 Jun 2016 10:39 #75619 by andypugh
Replied by andypugh on topic Custom GUI models

I want to use this basic closed loop controller ( wiki.linuxcnc.org/cgi-bin/wiki.pl?Closed...pindle_Speed_Control) but I cannot get it to work with anything I do. It always fails on the first loadrt command, no matter what I do.


The error messages do tell you what is wrong, but you typically need to scroll down to the second section to see the specific error message.

Your "loadrt" error is likely to be that you are "loadrt"-ing a component that has already been loaded. Unfortunately every component (such as "abs" or "lowpass") has to be "loadrt"-ed at the same time. So if your first HAL file loads an abs function the postgui file can't add another. You need to increase the number of instances in the first loadrt.

There is a way round this, but it might actually be more work, see "TWOPASS" here:
linuxcnc.org/docs/2.7/html/hal/twopass.html#cha:hal-twopass
Last edit: 07 Jun 2016 10:39 by andypugh.
The following user(s) said Thank You: danimal300

Please Log in or Create an account to join the conversation.

More
08 Jun 2016 01:21 - 08 Jun 2016 01:21 #75665 by danimal300
Replied by danimal300 on topic Custom GUI models
That helped a lot, thanks.
Last edit: 08 Jun 2016 01:21 by danimal300.

Please Log in or Create an account to join the conversation.

More
08 Jun 2016 05:51 #75670 by cncbasher
Replied by cncbasher on topic Custom GUI models
loadrt probe_parport
this loadrt is now not required , so you can comment it out

please give the exact error as shown .
also post your complete config as a tar.gz archive ( use compress), rather than snips , it also helps if we know which version of linuxcnc you are using .

if you only have a single index input then tie this also to the a channel , and in your hal file
make sure the encoder count type is set to 1

Please Log in or Create an account to join the conversation.

More
08 Jun 2016 14:39 #75686 by danimal300
Replied by danimal300 on topic Custom GUI models

loadrt probe_parport
this loadrt is now not required , so you can comment it out

please give the exact error as shown .
also post your complete config as a tar.gz archive ( use compress), rather than snips , it also helps if we know which version of linuxcnc you are using .

if you only have a single index input then tie this also to the a channel , and in your hal file
make sure the encoder count type is set to 1


I am starting to get the whole thing working, but I am still having some issues. I will attache the whole compressed folder to make troubleshooting easier.

What I ended up doing was using an example from the Hal Examples forum (Here) and I modified it to work with my machine. I still have some issues with values. For example, I have 1 encoder pulse per revolution, but when I set encoder.N.position-scale = 1.0, I get roughly three pulses per revolution according to the output. I cannot seem to find any factor that modifies this value.

I have been tweaking it for a few days now, and I am starting to get close to smooth operation. I do feel like I am shooting in the dark, because there are probably 10 - 15 variables that I am tweaking that all effect the other values. Does anyone have some recommended methodology?

So far, I set my low pass gain pretty low so that I would get a reasonably smooth signal from the encoder. Not as smooth as I would like it, but it is reasonable. Then I adjusted the maxoutput and set the PID values to zero. Using that I adjusted the proportional gain until the command signal was ball park for the output RPM. Then when I adjust the ID values, everything kinda gets screwy. I will package and post my hal files, but I am just looking more for a method here than anything else.

Please Log in or Create an account to join the conversation.

Time to create page: 0.192 seconds
Powered by Kunena Forum