Strange Behaviour of orient component G33 works ,.

More
20 May 2015 00:23 #58865 by tkamsker
Hi,
because of G33 was needed we had to redo the Spindle orientation.
We now have the situation that we have the Encoder (AMT102) mounted A B signal are coming perfect the X Signal didnt make it maybe to much electronic noise or too short whatever to not loose time we have again hooked the x pin to the hall signal.
Now spindle sync speed all are coming in right situation
only thing we encounter that motion index enable is probably not firing
Now the question how should the sequence be ?
M19 uses the orient to tell the PID that something will go on
how is the end condition (lets say M19 R30 ) is set ?
i only found some example at mr haberler config
but this adjusted to my situation doesn't work.
So if there is somewhere an working config which i can use as example which shows it is revolutions or degree or whatever would help me a lot
thx
thomas

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

More
20 May 2015 06:31 #58878 by andypugh

So if there is somewhere an working config which i can use as example which shows it is revolutions or degree or whatever would help me a lot


This is a setup that I have working on a sim:
# HAL config file for vismach simulation of horizontal boring machine
# This file deomstrates closed-loop spindle control in both position and 
# Velocity modes. 

# see http://wiki.linuxcnc.org/cgi-bin/wiki.pl?SpindleOrient for a diagram

# Note that the connections of the signals to "hardware" are all in the 
# sim_vmc.hal file rather than here

# First load 2x pid components. These would normally have to be loaded at
# the same time as the Axis PID components

loadrt pid num_chan=2 
addf pid.0.do-pid-calcs servo-thread # Velocity
addf pid.1.do-pid-calcs servo-thread # Position

loadrt orient
addf orient.0 servo-thread

#loadrt mux2 -- This has already been loaded in the sim_vmc.hal
addf mux2.0 servo-thread # chooses which pid output goes to the spindle speed control

#Use this to detect that the spindle is oriented
loadrt near count=1 
addf near.0 		servo-thread

net spindle-pos pid.1.feedback orient.0.position

net spindle-vel 	pid.0.feedback # & encoder.3.velocity for a real machine
net spindle-vel-cmd 	motion.spindle-speed-out pid.0.command
net spindle-vel-pid 	pid.0.output mux2.0.in0

net spindle-pos 	pid.1.feedback orient.0.position near.0.in1 # & encoder.3.position for a real machine
net spindle-pos-cmd 	orient.0.command pid.1.command near.0.in2
net spindle-angle 	motion.spindle-orient-angle orient.0.angle
net spindle-pos-pid 	pid.1.output mux2.0.in1
setp near.0.difference  0.0005
net spindle-in-pos 	near.0.out motion.spindle-is-oriented

# this switches modes
net orient-mode 	motion.spindle-orient orient.0.enable pid.1.enable mux2.0.sel
net velocity-mode	motion.spindle-on pid.0.enable #pwmgen.0.enable 

# this is simple for the simulated spindle.
net spindle-cmd 	mux2.0.out

#for a real spindle run by a VFD
# loadrt abs
# addf abs.0.servo-thread
# net spindle-cmd 	mux2.0.out abs.0.in
# net spindle-cmd-abs 	abs.0.out pwmgen.0.value
# net spindle-pwm 	pwmgen.0.pwm parport.0.pin-NN-out
# net spindle-fwd 	abs.0.is-positive parport.0.pin-NN-out
# net spindle-rev 	abs.0.is-negative parport.0.pin-NN-out

# Tune the PID from the INI values
setp pid.0.Pgain [SPINDLE]PGAIN_V
setp pid.0.Igain [SPINDLE]IGAIN_V
setp pid.0.Dgain [SPINDLE]DGAIN_V
setp pid.0.FF0	 [SPINDLE]FF0_V
setp pid.0.FF1   [SPINDLE]FF1_V
setp pid.1.Pgain [SPINDLE]PGAIN_P
setp pid.1.Igain [SPINDLE]IGAIN_P
setp pid.1.Dgain [SPINDLE]DGAIN_P
setp pid.1.FF0	 [SPINDLE]FF0_P
setp pid.1.FF1   [SPINDLE]FF1_P
The following user(s) said Thank You: tkamsker

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

