G76 doesn´t work right

More
28 Oct 2017 14:36 #100929 by Skyline
Hey Guys,

I hope i´m at the right "adress" here for my topic.
Since weeks i can not solve my problem with G76 threading.

The problem is: Every cut, is a bit more behind or in front of the cut he did before. But all cuts are parallel. Here´s a pic:


So there has to be a problem to start every cut at the same point.
I tried a lot the last weeks and i´m 99% sure, it´s a (user-)software problem.

I use china components with a simple DB25-1205 breakout board.
My spindle encoder is a photocell at the gear which is directly at the spindle. He has a 0V/5V clear "digital" signal.
I use a 60° thread cuter.

Here´s a example of my code:

%
(GEWINDE TEST)
M3
G0X19Z5
G76 P3 Z-5 I-1 J0.05 R1 K0.8 Q0
G0X16Z180
M5
%

My HAL:
# Generated by stepconf 1.1 at Sat Sep 23 13:13:57 2017
# Änderungen an dieser Datei werden beim nächsten
# Aufruf von stepconf überschrieben.
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="0 out"
loadrt stepgen step_type=0,0
loadrt encoder num_chan=1
loadrt abs count=1
loadrt scale count=1
loadrt lowpass count=1
loadrt pwmgen output_type=1
addf parport.0.read base-thread
addf stepgen.make-pulses base-thread
addf encoder.update-counters base-thread
addf pwmgen.make-pulses base-thread
addf parport.0.write 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
net spindle-cmd-rpm => pwmgen.0.value
net spindle-on <= motion.spindle-on => pwmgen.0.enable
net spindle-pwm <= pwmgen.0.pwm
setp pwmgen.0.pwm-freq 1000.0
setp pwmgen.0.scale 624.0
setp pwmgen.0.offset 0.0128205128205
setp pwmgen.0.dither-pwm true
net spindle-cmd-rpm     <= motion.spindle-speed-out
net spindle-cmd-rpm-abs <= motion.spindle-speed-out-abs
net spindle-cmd-rps     <= motion.spindle-speed-out-rps
net spindle-cmd-rps-abs <= motion.spindle-speed-out-rps-abs
net spindle-at-speed    => motion.spindle-at-speed
setp encoder.0.position-scale 62.000000
setp encoder.0.counter-mode 1
net spindle-position encoder.0.position => motion.spindle-revs
net spindle-velocity-feedback-rps 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-phase-a encoder.0.phase-Z
setp parport.0.pin-01-out-invert 1
net zstep           => parport.0.pin-01-out
setp parport.0.pin-02-out-invert 1
net xenable         => parport.0.pin-02-out
setp parport.0.pin-03-out-invert 1
net xdir            => parport.0.pin-03-out
net zdir            => parport.0.pin-07-out
setp parport.0.pin-08-out-invert 1
net xstep           => parport.0.pin-08-out
setp parport.0.pin-14-out-invert 1
net xenable         => parport.0.pin-14-out
net spindle-pwm     => parport.0.pin-16-out
net max-x           <= parport.0.pin-10-in-not
net min-z           <= parport.0.pin-11-in-not
net spindle-phase-a <= parport.0.pin-12-in
net estop-ext       <= parport.0.pin-15-in
setp stepgen.0.position-scale [AXIS_0]SCALE
setp stepgen.0.steplen 1
setp stepgen.0.stepspace 1
setp stepgen.0.dirhold 22650
setp stepgen.0.dirsetup 22650
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
net max-x => axis.0.pos-lim-sw-in
setp stepgen.1.position-scale [AXIS_2]SCALE
setp stepgen.1.steplen 1
setp stepgen.1.stepspace 1
setp stepgen.1.dirhold 22650
setp stepgen.1.dirsetup 22650
setp stepgen.1.maxaccel [AXIS_2]STEPGEN_MAXACCEL
net zpos-cmd axis.2.motor-pos-cmd => stepgen.1.position-cmd
net zpos-fb stepgen.1.position-fb => axis.2.motor-pos-fb
net zstep <= stepgen.1.step
net zdir <= stepgen.1.dir
net zenable axis.2.amp-enable-out => stepgen.1.enable
net min-z => axis.2.neg-lim-sw-in
net estop-out <= iocontrol.0.user-enable-out
net estop-ext => 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

