• Tags
  • Documentation
  • Order
  • Register
  • Login
Duet3D Logo Duet3D
  • Tags
  • Documentation
  • Order
  • Register
  • Login

Gcode: stop current move with deceleration (no emergency)

Scheduled Pinned Locked Moved
Firmware wishlist
11
23
3.0k
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • undefined
    turbomax
    last edited by 18 Nov 2020, 15:25

    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?).

    1 Reply Last reply Reply Quote 1
    • undefined
      jay_s_uk
      last edited by 18 Nov 2020, 15:37

      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.

      Owns various duet boards and is the main wiki maintainer for the Teamgloomy LPC/STM32 port of RRF. Assume I'm running whatever the latest beta/stable build is

      1 Reply Last reply Reply Quote 0
      • undefined
        turbomax
        last edited by turbomax 18 Nov 2020, 16:06

        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).

        undefined 1 Reply Last reply 18 Nov 2020, 16:09 Reply Quote 0
        • undefined
          alankilian @turbomax
          last edited by 18 Nov 2020, 16:09

          @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.

          SeemeCNC Rostock Max V3 converted to V3.2 with a Duet2 Ethernet Firmware 3.2 and SE300

          undefined 1 Reply Last reply 18 Nov 2020, 16:18 Reply Quote 0
          • undefined
            turbomax @alankilian
            last edited by 18 Nov 2020, 16:18

            @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.

            1 Reply Last reply Reply Quote 0
            • undefined
              JuKu
              last edited by 18 Nov 2020, 17:09

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

              undefined 1 Reply Last reply 18 Nov 2020, 19:50 Reply Quote 0
              • undefined
                turbomax @JuKu
                last edited by 18 Nov 2020, 19:50

                @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...

                1 Reply Last reply Reply Quote 0
                • undefined
                  dc42 administrators
                  last edited by 17 Nov 2022, 07:53

                  @Pinninti-Ajith this feature is planned for RRF 3.5.

                  Duet WiFi hardware designer and firmware engineer
                  Please do not ask me for Duet support via PM or email, use the forum
                  http://www.escher3d.com, https://miscsolutions.wordpress.com

                  undefined undefined 2 Replies Last reply 7 Feb 2023, 23:24 Reply Quote 2
                  • undefined
                    avdoverflow @dc42
                    last edited by 7 Feb 2023, 23:24

                    @dc42 Is this feature implemented in the current Release 3.5beta1 or Release 3.5beta2? If so, what is the GCode command to stop the current movement?

                    undefined 1 Reply Last reply 8 Feb 2023, 08:17 Reply Quote 1
                    • undefined
                      T3P3Tony administrators @avdoverflow
                      last edited by 8 Feb 2023, 08:17

                      @avdoverflow no not yet.

                      Btw as a work around have you tried using a high segmentation value and then pause?

                      www.duet3d.com

                      1 Reply Last reply Reply Quote 0
                      • undefined
                        avdoverflow
                        last edited by 15 Feb 2023, 05:36

                        @T3P3Tony Thanks for the response.

                        I am testing out segmentation on Firmware 3.4.5. I am connected to my Duet 2 Wifi with both the web interface and YAT.

                        I am trying to implement a CNC jog feature. For the CNC jog, I want to be able to:
                        1.) Quickstop as mentioned in this thread, and
                        2.) Poll the current machine position during any movement.
                        I think segmentation might work, but I noticed something odd while testing.

                        I first set my segmentation with "M669 S600 T0.05".
                        Test 1:
                        In Duet Web Control 3.4.5, I can do a move using the button.
                        In YAT, I can send "M408 S3" to poll the current position anytime during the move. I immediately get a machine position response back.

                        Test 2:
                        In YAT, I send "G91 G1 X10" to move the X-axis.
                        In Duet Web Control 3.4.5, I can send a console command "M408 S3" to poll the current position at anytime during the move. I immediately get a machine position response back.

                        Test 3:
                        In Duet Web Control 3.4.5, I can do a move using the button.
                        In Duet Web Control 3.4.5, I can send a console command "M408 S3" to poll the current position. The M408 command stalls and does not respond until the move is almost complete.

                        Test 4:
                        In YAT, I send "G91 G1 X10" to move the X-axis.
                        In YAT, I can send "M408 S3" to poll the current position. I do not get a response back until the move is almost complete.

                        Is there a way to remove that delay in Test 4? I am writing a C# program that primarily communicates with Duet through serial.

                        undefined 1 Reply Last reply 15 Feb 2023, 09:44 Reply Quote 0
                        • undefined
                          T3P3Tony administrators @avdoverflow
                          last edited by 15 Feb 2023, 09:44

                          @avdoverflow when a channel is executing a command, it wont process the next command on that channel which is why you are seeing this discrepancy in when you are getting results.

                          www.duet3d.com

                          undefined 1 Reply Last reply 15 Feb 2023, 16:43 Reply Quote 0
                          • undefined
                            avdoverflow @T3P3Tony
                            last edited by 15 Feb 2023, 16:43

                            @T3P3Tony
                            1.) Is there a way to create multiple channels in a single interface (only USB or only WiFi) and then specify certain commands to each channel? For example one channel will be only for movement and the second channel will be only for reading position.

                            2.) Or is there a way to execute a movement command without locking the channel up? For example, in Grbl I am able to use the "?" command to get a "Status report query" anytime during a movement command. In Marlin "M114" (Get Current Position) also works anytime during a movement command.

                            Thanks for the help.

                            undefined 1 Reply Last reply 15 Feb 2023, 20:38 Reply Quote 0
                            • undefined
                              timothyz @avdoverflow
                              last edited by 15 Feb 2023, 20:38

                              @avdoverflow I think the proper solution is to make a change to the interface to allow the commands to be buffered such that any commands in the buffer that are non motion commands could be executed on the fly/mid move? dc42 will need to confirm the possibility of this. I am very excited to see move segmentation added, does this mean that it will be possible to track the distance to go until the end of a move in DWC? If so that makes it one of the last fundamental features of a fully formed cnc controller.

                              undefined 1 Reply Last reply 16 Feb 2023, 17:21 Reply Quote 1
                              • undefined T3P3Tony moved this topic from Gcode meta commands 16 Feb 2023, 08:09
                              • undefined
                                dc42 administrators @timothyz
                                last edited by 16 Feb 2023, 17:21

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

                                does this mean that it will be possible to track the distance to go until the end of a move in DWC?

                                In RRF 3.5beta1 and beta2 the machine coordinates are updated during the move, whether or not you enable segmentation.

                                GCode is essentially a serial protocol, so it's not possible to distinguish between commands that need to be buffered and those that don't. There would always be the possibility of a pending movement command blocking a status-requesting command. The correct way to resolve this is to use two separate command channels, which is in effect how DWC gets status updated even when it is waiting for a command to complete.

                                I am fairly sure you will find that M114 in Marlin blocks if the input buffer is full. If the movement queue has commands in it (and perhaps is full) but the input buffer is not full, then both RRF and Marlin will respond to M114.

                                Duet WiFi hardware designer and firmware engineer
                                Please do not ask me for Duet support via PM or email, use the forum
                                http://www.escher3d.com, https://miscsolutions.wordpress.com

                                undefined 1 Reply Last reply 21 Feb 2023, 23:23 Reply Quote 1
                                • undefined
                                  avdoverflow @dc42
                                  last edited by 21 Feb 2023, 23:23

                                  @dc42
                                  Is there is guide or tutorial on how to create "two separate command channels?"

                                  Getting status updates while waiting for commands to complete is what I am looking for. Thanks in advance.

                                  undefined 1 Reply Last reply 22 Feb 2023, 12:00 Reply Quote 0
                                  • undefined
                                    dc42 administrators @avdoverflow
                                    last edited by 22 Feb 2023, 12:00

                                    @avdoverflow on what device are you looking to get status updates while commands initiated by that device are in progress, and how will that device be connected to the Duet?

                                    The usual way to implement jogging in a CNC pendant (such as the one described at https://docs.duet3d.com/en/User_manual/Connecting_hardware/IO_CNC_Pendant) is to send a small movement command each time the jogging wheel is moved. If you want to use a button instead of a wheel and move the axis while the button is held down, you could do a similar thing i.e. send small movement commands at intervals while the button is held down. Either way, if you avoid sending movement commands too fast to be executed in real time, movement will stop when pendant stops sending movement commands.

                                    Duet WiFi hardware designer and firmware engineer
                                    Please do not ask me for Duet support via PM or email, use the forum
                                    http://www.escher3d.com, https://miscsolutions.wordpress.com

                                    undefined 1 Reply Last reply 2 Feb 2024, 07:20 Reply Quote 0
                                    • undefined
                                      Dep @dc42
                                      last edited by 2 Feb 2024, 07:20

                                      @dc42 Is there any progress on this issue?

                                      There is another idea - you can write a macro in which the submission of a micro movement command will be looped. In this cycle we can check the state of the pin and exit by pressing a button.

                                      I need this to connect a weight sensor in a photopolymer printer.

                                      1 Reply Last reply Reply Quote 0
                                      • undefined
                                        Dep @dc42
                                        last edited by 1 Apr 2024, 17:22

                                        @dc42 Any news on this issue? I decided not to make a new topic so as not to create duplicates.

                                        undefined 1 Reply Last reply 8 Apr 2024, 10:43 Reply Quote 1
                                        • undefined
                                          dc42 administrators @Dep
                                          last edited by 8 Apr 2024, 10:43

                                          @Dep right now our focus is on getting RRF 3.5 released. RC4 is almost ready and if no serious issues are found it it we expect to release 3.5.0 stable 1 to 2 weeks later.

                                          Duet WiFi hardware designer and firmware engineer
                                          Please do not ask me for Duet support via PM or email, use the forum
                                          http://www.escher3d.com, https://miscsolutions.wordpress.com

                                          undefined 2 Replies Last reply 10 Apr 2024, 16:04 Reply Quote 1
                                          • First post
                                            Last post
                                          Unless otherwise noted, all forum content is licensed under CC-BY-SA