More
20 May 2015 14:07 #58884 by tkamsker
Ah so the near does the trick ,..
I ll do that tomorrow early morning thank you so much
i could then add this to the orient section for others ,..
thank you so much thomas

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

More
20 May 2015 15:18 #58887 by andypugh

Ah so the near does the trick


I can see good arguments for the in-position pin being an output from the orient component, and for the component to re-orient if the requested angle changes.

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

More
21 May 2015 13:50 #58913 by tkamsker
hi i now did as your script says except the near setp has to be > 1 otherwise oriented is trrue
but it seems that the index enable is not fired,..
how to check that ?
i start the machine have the spindle before moved to index pin is true
i start the machine all encoder position is 0
if i turn the spindle by hand the position is now set in a way that it degrees means after full turn position is 360
my expectation is that when orient is fired which does motion.spindle index anable fires as well should after next turn of index reset position right (or i am wrong ?)
then the near would work

if i do g33 it works like that
any hint would be highly recommended

of ccourse the hal is now ugly as hell because i tried o lot now ,..
thanks in advance

File Attachment:

File Name: bp412bobatc.hal
File Size:14 KB
Attachments:

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

More
21 May 2015 18:42 #58914 by andypugh

if i turn the spindle by hand the position is now set in a way that it degrees means after full turn position is 360
my expectation is that when orient is fired which does motion.spindle index anable fires as well should after next turn of index reset position right (or i am wrong ?)
then the near would work


There are, now I look at it, a couple of things missing from the HAL I posted.

I have got used to having an absolute encoder on my spindle..

Firstly, the connections between motion and the encoder are missing. You need
net spindle-vel motion.spindle-speed-in
net spindle-pos motion.spindle-revs
net spindle-index motion.spindle-index-enable encoder.03.index-enable (or whatever your encoder is called). 

You can add those lines to the HAL such that they link to the existing signals, or add the missing pins to the first definition of the signals.

There is another quirk to handle, initial homing of the spindle...

For G33 it doesn't matter, as that sets the index-enable as needed (the spindle-index line in the HAL I posted above) but spindle-orient doesn't do that.

If you assume that the spindle will never need to orient without having first done at least one revolution then I believe that the folowing extra HAL line at the bottom of the file will zero the encoder the first time the spindle turns past index.
sets spindle-index 1

I think that because both pins connected to that signal are io pins it is valid to sets (set signal) the signal.
The following user(s) said Thank You: tkamsker

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

More
22 May 2015 01:12 #58922 by tkamsker
Hi
thank you for the fast response
i do have that connection like speed and index
net spindle-velocity encoder.0.velocity => motion.spindle-speed-in lowpass.0.in
net spindle-index-enable encoder.0.index-enable <=> motion.spindle-index-enable
in the hal
or is it wrong way around ?
should it be

net spindle-index-enable motion.spindle-index-enable => encoder.0.index-enable
do be directed ?

And i have net spindle-position encoder.0.position => motion.spindle-revs => orient.position orient-pid.feedback near.0.in1

is that wrong ?
thx
thomas

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

More
22 May 2015 01:16 #58923 by andypugh

is that wrong ?
thomas


No, that looks correct.
The order of pins in the net statements does not matter.

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

More
22 May 2015 01:17 #58924 by andypugh
I think all you need is
sets spindle-index-enable 1
to zero the encoder the first time it passes the index.
The following user(s) said Thank You: tkamsker

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

More
22 May 2015 01:23 #58925 by tkamsker
hm
so i f i sum up
i do have to "customers" for that spindle-index-enable
to make sure they both have same i set on the end of the hal file the enable to 1

but later when we do G33.1 and then next tool M19

how is it ensured both are using encoder data properly ?
or is it just a glitch for the init phase ?

i will be tomorrow in the shop to try this
lets see
but my assumption with position equals degrees is correct ?

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

Time to create page: 0.406 seconds
Powered by Kunena Forum