Gcode: stop current move with deceleration (no emergency)



  • Hello everybody,

    tldr:
    Is there a GCode command to stop the current movement apart from using an Emergency Stop? (which could result in the steppers losing track of their positions). It does not need to break immediately (deceleration is fine).

    Background:
    I want to use Duet boards as a mainboard for all kinds of CNC prototypes we build at work.
    My plan would be to have some application (mainly NodeJS) run on a RaspberryPi or Jetson that controls the Duet via USB.

    I have used similar approaches with boards by other manufacturers, but I really like the expandability Duet offers. Marlin does not have this feature either (or does it?).



  • is a pause enough? https://duet3d.dozuki.com/Wiki/Gcode#Section_M25_Pause_SD_print
    This will run the remainder of the print queue/buffer before pausing.



  • unfortunately no, since I am streaming commands via USB and because I want to stop the current movement.

    As a technical background: I build a microscope that is focussed by adjusting the z-height of the optic. Detection of the focus happens on the Raspberry Pi and I would like to move the Z-axis towards an endpoint, but stop if the optics are in focus.

    Let's say I am at Z-Position 0 and the maximum travel is 10 mm.
    I would like to send a command to travel to +10mm. While moving, the image becomes sharper and at 4mm it is perfect. I would like to abort movement now and stay there (at 4mm Z-height) to take more images.
    (This example is not perfect, since it would probably overshoot due to deceleration, but that's not important right now).



  • @turbomax How about hooking one of the RPI's GPIO lines into an endstop input on the Duet?

    Then, when you detect the image is in focus, you trigger the endstop and that motor will stop immediately.



  • @alankilian I have also thought about something like that, but it seems a bit hacky to me.
    This is not an issue I have to resolve right now, it is more of a general question. I know it's not an essential functionality for 3D printing, but it is definitely relevant for CNC.



  • The same approach also gives clean jogging: Key down, send move command towards machine limits; key up, send stop current movement command.



  • @JuKu said in Gcode: stop current move with deceleration (no emergency):

    The same approach also gives clean jogging: Key down, send move command towards machine limits; key up, send stop current movement command.

    what do you mean by "same approach"? the one with the endstop?

    the reason why i don't really like that approach is that i would have to rely on a controller-computer that has gpio pins. i would not be able to use this with a laptop.

    what kind of might work would be using a gpio on the duet board which is pulling another (endstop) pin high. still a hack though.

    but at least this discussion shows that there doesn't seem to exist a command to do this...


Log in to reply