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

More
5 years 5 months ago #209172 by andypugh

NoJo wrote: 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)
Code:
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
5 years 5 months ago - 5 years 5 months ago #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: 5 years 5 months ago by RBC.

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

More
5 years 5 months ago #209183 by andypugh

RBC wrote: 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
5 years 5 months ago - 5 years 5 months ago #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: 5 years 5 months ago by RBC.

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

More
5 years 5 months ago - 5 years 5 months ago #209201 by NoJo

andypugh wrote:

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
Not sure how to do this - where/what is 'encoder index-enable' ?


Remove the "setp index-enable" line from the M100 script. Instead use:

Code:
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


There is no "setp index-enable" line in the M100 script - this is what we had:
Code:
#! /bin/bash halcmd setp pid.c.enable 1 halcmd setp mux2.0.sel 1 halcmd sets spindle-index-enable 1
Do you mean remove set S spindle-index-enable ?
Last edit: 5 years 5 months ago by NoJo. Reason: Add HAL and ini files

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

More
5 years 5 months ago #209212 by andypugh

RBC wrote: 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?


Yes, I would imagine so. A bash script can use "halcmd getp" to get a value, and Python can either use that in an exec() or query the status structure.

Quite how you poll and wait in bash I can't say, but I imagine that the info is online.

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

Time to create page: 0.285 seconds
Powered by Kunena Forum