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

    Direction/Velocity Vector of Printhead movement

    Scheduled Pinned Locked Moved
    Plugins for DWC and DSF
    8
    20
    1.3k
    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.
    • demeundefined
      deme
      last edited by

      Hello guys,

      I have an application where I need control signals depending on the feed direction preferably in "real time". Currently I am using a simplified test setup consisting of a Duet3 Main Board 6HC in SBC mode with a Raspberry Pi 4 and a LED ring that I want to use for visualisation purposes of the control signals (PWM 0 to 5V).

      I am new to the Duet software framework and am looking for a way to be able to read the feed direction from the printer controller. I have already looked at the DSF ObjectModel and discovered the ModelObject CurrentMove. However, all variables (speed, acceleration, deceleration, etc.) are only displayed as absolute values. To be able to make conclusions about the direction I need the information as a vector.

      Can anyone tell me where I could get the information about a direction vector, or whether someone is planning something similar or has already implemented it? So far I have not been able to find anything comparable on the duet forum.

      Alternatively, I would also have the idea of using an accelerometer. But first I would like to check the software implementation.

      E3D ToolChanger & Motion System with Duet3 Main Board and custom Tools

      T3P3Tonyundefined rjenkinsgbundefined 2 Replies Last reply Reply Quote 0
      • T3P3Tonyundefined
        T3P3Tony administrators @deme
        last edited by

        @deme I have moved this to the DSF plugins forum because i think this would need to be implemented as a plugin. The OM does not expose the information you need but you should be able to reconstruct it from the previous and current co-ordinates.

        www.duet3d.com

        demeundefined 1 Reply Last reply Reply Quote 0
        • demeundefined
          deme @T3P3Tony
          last edited by

          @t3p3tony: Thanks for the quick feedback. I thought about that, but I think it would be more efficient to get the information directly from the path planning of the controller. Is there a chance to do this? I want to output the control signals as quickly as possible, as a kind of "real-time" control.

          E3D ToolChanger & Motion System with Duet3 Main Board and custom Tools

          T3P3Tonyundefined 1 Reply Last reply Reply Quote 0
          • T3P3Tonyundefined
            T3P3Tony administrators @deme
            last edited by

            @deme you could have a look at what the debug output to USB gives you:
            https://duet3d.dozuki.com/Wiki/M111
            there might be something useful there.

            Part of the issue with getting it from the planner is that is operating ahead of the actual movement so you might be quicker to real time by doing it from the current position - the previous position as a DSF plugin running on the Pi.

            www.duet3d.com

            demeundefined 1 Reply Last reply Reply Quote 1
            • demeundefined
              deme @T3P3Tony
              last edited by

              @t3p3tony: In the meantime I wrote myself a small script that reads out the positions from OM during the movements of the printhead.

              The problem that comes up when I calculate the direction vector over the last point minus the current point is that the direction vector runs behind the current movement. To get the correct vector I need the point the print head is moving towards. (So a point in the future).

              I did some more research on this and came across the following article from 2017: https://forum.duet3d.com/topic/2985/current-position
              Here dc42 describes that the current position is updated only at the end of each movement. Is there meanwhile a way how I can output the next position, which the printhead moves to?

              E3D ToolChanger & Motion System with Duet3 Main Board and custom Tools

              T3P3Tonyundefined 1 Reply Last reply Reply Quote 0
              • T3P3Tonyundefined
                T3P3Tony administrators @deme
                last edited by

                @deme not from the OM as it currently stands. The best would be to use a DSF plugin to pre-process the gcode stream and keep a list of the next moves that are about going to happen. you can then correlate that with the OM.

                www.duet3d.com

                demeundefined 1 Reply Last reply Reply Quote 2
                • demeundefined
                  deme @T3P3Tony
                  last edited by

                  @t3p3tony In the short term this could work, but in the long term it would be better to be able to read the queue directly to enable directional in-situ control. Is there an alternative to the OM? Does it make sense to reprogram the firmware? The topic is part of my master thesis and I have to consider all alternatives.

                  E3D ToolChanger & Motion System with Duet3 Main Board and custom Tools

                  T3P3Tonyundefined o_lampeundefined 2 Replies Last reply Reply Quote 0
                  • rjenkinsgbundefined
                    rjenkinsgb @deme
                    last edited by

                    @deme said in Direction/Velocity Vector of Printhead movement:

                    looking for a way to be able to read the feed direction from the printer controller.

                    Could you use an accelerometer on the tool?
                    That would give instantaneous direction & acceleration ( so indirectly, velocity).

                    The Duet can also take an accelerometer directly, though I'm not sure if the data that collects can be accessed.

                    Robert J.

                    Printers: Overlord pro, Kossel XL+ with Duet 6HC and "Frankentron", TronXY X5SA Pro converted to E3D toolchange with Duet 6HC and 1LC toolboards.

                    T3P3Tonyundefined 1 Reply Last reply Reply Quote 2
                    • T3P3Tonyundefined
                      T3P3Tony administrators @rjenkinsgb
                      last edited by

                      @rjenkinsgb as it stands the accelerometer data is saved to a file during capture, not directly accessible through the object model.

                      www.duet3d.com

                      1 Reply Last reply Reply Quote 2
                      • T3P3Tonyundefined
                        T3P3Tony administrators @deme
                        last edited by

                        @deme It would be possible for you to modify the firmware to report this information, but I don't know how much work it would be, possibly quite a lot and it may require changes that break/reduce the effectiveness of other elements.

                        The reason for writing DSF in the way is is written, with the ability to have plugins that intercept and process the gcode stream, is to allow for usecases like this. For most people it is easier to write a python script than work directly with the C++ in firmware.

                        www.duet3d.com

                        1 Reply Last reply Reply Quote 1
                        • botundefined
                          bot
                          last edited by

                          I forget where I saw it, but I recently saw a video of someone who had a concrete printer or some other kind of special printer. The toolhead oriented itself towards the print direction. I believe, but I might be incorrect, that the machine used a modified version of RRF.

                          *not actually a robot

                          resamundefined 1 Reply Last reply Reply Quote 1
                          • resamundefined
                            resam @bot
                            last edited by

                            Concrete printer and knife follower have definitely been a topic here. Usually they get controlled with an extra axis which gets positional movement instructions from the slicer / gcode directly (instead of trying to calculate it on the fly). See https://forum.duet3d.com/topic/6993/requests-for-help-gcode-cam-follower-tangential-knife-control

                            1 Reply Last reply Reply Quote 3
                            • o_lampeundefined
                              o_lampe @deme
                              last edited by

                              @deme said in Direction/Velocity Vector of Printhead movement:

                              it would be better to be able to read the queue directly to enable directional in-situ control.

                              IMHO to get ahead of the queue, you need to simulate gcode in real time on the Pi and send data to Duet simultaneously.
                              IIRC, the simulator plugin currently runs on the Duet, so there is a pile of work to do.
                              Using only the accelerometer will fail in the long run, you'd need a 6DOF or even 9DOF sensor fusion ( accel, position, earth-magnet field) like it's used for multicopter heading and mission control (path control)

                              1 Reply Last reply Reply Quote 2
                              • demeundefined
                                deme
                                last edited by

                                Hi guys,

                                thanks again for your ideas and tips. It's been a while now, but I implemented and tested many ideas. In the meantime, I finished my toolchanger conversion and can finally perform proper tests.

                                I have tested the following:

                                1) An accelerometer mounted on the Tool-Carrier
                                @rjenkinsgb said in Direction/Velocity Vector of Printhead movement:

                                Could you use an accelerometer on the tool?
                                That would give instantaneous direction & acceleration ( so indirectly, velocity).

                                The idea is great, but after a few tests I unfortunately noticed that any vibration (door slam) affects my LED control. I know I could further process the sensor data through the Raspberry Pi and could solve the problem. But I don't like the fact that unplanned environmental influences can affect my control.

                                @t3p3tony said in Direction/Velocity Vector of Printhead movement:

                                @rjenkinsgb as it stands the accelerometer data is saved to a file during capture, not directly accessible through the object model.

                                I solved this problem by connecting the accelorometer directly to the Raspberry Pi.

                                2) Stay ahead of the movement with a code logger

                                @o_lampe said in Direction/Velocity Vector of Printhead movement:

                                IMHO to get ahead of the queue, you need to simulate gcode in real time on the Pi and send data to Duet simultaneously

                                @o_lampe has brought me to the idea, to analyze the queue with a code logger, make my calculations and keep them in a kind of buffer until I reach the current position. For this I wrote a script using the dsf-pyhthon API, which stores the commands that are sent to the RRF (State: Executed) and compares them with the current position.

                                The problems I have with this concept ist that I lose my reference when changing between absolute and relative positioning. Here I would have to program a parser that reads G90/G91 commands in addition to the G0/G1 and store the future absolute Position, as it probably is implemented in the RRF. This makes the script sluggish and not real-time capable. Or maybe my programming skills are just too bad to implement something like that.

                                3) My current concept

                                @resam said in Direction/Velocity Vector of Printhead movement:

                                Concrete printer and knife follower have definitely been a topic here. Usually they get controlled with an extra axis which gets positional movement instructions from the slicer / gcode directly (instead of trying to calculate it on the fly). See https://forum.duet3d.com/topic/6993/requests-for-help-gcode-cam-follower-tangential-knife-control

                                Thanks to @resam for the forum post by @Russ-Gries. Following the discussions in this forum, I would like to proceed as follows:

                                • instead of trying to calculate the Position of the LED ring on the fly, i want the LED ring to be seen as an additional axis
                                • a post processing script should extend the positional arguments with another corrdinate (e.g. U) => alredy done
                                • Position U shall be recognized by a plugin (DSF Command Subscription around the OM) and control the LED Ring

                                My current problems are:

                                • if I don't configure U as an addition axis, G1 U10 commands are not parsed and not passed to the OM
                                • if I configure U as a kind of "virtual axis" the LED ring acts like a motor. This gives me delays caused by the path calculation, especially if I have multiple circular movements when the position changes from 360 to 0.

                                I am surprised that such a simple task (turn on LED in feed direction) becomes such a complicated project. Does anyone have an idea how I can configure a virtual axis but not "move" it as a real one? I have read about a second DDA ring, but haven't dived into it yet. Would that also be a possible solution?

                                E3D ToolChanger & Motion System with Duet3 Main Board and custom Tools

                                dc42undefined CNCModellerundefined 2 Replies Last reply Reply Quote 1
                                • dc42undefined
                                  dc42 administrators @deme
                                  last edited by

                                  @deme if you are prepared to compile the firmware yourself, you could add the current direction vector to the object model. You would need to modify the code in file Move.cpp and perhaps also in DDA.h or DDA.cpp to add the direction vector from the DDA to the object model. The code that adds requestedSpeed and topSpeed from the DDA to the OM could serve as a guide.

                                  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

                                  CNCModellerundefined demeundefined 2 Replies Last reply Reply Quote 1
                                  • CNCModellerundefined
                                    CNCModeller @deme
                                    last edited by

                                    @deme I've been following this thread as I've been thinking about using a laser diode to preheat the previous layer just before the next layer is applied. This would be achieved by having the laser focused just ahead of nozzle in the direction of travel, on a rotating axis wrapped around the nozzle assembly. I think is has parallels, and I'd be using a real motor driven axes so wouldn't be worried about your current issue. I could also just have many laser diodes covering segments of the nozzle perimeter, which would be directly equivalent to your concept.

                                    If you have any pointers on how your proposed post processing script would work I'd be interested to hear about them.

                                    All the best.
                                    Barry M

                                    Polar Duet3 Mini + 1HCL
                                    https://youtube.com/playlist?list=PLWjZVEdMv1BY82izahK45qKh-hp3NFkix
                                    Wanhao D4S: Duet2
                                    https://forum.duet3d.com/post/296755
                                    K40 Laser, Duet2
                                    https://forum.duet3d.com/post/312082
                                    Wanhao D5S
                                    https://www.youtube.com/CNCModellerUK

                                    1 Reply Last reply Reply Quote 1
                                    • CNCModellerundefined
                                      CNCModeller @dc42
                                      last edited by

                                      @dc42 said in Direction/Velocity Vector of Printhead movement:

                                      @deme if you are prepared to compile the firmware yourself, you could add the current direction vector to the object model. You would need to modify the code in file Move.cpp and perhaps also in DDA.h or DDA.cpp to add the direction vector from the DDA to the object model. The code that adds requestedSpeed and topSpeed from the DDA to the OM could serve as a guide.

                                      This is also interesting, thanks for the insights @dc42

                                      Polar Duet3 Mini + 1HCL
                                      https://youtube.com/playlist?list=PLWjZVEdMv1BY82izahK45qKh-hp3NFkix
                                      Wanhao D4S: Duet2
                                      https://forum.duet3d.com/post/296755
                                      K40 Laser, Duet2
                                      https://forum.duet3d.com/post/312082
                                      Wanhao D5S
                                      https://www.youtube.com/CNCModellerUK

                                      1 Reply Last reply Reply Quote 0
                                      • demeundefined
                                        deme @dc42
                                        last edited by

                                        @dc42 Thanks for the suggestion. A few other questions:

                                        • Is there a referance how often the OM can be pulled (in a sec) without losing performance?
                                        • Is there a way to force the RRF to parse an undefined axis and stream the values to OM? Or does that make absolutely no sense? For example to do something like that: G1 X10 Y10 U90 for LED Ring Position 90 deg relativ to the x axis.

                                        I have already read these posts here and am still not sure which approach to take:

                                        • https://forum.duet3d.com/topic/23659/stream-true-current-position/7?loggedin=true
                                        • https://forum.duet3d.com/topic/26378/polling-the-position-of-the-printer?_=1643369305548

                                        @CNCModeller: I think you mean something like this: https://www.mdpi.com/2504-4494/5/3/82?type=check_update&version=2

                                        E3D ToolChanger & Motion System with Duet3 Main Board and custom Tools

                                        CNCModellerundefined dc42undefined 2 Replies Last reply Reply Quote 0
                                        • CNCModellerundefined
                                          CNCModeller @deme
                                          last edited by

                                          @deme said in Direction/Velocity Vector of Printhead movement:

                                          @CNCModeller: I think you mean something like this: https://www.mdpi.com/2504-4494/5/3/82?type=check_update&version=2

                                          Exactly, just goes to show there is very little new under the sun...

                                          Polar Duet3 Mini + 1HCL
                                          https://youtube.com/playlist?list=PLWjZVEdMv1BY82izahK45qKh-hp3NFkix
                                          Wanhao D4S: Duet2
                                          https://forum.duet3d.com/post/296755
                                          K40 Laser, Duet2
                                          https://forum.duet3d.com/post/312082
                                          Wanhao D5S
                                          https://www.youtube.com/CNCModellerUK

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

                                            @deme said in Direction/Velocity Vector of Printhead movement:

                                            @dc42 Thanks for the suggestion. A few other questions:

                                            • Is there a referance how often the OM can be pulled (in a sec) without losing performance?

                                            I wouldn't advise polling the whole of the OM much faster than DWC does it, which is normally 4 times per second. Maybe 10 times per second wold be OK. However, you could poll just a part of the OM (e.g. the current move direction vector, if we added that to the OM) more often because the amount of data returned would be so much smaller.

                                            • Is there a way to force the RRF to parse an undefined axis and stream the values to OM? Or does that make absolutely no sense? For example to do something like that: G1 X10 Y10 U90 for LED Ring Position 90 deg relativ to the x axis.

                                            I can't think of a way to do that using the current firmware.

                                            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
                                            • First post
                                              Last post
                                            Unless otherwise noted, all forum content is licensed under CC-BY-SA