# Stepper speed based on position

17 Nov 2023 17:50 #285759 by Calysto
Is it possible to base the maximum velocity on the position of the X or Y axis?
My machine has fast motors but I can't use there full potential because my ball-screws start to wip at the beginning and end of there travel. So it would be nice if for example, from 0mm to 300mm the maximum velocity is 3000mm/min, and after that it goes to higher speeds. Maybe even at a certain scale....?

17 Nov 2023 19:24 #285767

Is it possible to base the maximum velocity on the position of the X or Y axis?
My machine has fast motors but I can't use there full potential because my ball-screws start to wip at the beginning and end of there travel. So it would be nice if for example, from 0mm to 300mm the maximum velocity is 3000mm/min, and after that it goes to higher speeds. Maybe even at a certain scale....?

I think maybe you can do this with the lincurve component, if not it would be fairly easy to impliment this in hal logic. The only problem (I see) is that you would have to interrupt the command from motion with some logic based on position feedback. Like motion would be commanding X at a velocity of 3000 but you would have some logic sitting between that and the output limiting it to 300, then removing the limit and allowing it to do 3000 again. Position feedback wouldn't be altered so it might be fine....it's just something you would have to test. It might not actually matter because a PID basically does this anyway

17 Nov 2023 21:20 #285780 by rodw
Adaptive feed should do this easilly
I would probably write a custom component that monitored
motion.L.pos_cmd (where L is  the axis)
and motion.current-vel

Then output  a value based on some algrothim that scales the adaptive feed to meet your requirements.
There is no requirement to just make it a simple step up, it could be a function genrating an inverted bell curve.

Its probably a good project to learn about writing components as it would be quite simple to code.

17 Nov 2023 21:55 #285784
Ah yes, adaptive feed would be ideal. I would still try to feed it with something like lincurve to test the theory.

Not everybody can or wants to learn to write C. That was the whole purpose of hal in the first place. So unless this guys a programmer he should probably just try to adapt what's already in hal, which seems feasible.

18 Nov 2023 08:05 #285800 by Calysto
I was in doubt about which sub-forum I should place my question, Basic or Advanced. Well... now I know.
I can program c++ a little, but it cost me too much time, way more time then it will save me time.
I was hoping there would me something like all kinds of compensations that already build in linuxcnc. Just a file with three columns, one for axis, one for current position, one for maximum speed. Or a curve formula, based on current position, total length, and steepness. Only the steepness should be entered in, the other values are already known.

But... what is happening when the max-velocity is changing for the X-axis, does Linuxcnc compensate that on the Y-axis?

18 Nov 2023 08:15 #285801 by Calysto

"So unless this guys a programmer he should probably just try to adapt what's already in hal, which seems feasible."

Is  there something possible that looks like I'm looking for?

18 Nov 2023 14:23 #285828

But... what is happening when the max-velocity is changing for the X-axis, does Linuxcnc compensate that on the Y-axis?

Coordinated motion is always limited by the slowest axis or it wouldn't work at all so of course the Y is compensated.

18 Nov 2023 14:28 #285829

Calysto post=285800 userid=37035

I was hoping there would me something like all kinds of compensations that already build in linuxcnc. Just a file with three columns, one for axis, one for current position, one for maximum speed.

You're trying to do something that not many people do so expecting to have some simple premade setup isn't really reasonable.

Calysto post=285800 userid=37035

But... what is happening when the max-velocity is changing for the X-axis, does Linuxcnc compensate that on the Y-axis?

Coordinated motion is always limited by the slowest axis or it wouldn't work at all so of course the Y is compensated.

18 Nov 2023 14:30 #285830

"So unless this guys a programmer he should probably just try to adapt what's already in hal, which seems feasible."
Is  there something possible that looks like I'm looking for?

Like I said, try feeding the motion adaptive feed with lincurve

18 Nov 2023 18:03 - 18 Nov 2023 18:04 #285846 by Calysto

Like I said, try feeding the motion adaptive feed with lincurve

Sorry... I have now idea how to do that... I think I will leave it this way, it's not that important. Thank you all for your good answers!

Last edit: 18 Nov 2023 18:04 by Calysto.