Component for tandem stepper axes - please test

More
05 Oct 2015 07:08 #63438 by cmorley
So was fiddling with a HAL component to facilitate tandem stepper axis homing.
I've tested a bit in a sim - seems to work.

it takes the position cmd from an axis and makes two position commands for two step drivers.
While homing it will stop and start one as it hits homing switches and create an offset for the two commands.
one thing it doesn't do is decelerate when stopping so the speeds may need to be relatively slow.

It requires two home switches and you would need to adjust the switches to adjust the racking.

If anyone would like to test, I'd love to know if it works.
component tandem_home "Tandem homing";
pin in bit is_homing;
pin in bit home_input1;
pin in bit home_input2;
pin out bit is_on_switch;
pin in float cmd;
pin out float fb;
pin out float joint_cmd1;
pin out float joint_cmd2;
pin in float joint_fb1;
pin in float joint_fb2;
pin out s32 state;

variable int enable1 = 1;
variable int enable2 = 1;
variable float offset1 = 0;
variable float offset2 = 0;
variable float switch_position1 = 0;
variable float switch_position2 = 0;
function _;
license "GPL";
;;
FUNCTION(_) {
    if(is_homing) {
        switch(state) {
        case 0:
            if(home_input1) {
                switch_position1 = cmd;
                enable1 = 0;
                state = 1;
            }
            if(home_input2) {
                switch_position2 = cmd;
                enable2 = 0;
                state = 1;
            }
            offset1 = 0;
            offset2 = 0;
            break;
        case 1:
            if(home_input1 && home_input2) {
                if(!enable1){offset1 = switch_position1-cmd;}
                if(!enable2){offset2 = switch_position2-cmd;}
                enable1 = 1;
                enable2 = 1;
                is_on_switch = 1;

            }
            break;
        case 2:

            break;
        default:
            break;
        }
    }else{
        state = 0;
    }
    if(!home_input1 && !home_input2) {is_on_switch = 0;}
    if(enable1){
        joint_cmd1 = cmd + offset1;
    }
    if(enable2){
        joint_cmd2 = cmd + offset2;
    }
    if (!enable1){
        fb = joint_fb2 - offset2;
    }else{
        fb = joint_fb1 - offset1;
    }
    
}


I would load it with:
loadrt tandem_home names=x2

The pin connection should be fairly self explanatory
The idea is it must go between linuxcnc motion controller and the step driver component.

Chris M
The following user(s) said Thank You: BigJohnT

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

More
06 Oct 2015 21:45 #63496 by andypugh

one thing it doesn't do is decelerate when stopping so the speeds may need to be relatively slow.


The stepgens have their own accel limits, so this might not matter.

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

More
28 Jan 2016 12:37 #69192 by Clive S
I was wondering if there has been any progress on this as it looks promising.

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

Time to create page: 0.121 seconds
Powered by Kunena Forum