You have any idea where´s my problem?

I hope you understand everything I write. If you need more information, please write what you need.
I´m glade about every help :)

Best regards
Matthias
Attachments:

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

More
28 Oct 2017 15:03 - 28 Oct 2017 15:21 #100931 by PCW
Replied by PCW on topic G76 doesn´t work right
You can only use encoder A for index if you have 1 pulse per turn
(you seem to have 62)

This means every threading pass you could start randomly at any of the 62 shaft
positions.

I do think its arguable that the encoder component should have the option of generating a simulated
index signal by dividing the count. This would not work quite as well as a real index signal
( The index position would be forgotten when LinuxCNC was shut down )
but would allow threading with a single detector having multiple counts per turn
Last edit: 28 Oct 2017 15:21 by PCW.

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

More
28 Oct 2017 15:21 #100932 by Skyline
Replied by Skyline on topic G76 doesn´t work right
Oh, okay. How do i have to change it?

net spindle-phase-a encoder.0.phase-Z ?

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

More
28 Oct 2017 15:25 #100933 by PCW
Replied by PCW on topic G76 doesn´t work right
You would need to add a 1 pulse per rev detector and wire it to phase-Z

You could retain the 62 PPR A signal if you have enough parallel port inputs available
if not you would wire the 1 PPR signal to A and Z as you have now

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

More
28 Oct 2017 15:43 #100935 by Skyline
Replied by Skyline on topic G76 doesn´t work right
Okay, so I need a 1PPR at Z, so it would work. If 62 PPR would stay at A, what would it do?
Is there any option to use my 62 PPR without 1 PPR and it still stays 62 PPR? Because 1 PPR is pretty inaccurate?
I´ve got the feeling, i don´t understand something basicaly how it works.

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

More
28 Oct 2017 15:50 - 28 Oct 2017 15:56 #100936 by PCW
Replied by PCW on topic G76 doesn´t work right
There are at least three main options here:

1. One wire 1PPR threading: simple but poor tracking if the spindle speed varies
2. Two wire ( A and Z ) multiple PPR threading: better tracking if spindle speed varies
3. Three wire ( A,B,Z ) multiple PPR threading, good tracking and reversable ( for tapping etc )

Note for the 1 PPR option, you must use the encoders "position-interpolated" rather than "position"
pin so that the Z axis moves smoothly rather than stepping every spindle count
Last edit: 28 Oct 2017 15:56 by PCW.
The following user(s) said Thank You: andypugh

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

More
28 Oct 2017 15:56 #100937 by Skyline
Replied by Skyline on topic G76 doesn´t work right
Okay, so, if i understand right:
I add a 1 PPR (for indication?) to phase Z, the 62 PPR stays A and so i get the second option you listet? The tracking will be better then with only 1 PPR.?

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

More
28 Oct 2017 16:04 - 28 Oct 2017 16:07 #100938 by PCW
Replied by PCW on topic G76 doesn´t work right
Yes, the tracking will be better because the spindle position is updated 62 times per revolution
rather than just once.

With 1 PPR you basically have to guess the spindle position by using the velocity calculated from the
previous revolution and the time from the last index ( That's what position-interpolated is )

Using position-interpolated may still be helpful even at 62 PPR, especially at low speeds
( so you avoid noticeable steps in the z motion )
Last edit: 28 Oct 2017 16:07 by PCW.

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

More
28 Oct 2017 16:07 #100939 by Skyline
Replied by Skyline on topic G76 doesn´t work right
Okay, now i got it. I will try to improvise a 1 PPR encoder and test it.

Very much thanks at this point!!!! :):)

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

More
29 Oct 2017 17:43 #100976 by Skyline
Replied by Skyline on topic G76 doesn´t work right
That´s it! My improvise mounted sensor works and a thread was never that sexy before :D

Thank you!

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

Time to create page: 0.099 seconds
Powered by Kunena Forum