Lincurve
11 Mar 2022 15:59 #236941
by rider-83
So, I'm having a little play around with 'Lincurve', and I've patched in a bit of sample code from else where and tried to adapt it into my .hal
I don't currently know how to connect it properly, and at the moment I see the error: pwmgen.0.in does not exist.
I've probably made a complete mess of this, but if someone has got better experience with this, then help is very much appreciated.
(below is just a cutting from my sample .hal):
loadrt stepgen step_type=0,0,0,0
loadrt encoder num_chan=1
loadrt abs count=3
loadrt scale count=3
loadrt lowpass count=1
loadrt pwmgen output_type=1
loadrt near
addf stepgen.make-pulses base-thread
addf pwmgen.make-pulses base-thread
addf stepgen.capture-position servo-thread
addf stepgen.update-freq servo-thread
addf pwmgen.update servo-thread
addf encoder.update-counters base-thread
addf encoder.capture-position servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
# SPINDLE #
#THREE SENSOR ARRANGEMENT - WITH SCREW CUTTING
#PHASE 'A' / PHASE 'B' & STROBE PHASE 'Z'
addf abs.0 servo-thread
addf scale.0 servo-thread
addf lowpass.0 servo-thread
net spindle-cmd-rpm => pwmgen.0.value
net spindle-on <= spindle.0.on => pwmgen.0.enable
net spindle-pwm <= pwmgen.0.pwm
setp pwmgen.0.pwm-freq 50
setp pwmgen.0.scale 3000
#setp pwmgen.0.offset 0.0168831168831
#setp pwmgen.0.offset 0.0
#setp pwmgen.0.dither-pwm true
#################LINCURVE STUFF
loadrt lincurve personality=5
addf lincurve.0 servo-thread
setp lincurve.0.x-val-00 0
setp lincurve.0.y-val-00 0
setp lincurve.0.x-val-01 0
setp lincurve.0.y-val-01 100
setp lincurve.0.x-val-02 160
setp lincurve.0.y-val-02 750
setp lincurve.0.x-val-03 780
setp lincurve.0.y-val-03 1500
setp lincurve.0.x-val-04 2974
setp lincurve.0.y-val-04 3000
net spindle-raw motion.spindle-out => lincurve.0.in
net spindle-corrected lincurve.0.out => pwmgen.0.in
###################################
net spindle-cmd-rpm <= spindle.0.speed-out
net spindle-cmd-rpm-abs <= spindle.0.speed-out-abs
net spindle-cmd-rps <= spindle.0.speed-out-rps
net spindle-cmd-rps-abs <= spindle.0.speed-out-rps-abs
net spindle-cw <= spindle.0.forward
net spindle-ccw <= spindle.0.reverse
setp encoder.0.position-scale 400
net spindle-position encoder.0.position => spindle.0.revs
net spindle-velocity-feedback-rps encoder.0.velocity => spindle.0.speed-in
net spindle-index-enable encoder.0.index-enable <=> spindle.0.index-enable
net spindle-phase-a encoder.0.phase-A <= parport.1.pin-10-in
net spindle-phase-b encoder.0.phase-B <= parport.1.pin-12-in
net spindle-index encoder.0.phase-Z <= parport.1.pin-11-in
I don't currently know how to connect it properly, and at the moment I see the error: pwmgen.0.in does not exist.
I've probably made a complete mess of this, but if someone has got better experience with this, then help is very much appreciated.
(below is just a cutting from my sample .hal):
loadrt stepgen step_type=0,0,0,0
loadrt encoder num_chan=1
loadrt abs count=3
loadrt scale count=3
loadrt lowpass count=1
loadrt pwmgen output_type=1
loadrt near
addf stepgen.make-pulses base-thread
addf pwmgen.make-pulses base-thread
addf stepgen.capture-position servo-thread
addf stepgen.update-freq servo-thread
addf pwmgen.update servo-thread
addf encoder.update-counters base-thread
addf encoder.capture-position servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
# SPINDLE #
#THREE SENSOR ARRANGEMENT - WITH SCREW CUTTING
#PHASE 'A' / PHASE 'B' & STROBE PHASE 'Z'
addf abs.0 servo-thread
addf scale.0 servo-thread
addf lowpass.0 servo-thread
net spindle-cmd-rpm => pwmgen.0.value
net spindle-on <= spindle.0.on => pwmgen.0.enable
net spindle-pwm <= pwmgen.0.pwm
setp pwmgen.0.pwm-freq 50
setp pwmgen.0.scale 3000
#setp pwmgen.0.offset 0.0168831168831
#setp pwmgen.0.offset 0.0
#setp pwmgen.0.dither-pwm true
#################LINCURVE STUFF
loadrt lincurve personality=5
addf lincurve.0 servo-thread
setp lincurve.0.x-val-00 0
setp lincurve.0.y-val-00 0
setp lincurve.0.x-val-01 0
setp lincurve.0.y-val-01 100
setp lincurve.0.x-val-02 160
setp lincurve.0.y-val-02 750
setp lincurve.0.x-val-03 780
setp lincurve.0.y-val-03 1500
setp lincurve.0.x-val-04 2974
setp lincurve.0.y-val-04 3000
net spindle-raw motion.spindle-out => lincurve.0.in
net spindle-corrected lincurve.0.out => pwmgen.0.in
###################################
net spindle-cmd-rpm <= spindle.0.speed-out
net spindle-cmd-rpm-abs <= spindle.0.speed-out-abs
net spindle-cmd-rps <= spindle.0.speed-out-rps
net spindle-cmd-rps-abs <= spindle.0.speed-out-rps-abs
net spindle-cw <= spindle.0.forward
net spindle-ccw <= spindle.0.reverse
setp encoder.0.position-scale 400
net spindle-position encoder.0.position => spindle.0.revs
net spindle-velocity-feedback-rps encoder.0.velocity => spindle.0.speed-in
net spindle-index-enable encoder.0.index-enable <=> spindle.0.index-enable
net spindle-phase-a encoder.0.phase-A <= parport.1.pin-10-in
net spindle-phase-b encoder.0.phase-B <= parport.1.pin-12-in
net spindle-index encoder.0.phase-Z <= parport.1.pin-11-in
Please Log in or Create an account to join the conversation.
13 Mar 2022 07:55 #237082
by rider-83
I did yes. I studied it repeatably, but I got even more frustrated.
Having said that I have managed to sort it out and get it to work, but there is a lack of up to date examples out there. Most of what I could find refers to earlier version of Lcnc and certainly no samples to look at that refer to parallel ports. It turns out to be very simple and logical to set up, but with out simple layman terms on how this work it becomes unnecessarily difficult to the point where it makes you want to just give up.
I'm going to post on here how I understand how to set it up in its simplest form for the benefit of others, but I think LinuxCNC needs some sort of current Idiots Guide on how to setup and importantly understand how the basic functions work, with real world examples, especially for Lathes not just routers & mills. With out the fantastic help from the forum community and experts such as your self (PCW) Lcnc would be a complete dead duck.
Having said that I have managed to sort it out and get it to work, but there is a lack of up to date examples out there. Most of what I could find refers to earlier version of Lcnc and certainly no samples to look at that refer to parallel ports. It turns out to be very simple and logical to set up, but with out simple layman terms on how this work it becomes unnecessarily difficult to the point where it makes you want to just give up.
I'm going to post on here how I understand how to set it up in its simplest form for the benefit of others, but I think LinuxCNC needs some sort of current Idiots Guide on how to setup and importantly understand how the basic functions work, with real world examples, especially for Lathes not just routers & mills. With out the fantastic help from the forum community and experts such as your self (PCW) Lcnc would be a complete dead duck.
Please Log in or Create an account to join the conversation.
15 Mar 2022 08:45 #237308
by andypugh
As I feared, that one is my fault. I write a lot of my replies during the lunch break at work when I don't have access to a LinuxCNC machine, and so the HAL pin names are from memory. It looks like I remembered wrong in that case.Its in the Lincurve post here:
forum.linuxcnc.org/10-advanced-configura...m-output-for-spindle
The following user(s) said Thank You: tommylight
Please Log in or Create an account to join the conversation.
Time to create page: 0.153 seconds