HAL M19 Orient dont work

More
14 Mar 2023 14:47 - 14 Mar 2023 14:48 #266666 by 0x2102
Replied by 0x2102 on topic HAL M19 Orient dont work
Most if not all PINs for this are now under "spindle.0.XYZ". Look there for what you need.
Last edit: 14 Mar 2023 14:48 by 0x2102.

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

More
14 Mar 2023 16:52 #266677 by Stefan321
Replied by Stefan321 on topic HAL M19 Orient dont work
hello, thanks for all the help, this is the current hal excerpt. i can now turn the spindle on with m3 and m4 and off again with m5. However, my spindle is now running too fast because the config for the translation ratio is now missing.

However, when I do m19 nothing happens. when i make m19 with spindle off, the spindle turns on and turns and turns. nothing happens here anymore.

I noticed now that I'm at home that there is another # at the bottom of the sync could it be because of that?
#*******************
# SPINDLE
#*******************

# ---Encoder feedback signals/setup---

setp [HMOT](CARD0).encoder.04.counter-mode 0
setp [HMOT](CARD0).encoder.04.filter 1
setp [HMOT](CARD0).encoder.04.index-invert 0
setp [HMOT](CARD0).encoder.04.index-mask 0
setp [HMOT](CARD0).encoder.04.index-mask-invert 0
setp [HMOT](CARD0).encoder.04.scale [SPINDLE_0]ENCODER_SCALE

# Step Gen signals/setup

setp [HMOT](CARD0).stepgen.04.dirsetup [SPINDLE_0]DIRSETUP
setp [HMOT](CARD0).stepgen.04.dirhold [SPINDLE_0]DIRHOLD
setp [HMOT](CARD0).stepgen.04.steplen [SPINDLE_0]STEPLEN
setp [HMOT](CARD0).stepgen.04.stepspace [SPINDLE_0]STEPSPACE
setp [HMOT](CARD0).stepgen.04.position-scale [SPINDLE_0]OUTPUT_SCALE
setp [HMOT](CARD0).stepgen.04.step_type 0
setp [HMOT](CARD0).stepgen.04.control-type 1
setp [HMOT](CARD0).stepgen.04.maxaccel [SPINDLE_0]STEPGEN_MAXACCEL
setp [HMOT](CARD0).stepgen.04.maxvel [SPINDLE_0]STEPGEN_MAXVEL

# ---setup spindle control signals---

loadrt limit2 names=spindle-ramp
loadrt near names=spindle-at-speed,spindle-at-pos
loadrt timedelay names=spindle-active-delay
loadrt orient names=spindle-orient
#loadrt pid names=spindle-pid
loadrt mux2 names=spindle-pwm-switch
loadrt or2 count=0
loadrt not count=0
loadrt and2 count=0
loadrt offset count=0


addf spindle-ramp servo-thread
addf spindle-at-speed servo-thread
addf spindle-at-pos servo-thread
addf spindle-active-delay servo-thread
addf spindle-orient servo-thread
addf spindle-pid.do-pid-calcs servo-thread
addf spindle-pwm-switch servo-thread
addf or2.0 servo-thread
addf not.0 servo-thread
addf and2.0 servo-thread
addf offset.0.update-output servo-thread
#addf orient.0 servo-thread

setp spindle-pid.Pgain [SPINDLE_0]P
setp spindle-pid.Igain [SPINDLE_0]I
setp spindle-pid.Dgain [SPINDLE_0]D
setp spindle-pid.bias [SPINDLE_0]BIAS
setp spindle-pid.FF0 [SPINDLE_0]FF0
setp spindle-pid.FF1 [SPINDLE_0]FF1
setp spindle-pid.FF2 [SPINDLE_0]FF2
setp spindle-pid.deadband [SPINDLE_0]DEADBAND
setp spindle-pid.maxoutput [SPINDLE_0]MAX_OUTPUT
setp spindle-pid.error-previous-target true

setp spindle-ramp.maxv [SPINDLE_0]ACCELERATION
setp spindle-at-speed.difference [SPINDLE_0]MAX_ERROR
setp spindle-at-pos.difference 0.01
setp spindle-at-pos.in1 0
setp spindle-active-delay.on-delay 0
setp spindle-active-delay.off-delay [SPINDLE_0]OFF_DELAY

# ---Setup spindle at speed signals---

# orient mit motion verknuepfen
net orient-angle spindle-orient.angle => spindle.0.orient-angle
net orient-mode spindle-orient.mode => spindle.0.orient-mode
net orient-enable spindle.0.orient => => and2.0.in1

# Position vom Encoder in den pid / orient und motion schieben
net spindle-pos => spindle-pid.feedback => spindle-orient.position
net spindle-pos <= spindle.0.revs <= [HMOT](CARD0).encoder.04.position


# Encodergeschwindigkeit U/sek in den near und motion schieben
net spindle-fb-rps spindle.0.speed-in <= [HMOT](CARD0).encoder.04.velocity => spindle-at-speed.in2

# Positionsvorgabe vom orient in den pid schieben
setp offset.0.offset 1
net spindle.orient-cmd spindle-orient.command => offset.0.in
net spindle-orient-cmd1 offset.0.out => spindle-pid.command

