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

    Multiple motion system

    Scheduled Pinned Locked Moved Solved
    General Discussion
    8
    69
    2.6k
    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.
    • Alvaundefined
      Alva
      last edited by Alva

      Hello,
      I am trying to experiment with the second motion system. I was reading the whole documentation about the second motion system and couldn't really understand how to assign the unused axes to the second motion system. Can someone please help me understanding the concept? How do i map the unused axes to the second motion system? Thank you 🙏

      M596 P1 ; selects the second motion system.
      

      I want to somehow maps the unused tool to the second motion system

      droftartsundefined 1 Reply Last reply Reply Quote 0
      • droftartsundefined
        droftarts administrators @Alva
        last edited by droftarts

        @Alva Once the second motion system is selected, you just send Gcode commands to it as usual; you don't map them to that system as such. Once a motion system starts using an axis or extruder, it owns it until it is released, usually with M400. As it says in https://docs.duet3d.com/en/User_manual/RepRapFirmware/Multiple_motion_systems:

        At any time, each motion system “owns” a set of physical axes and extruders. It may also own a tool. No other motion system can use those axes/extruders or that tool until the owning motion system releases it. See below for details of ownership of axes and extruders.

        For example, if the first motion system is running commands in XYZ and for T0, you could set the second motion system to use a second extruder, and if it is on an independent axis (say U), move that too. eg

        ... ; moves in motion system 0
        G1 X100 Y100 Z5 E0.1 F1000
        G1 X110 Y100 E0.1 F1000
        M596 P1 ; selects the second motion system
        T1      ; select tool (set temperature changes from standby to active temperature)
        M116 P1 ; wait for temperature to be reached 
        G1 E5 F1000 ; prime extruder
        M596 P0 ; change back to first motion system, while the above happens
        G1 X120 Y100 E0.1 F1000
        ...
        M400 ; wait until motion stops, release owned axes and extruders from motion systems
        T1 ; first motion system takes over T1, parking T0.
        ...
        

        (I haven't tested the above, I'm not sure if sending M116 will cause both motion systems to pause, though I would have thought it shouldn't.)

        Remember that the second motion queue only has a queue depth of 3 commands by default. Use the M595 command to lengthen it if necessary.

        Edit: I've updated the wiki page with a little extra info, but waiting for @dc42 for some details.

        Ian

        Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

        Alvaundefined 1 Reply Last reply Reply Quote 0
        • Alvaundefined
          Alva @droftarts
          last edited by

          @droftarts Is there any way to print back the axes used by the motion systems? I have tried the sample code that you have sent me above and it resulted in the error as shown in the figure below.
          6de94ec2-d210-410a-9d0c-54a18fd16a8e-image.png. I tested the above piece of code as a macro. In my system i have X, Y, Z, U , W axes and tool 0 is moved by u and tool 1 by w axes.

          echo "start testing 2nd motion system"
          T0
          G1 X100 Y100 Z25 E0.1 F1000
          G1 X110 Y100 E0.1 F1000
          M596 P1 ; selects the second motion system
          T1      ; select tool (set temperature changes from standby to active temperature)
          M568 P1 S200 R200 ; wait for temperature to be reached
          G1 E5 F1000 ; prime extruder
          M596 P0 ; change back to first motion system, while the above happens
          G1 X120 Y100 E0.1 F1000
          M400 ; wait until motion stops, release owned axes and extruders from motion systems
          T1 ; first motion system takes over T1, parking T0.
          echo "done testing 2nd motion system"
          

          Line number 6 is selection of the tool and is clearly not X axis.

          gloomyandyundefined 1 Reply Last reply Reply Quote 0
          • gloomyandyundefined
            gloomyandy @Alva
            last edited by

            @Alva Do you have anything in the various tool change macros?

            Alvaundefined 1 Reply Last reply Reply Quote 0
            • Alvaundefined
              Alva @gloomyandy
              last edited by

              @gloomyandy i am just setting the led strip colors of the corresponding active tool and moving the u or w axes based on which tool is activated to its minimum position

              Alvaundefined 1 Reply Last reply Reply Quote 0
              • Alvaundefined
                Alva @Alva
                last edited by

                @Alva I tried another test, while the machine was printing i trigerred daemon with a flag global.called and created the condition when global.called= true to select the second motion system and move the W axis. then the axes moved to the Y max and crashed and machine still remains in the printing state doing nothing.
                2199d95c-5d6d-4f57-91af-a4318e20bbf2-image.png

                gloomyandyundefined 1 Reply Last reply Reply Quote 0
                • gloomyandyundefined
                  gloomyandy @Alva
                  last edited by

                  @Alva The system staying in the printing state is to be expected when you get a motion error, it is basically partially shutdown when that error occurs. The question is why are you getting those errors. I assume if you just run whatever it is you are printing then you do not get that error. I'm not sure if running the second motion system from another gcode stream is causing a problem. From what I remember I think there may be some assumptions that both motion systems are running from the same gcode file (possibly forked using M606).

                  It might help if you post your config.g file and maybe a picture (or video) of your printer. I'm struggling to work out how all of this fits together, you seem to have two tools but six extruders and 5 axes. I'm also a little confused as to how the tools are controlled what moves when you command X and Y moves?

                  Alvaundefined 1 Reply Last reply Reply Quote 0
                  • Alvaundefined
                    Alva @gloomyandy
                    last edited by Alva

                    @gloomyandy Hello ,
                    Sorry for the late reply. Was on vacation for few days. I have continued the "experiment". Ignore the number of extruder drivers i had above. I rewired and reconfigured everything to the very simple set up. I have a Duet 3 mini 5+ board with CAN expansion motor board and a tool board. I have X;Y;Z set up via the motor board and the tool axes from the tool board. I have a stepper motor connected to the mini board and i configured it as U axis. It is just for the experimental set up. (My intended use is to load filament in the other tool while the machine is printing). So the U axis is my fake tool for example. I am just experimenting before i want to really implement it.
                    My findings so far.:

                    • With the firmware version 3.5.3 , it is working.
                    • With the firmware version 3.6.0.beta1 i am getting the error that i reported before.
                      daemon(1).g config(3).g .
                      Thank you .
                    gloomyandyundefined 1 Reply Last reply Reply Quote 0
                    • gloomyandyundefined
                      gloomyandy @Alva
                      last edited by

                      @Alva I think the first step will be to wait for 3.6.0-beta.2 (due shortly I think) and test again with that. If it still fails then try and create a simple test case that recreates the problem and then we will need to try and reproduce the problem.

                      Alvaundefined 1 Reply Last reply Reply Quote 0
                      • Alvaundefined
                        Alva @gloomyandy
                        last edited by

                        @gloomyandy Okay, I will wait for the release then. Thank you

                        droftartsundefined 1 Reply Last reply Reply Quote 0
                        • droftartsundefined
                          droftarts administrators @Alva
                          last edited by

                          @Alva It is available now: https://github.com/Duet3D/RepRapFirmware/releases/tag/3.6.0-beta.2

                          Ian

                          Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

                          Alvaundefined 1 Reply Last reply Reply Quote 0
                          • Alvaundefined
                            Alva @droftarts
                            last edited by Alva

                            @droftarts c546f055-9531-417e-87b9-45629334e4a4-image.png

                            • daemon(2).g
                            • mini(1).gcode
                              Hello , i have updated the machine to 3.6.0.beta2 and tried a simple logic as seen in the mini-1.gcode which is attached. while it starts the print i manually set the flag to enable the daemon.g and the daemon.g is also attached. And the same error occurred again. 😞 Do you think there is something wrong with the way that i understood the second motion system? or am i doing something wrong? weird that my logic worked in 3.5. fw version.
                              Please let me know. Thank you. 🙂
                            Alvaundefined 1 Reply Last reply Reply Quote 0
                            • Alvaundefined
                              Alva @Alva
                              last edited by

                              @Alva Looks like there was a mistake in the 3.6.0.beta2 release and David updated the new one today. I will try out that one.

                              dc42undefined 3 Replies Last reply Reply Quote 0
                              • dc42undefined
                                dc42 administrators @Alva
                                last edited by

                                @Alva here are a couple of clarifications:

                                • When you select a tool (which becomes the current tool for the current motion system), the axes that X and Y are mapped to for that tool become owned by the current motion system.
                                • It's fine to drive the two motion systems from different GCode streams.

                                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

                                1 Reply Last reply Reply Quote 0
                                • dc42undefined
                                  dc42 administrators @Alva
                                  last edited by

                                  @Alva I just noticed this in your mini(1).gcode file:

                                  G4 P0 S0.5

                                  You should use either P or S in G4, not both. Similarly in daemon.g. However, this doesn't explain the error.

                                  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

                                  1 Reply Last reply Reply Quote 0
                                  • dc42undefined
                                    dc42 administrators @Alva
                                    last edited by

                                    @Alva my best guess is that the move G1 X0 Y0 U0 in mini(1).gcode hasn't completed when daemon.g starts commanding U axis motion. This shouldn't be possible, because if U hasn't finished moving then U should still be owned by MS0, so the attempt to move it in daemon.g should fail with the "axis already owned by another MS" message. I'll check the M400 code.

                                    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

                                    Alvaundefined 1 Reply Last reply Reply Quote 0
                                    • Alvaundefined
                                      Alva @dc42
                                      last edited by Alva

                                      @dc42 I have edited the code and logic a bit. Found different cases:

                                      ; File Name: 		/sys/daemon.g
                                      if(!exists(global.daemonStop))
                                      	global daemonStop = false	; Set to 1 to stop the daemon.g, it can be use to upload a new daemon.g file
                                      
                                      while( global.daemonStop == false )
                                          if(state.status== "processing")
                                              G91
                                              M596 P1
                                              G1 U5 F300      
                                              M596
                                          G4 P0
                                      M99; Exit
                                      

                                      test_2nd_MS.gcode
                                      7add628d-3f09-4e4c-ac6e-54d79d08056d-image.png .
                                      This happened when i activated the daemon before the move to X0 Y0. But if i activate the daemon after that then it works perfectly. Cannot relate whats going on.

                                      set global.daemonStop = true ; stopped the daemon
                                      M118 S{"starting to move"}
                                      G90
                                      G1 X0 Y0
                                      M400 S1
                                      G91
                                      set global.daemonStop = false ; activated the daemon which only use U axis
                                      G1 X100 Y100 F200
                                      M400 S1
                                      G90
                                      M118 S{"move done"}
                                      M99
                                      

                                      b5beb214-e0cc-46e3-961a-ecec72fff837-image.png

                                      Alvaundefined 1 Reply Last reply Reply Quote 0
                                      • Alvaundefined
                                        Alva @Alva
                                        last edited by

                                        @Alva 1e818874-3288-4cfe-a143-7fb4e5f103d7-image.png

                                        Alvaundefined 1 Reply Last reply Reply Quote 0
                                        • Alvaundefined
                                          Alva @Alva
                                          last edited by

                                          @Alva Looks like it is a timing problem or something.

                                          dc42undefined 1 Reply Last reply Reply Quote 0
                                          • dc42undefined
                                            dc42 administrators @Alva
                                            last edited by

                                            @Alva thanks, I will try to replicate it.

                                            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

                                            Alvaundefined 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Unless otherwise noted, all forum content is licensed under CC-BY-SA