Slow down before endstop?
-
On some of the CNC plasma systems we sell, they have two inductive sensors as the end stops.
On reaching the first, the machine slows and on reaching the second it stops and gives a limit error.
I think that on reaching the first, the max speed is reduced. On leaving the zone it's restored.
I think you could use a similar approach provided that you can create triggers that activate on both rising and falling
M581 sort of says that you can if you call it twice for the same input with different values, but you'd have to try.
When M581 is executed, if the T parameter is present but the other parameters are omitted, the trigger inputs and edge polarities for that trigger number are reported. Otherwise, the specified inputs and their polarities are added to the conditions that cause that trigger.EDIT
Thinking on this, I don't think changing the max speed would interrupt a move in progress.
You'd have to segment it -
@owend, that is a good point .... you would have to do the first move to the earlier stop as if it was the real end stop. Then go to the second end stop at a much slower speed.
-
OK.
I verified the M204 T does affect the acceleration of a G1 H1 move but when the endstop is triggered it stops immediately.
Different value for M205 do not seem to change the stopping.
The firmware supports "triggers" which are external events which can run code - but unless something has changed since I last tested that code cannot interrupt a move in progress.
You could possibly "home" using a series of short moves (10mm ?) - the trigger code may get a chance to run at the end of each move and it could do one last move with low deceleration.
I would have to test that.
-
@fcwilt ...the more I play with it the more I think it would need a firmware tweak to get something that decelerates to a value or even decelerate to a stop rather than the hard termination.
-
...or I guess I just need to make sure I home it before I turn the machine off, so that when it turns on it can assume it's not far to travel to home it, and once homed it can assume dimensions for limits. And if I forget to home it, then I suffer the wait of the slow job setup when I turn it back on
-
@thekm said in Slow down before endstop?:
@fcwilt ...the more I play with it the more I think it would need a firmware tweak to get something that decelerates to a value or even decelerate to a stop rather than the hard termination.
I agree. Other than using a series of short moves and a trigger I don't see anyway to have a "soft" endstop.
There is a firmware suggestion category.
Frederick
-
Dumb question: why can't you have and endswitch at, say, 50mm from the hard stop. When it passes that point, you know where it is, and can slow and continue on for N additional counts to get to where you want to end up?
-
@kb58 said in Slow down before endstop?:
Dumb question: why can't you have and endswitch at, say, 50mm from the hard stop. When it passes that point, you know where it is, and can slow and continue on for N additional counts to get to where you want to end up?
If you a doing a "homing" move (G1 H1) when it triggers the endstop it does an abrupt halt and no settings seem to change that.
His machine is massive enough that he wants to be able to have a nice, gentle, controlled stop.
Frederick
-
I wonder if you could play games with the code, like, temporarily setting motor current limits low before homing. It seems like it would slow down both acceleration and deceleration, maybe.
-
@kb58 said in Slow down before endstop?:
I wonder if you could play games with the code, like, temporarily setting motor current limits low before homing. It seems like it would slow down both acceleration and deceleration, maybe.
The only thing I was able to come up with, short of a firmware update, was to try and use the ability to create a piece of code called a "trigger" which can be triggered by something like an endstop switch.
With that it might be possible to do a regular move (G1 w/o H1) and when switch was activated the code in the trigger could slow and stop the motion.
But the last time I tested this (firmware 2.x I think) it did not work - things may have changed in firmware 3.x.
That is for tomorrow's testing.
Frederick
-
@kb58 ...simply to be able to home it from anywhere after turning it on, it wont know how near or far it the stop is.
But I think I'll just have to start a procedure of parking it somewhere known, by running a script, before turning it off... that way when it wakes up the homing distances will be generally known and it can rapid until it's close, then go slow to the endstop.
-
@theKM Can't you just jog it close to home before starting a slowed down homing procedure ?
-
I just realized the flaw in my suggestion: If it's got enough momentum and bulk, it'll still coast to a stop even when the steppers are trying to stop it after hitting the switch, losing its known position.
This seems to make a case for stepper "servos" with positional feedback, or go for the full Monty and move to true servos.
-
@yveske ...ultimately, yes, but this is all about automation and having things sort themselves out automatically
I'm going to create a script I can run to park it in a known place before turning it off, so that when it's turned back on it can go from there.
-
@kb58 it's not about its position being accurate, but that when you turn off the steppers the immediate stop is a horrible crunch... I'm just trying to avoid the crunch.
-
@thekm Understood, but it does argue for position feedback, so that speed can be slowed down smoothly and still end up where you want it.
-
@thekm My understanding is that the current end stop approach used by Duet/RepRap firmware is required because all stepper moves are planned and then buffered so to interrupt a planned move when an end stop (or an emergency stop) is triggered requires the planner/buffer to be overridden which is an “internal” firmware controlled action.
I guess this could be avoided if a machine had absolute position encoders, but in this case you wouldn’t really need end stops as the machine would know where it was anyway.
So for stepper controlled machines (where motion control is always relative rather than absolute) then a “proper” solution will require a firmware update (as suggested by @fcwilt above) to apply a pre-defined maximum deceleration when an end stop is triggered (and maybe a different, higher deceleration for an emergency stop?).
Whilst adding a bit of complexity, as Duet applications reach ever larger machines this functionality is likely to become increasingly important so I’d certainly vote for adding it to the Firmware wish list.
-
@cjm from a code point of view, the controller already has the ability to carry on with the gcode... sure, it may have steps in a buffer to flush, but there's already that next step. it's mostly a question of how fast can it start executing that next step.
That said, it would already have the deceleration steps and timings in the buffer, the interrupt would be mostly about skipping N places in the buffer for it to slow down gracefully without much exception handling...
...would be my guess as a software dev, but it's just a guess
-
@thekm I’m sure you’re right that implementing a buffer flush/defined deceleration down to stop after a trigger event is eminently doable from a firmware code point of view.
I was thinking also about helping the Duet team see the need for this (i.e. putting it on firmware wish list) and adding a vote to support its introduction, in comparison with the many other priorities they must have.
-
Given that we already have G1 parameters H1, H3 and H4 which terminate the move it might be simplest to have a new parameter, say H5, which would behave like H4 but would respect the M201 setting for that axis.
That would seem to be a simple update requiring no additional parameters. It could involve using M201 to set a temporary deceleration value if desired and then reset it.
The next step would be to add a additional parameter to G1 for use with H5 which would specify the deceleration to use and eliminating the need to use M201.
I'm sure @dc42 could tell us how much work those two approaches would be.
Frederick