# Drehzahlvorgabe U/min aus motion in das limit2 schieben
net spindle-speed-rpm spindle.0.speed-out => spindle-ramp.in

# Drehzahlvorgabe U/sek aus motion in das near schieben
net spindle-speed-rps spindle.0.speed-out-rps => spindle-at-speed.in1

# Wenn Solldrehzahl gleich Istdrehzahl dann aus near das bit in motion schieben
net spindle-at-speed spindle-at-speed.out => spindle.0.at-speed

# Wenn Sollpositon gleich Istpositon dann aus near das bit in motion schieben
net spindle-pos-err spindle-at-pos.in2 <= spindle-pid.error
net spindle-at-pos spindle-at-pos.out =>
net spindle-on0 spindle.0.on => spindle-active-delay.in
net spindel-on1 spindle-active-delay.out => or2.0.in0 => not.0.in
net spindel-on2 and2.0.in0 <= not.0.out

# orient und pid aktivieren
net orient-active and2.0.out => or2.0.in1 => spindle-pwm-switch.sel
net orient-active => spindle-pid.enable => spindle-orient.enable
net spindle-enable or2.0.out => [HMOT](CARD0).stepgen.04.enable

# motion gibt Signal an Encoder das beim naechsten Z Signal auf 0 gestellt werden soll
net spindle-sync spindle.0.index-enable => [HMOT](CARD0).encoder.04.index-enable #
sets spindle-sync 1

# pwm Signal entweder vom motion oder orient
net pwm-switch-in0 spindle-pwm-switch.in0 <= spindle-ramp.out
net pwm-switch-in1 spindle-pwm-switch.in1 <= spindle-pid.output
net pwm-switch-out spindle-pwm-switch.out => [HMOT](CARD0).stepgen.04.velocity-cmd

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

More
14 Mar 2023 19:45 #266688 by 0x2102
Replied by 0x2102 on topic HAL M19 Orient dont work
Remove the # you mentioned (spindle-sync) just to be safe.

Start LinuxCNC and monitor in HAL spindle.0.index-enable (should be true/on). Turn the spindle by hand until it's off to verify LinuxCNC can see the Index signal.

What are your Spindle PID settings (.ini)?

You can start with something like this:

[SPINDLE_0]
# PID Setting
P = 10
I = 0
D = 0
FF0 = 0
FF1 = 1
FF2 = 0

Play with the P value. Decrease or increase and monitor the changes.

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

More
14 Mar 2023 20:04 #266694 by andypugh
Replied by andypugh on topic HAL M19 Orient dont work
This diagram shows how orient can be connected, and is also updated with the current spindle pin names.

wiki.linuxcnc.org/uploads/orient.svg

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

More
14 Mar 2023 22:17 #266710 by Stefan321
Replied by Stefan321 on topic HAL M19 Orient dont work
I have the index signal, I've tested it in the past, I've already drilled threads with the old config without compensation. but can still look up the exact name of the pin to rule out errors. thanks for the visual image of the pin assignment, I'll take a close look at it tomorrow.

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

More
15 Mar 2023 17:15 #266766 by Stefan321
Replied by Stefan321 on topic HAL M19 Orient dont work
so I adjusted my spindle today, it now runs wonderfully in speed mode. m19 position mode still not working. (G33.1 works) I tested. Index is there too.

The pins for Orient also work, except for Sync, and accordingly there is no pinout for Position Reached.

What I also noticed is the pen for
spindle.0.on <- not working spindle.1.on <- speed
Spindle.2.on <- position

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

More
19 Mar 2023 09:50 - 19 Mar 2023 10:03 #267074 by andypugh
Replied by andypugh on topic HAL M19 Orient dont work
How many spindles do you actually have?

And have you done any PID tuning of the position feedback loop?
Last edit: 19 Mar 2023 10:03 by andypugh.

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

More
24 Mar 2023 23:10 #267431 by Stefan321
Replied by Stefan321 on topic HAL M19 Orient dont work
Well, the last few days I unfortunately didn't have any time, today I looked at it again but still can't get any further. I adjusted the pid. but brings no improvement. In addition, when I make m19 r0, the spindle rotates abnormally high, I can adjust that somewhere. so the speed at m19? I also set the sync manual enable times. this signal then goes out after one revolution

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

More
26 Mar 2023 17:56 - 26 Mar 2023 19:03 #267542 by Stefan321
Replied by Stefan321 on topic HAL M19 Orient dont work
I could fix the turning up of the spindle, but the spindle still does not orient itself. she turns a few times in circles, then gets slower and slower and stops somewherei only have one spindle, but it has to switch between speed and position
Last edit: 26 Mar 2023 19:03 by Stefan321.

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

More
27 Mar 2023 08:36 #267589 by andypugh
Replied by andypugh on topic HAL M19 Orient dont work
This sounds like the command and feedback for the position PID are coming from incompatible sources.
Both command and feedback should be total spindle revolutions.
If you disable the position PID (so that no spindle motion takes place) program an orient move after a few seconds of spindle rotation and look at the orient pid command pin and feedback pin using halmeter or halshow. They should be no more than one turn apart.
Is your spindle position scaling correct? Does it increase by exactly 1.0 for every spindle rotation?

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

Time to create page: 0.243 seconds
Powered by Kunena Forum