Spindle Step/Dir servo ramp down before stop on M stop command.

More
16 May 2021 01:55 - 16 May 2021 01:57 #209022 by RBC
I want to make sure I understand what needs to be done in the new hal component.
1- Set a steps_per_rotation value that represents step count per rotation.
2- Monitor the step count (mod) steps_per_rotation ==0 and toggle a simulated output pin
3- Connect this to the encoder index input of 7i92.
Last edit: 16 May 2021 01:57 by RBC.

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

More
16 May 2021 02:13 - 16 May 2021 02:14 #209025 by PCW
I was thinking the following pins:

fb-in in float (360 degrees per turn)
fb-out out float (360 degrees per turn)
fb-turns out float = fb-out/360 (utility to avoid needing a scale component)
index-enable bi-directional bit

No hardware connections would be needed
The fb-out pin follows fb-in until index enable
has been set and fb-in mod 360 has crossed
the 0 point (new fb-in mod 360 < old fb-in mod 360 )
at which point the fb-out pin is offset by the full
number of turns and index-enable is cleared
Since there is no reset, there is no loss of the
original reference position.
Last edit: 16 May 2021 02:14 by PCW.

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

More
16 May 2021 15:54 #209107 by NoJo

Andy Wrote
To an extent you are always masking issues with PID. You have to find a compromise that works in all conditions.
Something that might work would be to set the pid.c.maxoutput to a low value in the M100 script, wait a few seconds, and set it back.

I think that inserting

halcmd setp pid.c.maxoutput 1
sleep 2
halcmd setp pid.c.maxoutput 10
Might work.

I tried this and it works, but is limited in what it can achieve -

I need to understand how the C axis re-positions itself after it is moved -
In M100 mode, do a G0 C2160 ( 6 full turns).
Then exit - M101
then spin the spindle - say M03 S1000, then stop and re-enable C - M100

The spindle seems to rotate to a zero position ( always the same place - is it the index position of the encoder?), and then rotates the 6 turns to get to the 2160 deg. IAW, does the M100 cause a rotate to index position, then rotate to required (DRO) angle?

The sleep X instruction works well if the required angle, is 'small' - ie, the sleep '2' does not time out before the required angle is reached.
This has ramifications when, eg, milling a large pitch spiral in the side of a shaft - this may be 10-20 turns, whatever.
If you then use spindle mode to say face the shaft end, then go back to C_Axis mode, that is many turns to wind up..
Setting sleep long enough to cope with that means that smaller angles will reach endpoint before sleep times out and
execution of the next Gcode begins before the time out, with odd results I notice...

So not really the way to go I guess.

I also believe the 'the M100 cause a rotate to index position, then rotate to DRO angle' is not appropriate -
I have not seen a C axis based lathe do that in real machining...
Should it not rather do something like this - if the required angle ( the angle the axis was at when we exited via M101)
is say 1280deg, then the angle to move to should be physically 200deg - ie, 1280deg/360 = 3.5556, so there are 3 full turns -
ditch those 3 and we are left with .5556 turns to move = 200deg. That way we never move more than almost 1 full turn to get anywhere.
The actual position ( C axis DRO position ) remains at 1280deg.

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

More
16 May 2021 16:55 #209126 by andypugh

If LinuxCNCs motion comp could be asked to rehome a joint including
the part where it forces its commanded joint position to equal the current
joint feedback position, this would be easier.


This might actually be possible...

Firstly, the machine would probably need to be configured to start up in C-axis mode, and with the C-axis as part of the homing sequence.
The C axis should then be configured in the INI with HOME_USE_INDEX = 1 , HOME_SEARCH_VELOCITY = 0 and HOME_LATCH_VELOCITY = 100 (or some suitable number)
Then connect joint.2.index-enable to the encoder index-enable

Remove the "setp index-enable" line from the M100 script. Instead use:
halcmd setp halui.joint.2.unhome 1
sleep 1
halcmd setp halui.joint.2.unhome 0
halcmd setp joint.2.home 1
sleep 1
halcmd setp joint.2.home 0

This will index-home the C axis using the normal LinuxCNC homing sequence. It should start from the current axis position, and so there shouldn't be any step change in command.

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

More
16 May 2021 17:16 #209130 by andypugh

I also believe the 'the M100 cause a rotate to index position, then rotate to DRO angle' is not appropriate -
I have not seen a C axis based lathe do that in real machining...


In that case I think that the answer is to re-home, as I mentioned in a recent reply (that crossed your last message in the Æther)

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

More
16 May 2021 20:07 #209162 by NoJo

I also believe the 'the M100 cause a rotate to index position, then rotate to DRO angle' is not appropriate -
I have not seen a C axis based lathe do that in real machining...


In that case I think that the answer is to re-home, as I mentioned in a recent reply (that crossed your last message in the Æther)


This becomes tricky, or at least as I understand it. Would simply re-homing not clear the C_Axis DRO to zero?
If so , that would lose the historical position of the C axis when re-entering C_Axis mode - would that matter?

Firstly, the machine would probably need to be configured to start up in C-axis mode, and with the C-axis as part of the homing sequence.

How do I set this up?

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

More
16 May 2021 21:26 #209172 by andypugh

This becomes tricky, or at least as I understand it. Would simply re-homing not clear the C_Axis DRO to zero?
If so , that would lose the historical position of the C axis when re-entering C_Axis mode - would that matter?


It would re-home to the index, so it would be a consistent position. If you wanted to go back to 1280 degrees it would have to do 4 turns, but would be back to the exact same point.


Firstly, the machine would probably need to be configured to start up in C-axis mode, and with the C-axis as part of the homing sequence.

How do I set this up?[/quote]

Mainly by adding two lines from the M100 script to the main HAL file. (but without the halcmd)
setp pid.c.enable 1
setp mux2.0.sel 1
Then make the changes that I suggested in the [JOINT_2] section of the INI file.
(basically setting up index-only homing for the C axis)
The following user(s) said Thank You: NoJo

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

More
16 May 2021 22:39 - 16 May 2021 23:03 #209177 by RBC
PCW-
Here is what I have so far:
I did not understand the
'(new fb-in mod 360 < old fb-in mod 360 )
at which point the fb-out pin is offset by the full
number of turns '
part.


component stepper_spindle_index "spindle index-enable at given stepcount(per 360 degrees)";
pin in float fb-in;
pin out float fb-out;
pin out float fb-turns;
pin in float scale-in;
pin io bit index-enable;

function _;
license "GPL";
;;
#include <rtapi_math.h>
FUNCTION(_) {
if (index_enable==0){
//fb-out follows fb-in while index-enable=0
fb_out=fb_in;
}

if (index_enable==1){ //index-enable is requested by G33, or G76
double res=remainder(fb_in,360.0 * scale_in);
if (res==0){
index_enable=0;
fb_turns=fb_in/360.0;
}

}
}
Last edit: 16 May 2021 23:03 by RBC.

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

More
16 May 2021 23:28 #209183 by andypugh

Is it possible to use any programming statements in these M101 files.


Yes, in fact M100 etc can be any executable file. They are bash scripts in this case, but they could be Python, Awk, Rust, APL.... just by changing the #! at the top.
The following user(s) said Thank You: RBC

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

More
17 May 2021 01:07 - 17 May 2021 01:09 #209190 by RBC
I need to poll for stepgen velocity=0 before executing position-reset so I dont get the following errors.
Is this something I can do?
Last edit: 17 May 2021 01:09 by RBC.

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

Time to create page: 0.110 seconds
Powered by Kunena Forum