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

    Get current position in real-time

    Scheduled Pinned Locked Moved
    General Discussion
    5
    5
    352
    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.
    • jmlundefined
      jml
      last edited by

      In Marlin firmware, I could get the current position of an extruder with this function:
      y = float(st_get_position(Y_AXIS)/axis_steps_per_unit[Y_AXIS]) ;

      Is there the same thing in Duet firmware? I would like it to get the current position even if it is in the middle of a straight move. For example, If it is as X0, and it is traveling to X100, then when it triggers a sensor, I would like to know the current position of each time it is triggered during that move.

      o_lampeundefined jay_s_ukundefined OwenDundefined dc42undefined 4 Replies Last reply Reply Quote 0
      • o_lampeundefined
        o_lampe @jml
        last edited by

        @jml I guess you could poll the stepper counts from the object model, but the response time would vary, so there is a big uncertanty.
        All you'd know then is "the axis is at least at position nnnnn"
        If there was a timestamp telling when exactly the current move started, you could calculate the position from knowing the (static) jerk, accel and requested speed numbers.
        But some moves are so short, IDK if that would be a good solution.

        1 Reply Last reply Reply Quote 0
        • jay_s_ukundefined
          jay_s_uk @jml
          last edited by

          @jml I believe it's been added to the object model in one of the 3.5 betas

          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
          • OwenDundefined
            OwenD @jml
            last edited by

            @jml
            You could read move.axes[].machinePosition inside your trigger.
            I'm not sure if there would be any lag between when the trigger event occurred and the object model reading was taken.

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

              @jml the previous two replies have got it right between them. IN RRF 3.5 the machine position in the object model is updated every 200ms during moves.

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