spindle-index-enable

More
16 Oct 2015 15:15 #63804 by cgc
spindle-index-enable was created by cgc
I have a lathe with a servo motor at the spindle.
It run in velocity mode.
I have via EtherCat direct access to the position and velocity registers in the servo controller.
Now, I will use spindle synchron motion.
I have configured the controller, that every spindle turn the position go to zero.
I have connect the servo-position to motion.spindle-revs, and the servo-velocity to motion.spindle-speed-in.
But what is with the motion.spindle-index-enable signal?
I think, motion need this signal, but I have not the encoder comp to generate this.
Maybe, I can write me a small comp to generate the signal, but I dont know the exact function.
Can explain me anybody the function of the motion.spindle-index-enable signal?

thanks Frank

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

More
16 Oct 2015 15:37 #63806 by cncbasher
Replied by cncbasher on topic spindle-index-enable
do you have a encoder on the spindle ? , this supplys the index

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

More
16 Oct 2015 16:04 #63808 by cgc
Replied by cgc on topic spindle-index-enable
No, the servomotor has a resolver.

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

More
16 Oct 2015 16:27 #63811 by cncbasher
Replied by cncbasher on topic spindle-index-enable
you'll need to convert the resolver output to give you an A & B with Index
are you using mesa interface ? they do a resolver card , and their are a few others .
see the link here :

www.linuxcnc.org/index.php/english/forum...esolvers-to-encoders

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

More
16 Oct 2015 18:22 - 16 Oct 2015 19:40 #63817 by cgc
Replied by cgc on topic spindle-index-enable
I know the mesa cards and I know the system with A & B and Index.

But, if I have a servo system and with direct access via fieldbus (EtherCat) from LCNC to the position and velocity, I think it should be possible, with this information to syncronize the spindle.
What information need the motion.spindle-index-enable signal?
Should I set the signal every spindle turn to zero or to one, allway if the position go to zero?
I have read the source code in control.c, but I dont understand the function of motion.spindle-index-enable.
Last edit: 16 Oct 2015 19:40 by cgc.

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

More
16 Oct 2015 20:04 - 16 Oct 2015 20:05 #63821 by andypugh
Replied by andypugh on topic spindle-index-enable

What information need the motion.spindle-index-enable signal?


motion sets spindle.index-enable to TRUE at the beginning of a spindle-synchronised move. The encoder driver (Mesa or HAL) then sets that pin to FALSE when the index is seen, and simultaneously zeros the encoder counts/position.
At that point the Z axis is slaved to the encoder position until the finish-Z is reached. (if you stop the spindle at this point then the Z axis will stop too, and will move if you turn the spindle by hand).

So, it is very important that the spindle encoder/resolver does _not_ reset to zero on every rotation, or you will not be able to make a multi-turn thread.

If you can not configure that way then you might, indeed, need an encoder-index-emulator HAL function.

Psuedo-code, assuming that you _do_ have the position value returning to zero every time and varies between 0 and 1 during a revolution
if  abs(position - old_position) > 0.5 / more than half an apparent turn since the last revolution
   if Index_enable
       position = position mod 1.0 / zero the position, keep the partial turn since "index"
       index_enable = 0
   else
       position = position + (old_position - (position + 1)) / 
else
    position = position + (old_position - position)
endif
old_position = position
Last edit: 16 Oct 2015 20:05 by andypugh.

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

More
16 Oct 2015 20:30 - 16 Oct 2015 20:37 #63823 by cgc
Replied by cgc on topic spindle-index-enable
Ah, OK !
in normal mode, the postion go to zero erery spindle turn if the index pulse is true.
In synchronized mode "motion" prevent this with the spindle-index-enable signal and start sync motion if the index is true, seen by the index-enable go false.

OK, thank you, that was the information, that I need.
Last edit: 16 Oct 2015 20:37 by cgc.

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

More
16 Oct 2015 20:37 #63824 by andypugh
Replied by andypugh on topic spindle-index-enable

Ah, OK !
in normal mode, the postion go to zero erery spindle turn if the index pulse is true.
In synchronized mode "motion" prevent this with the spindle-index-enable signal and start sync motion if the index is true, seen by the index-enable is false.


Not exactly.

In normal mode the encoder counts without limit.
at the beginning of a spindle synchronised movement the encoder is zeroed to index once, then counts without limit.

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

More
27 Oct 2015 14:03 - 27 Oct 2015 14:05 #64338 by cgc
Replied by cgc on topic spindle-index-enable
It is running :)

Lathe spindle with servo drive and syncron motion, without external encoder.

I configure the servodrive for a value of 1.000 for each spindle turn. The decimal place increase from 0.000 to 0.999 and go back to 0.000. This is the trigger to generate the index signal.

Frank

component servospindle "lathe spindle with servomotor and synchron motion";

//---------------------------------------------------------------

pin io  bit index_enable "index enable from/to motion";
pin out bit index "generated index pulse";
pin in  float servopos "position servomotor";
pin out float spindlepos "position spindle";
variable float new_decimal_place;
variable float old_decimal_place;
variable float diff_decimal_place;
variable int offset = 0;

//---------------------------------------------------------------

function _;
license "GPL";

;;

FUNCTION(_)
{
int turns = (int)servopos;

	new_decimal_place = servopos - turns;

	diff_decimal_place = new_decimal_place - old_decimal_place;

	if ((diff_decimal_place > 0.7) || (diff_decimal_place < -0.7))
		index = 1;
	else
		index = 0;

	if(index_enable && index)
	{
		offset = turns;
		index_enable = 0;
	}		 

	spindlepos = servopos - offset;

	old_decimal_place = new_decimal_place;
}
Attachments:
Last edit: 27 Oct 2015 14:05 by cgc.

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

More
27 Oct 2015 15:43 #64341 by cncbasher
Replied by cncbasher on topic spindle-index-enable
could you get it to count the index's then you could use it say on a rotary table and turn the exact revs back to zero
or for argument turn the spindle 20 times and then back etc ..

very useful depending on how accurate you can get it counting ,i would have thought

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

Time to create page: 0.076 seconds
Powered by Kunena Forum