BEST way to query TinyG for CURRENT X,Y,Z position?

Home Forums TinyG TinyG Support BEST way to query TinyG for CURRENT X,Y,Z position?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #4863
    nexea
    Member

    I am interfacing with the TinyG controller and want to know the BEST way to get JUST the X,Y,Z coordinates that it currently thinks it is at, right now.

    I think the answer involves querying a block, but I was hoping to get an answer from someone smarter than I.

    I want to retrieve the result in JSON format.

    I do not want to wait for the status response, I need to explicitly and on-demand call for it.

    I have been looking at but would like a straightforward answer for confirmation.

    Thanks!

    #4878
    alden
    Member

    There are a number of ways to do this. Perhaps the best way is by setting up a status report and requesting for it when you want it. It will be returned immediately if it’s a request {“sr”:null}, and all fields in the status report will always be returned (i.e. requests are not filtered). You can either leave auto-generated status reports on, or turn them off {“sv”:0″}

    You can set status to report in external units and in the work coordinate system by using the posX variables. This is useful for a DRO style display. Example:
    {“sr”:{“line”:true,”posx”:true,”posy”:true,”posz”:true,”vel”:true,”stat”:true}}

    Alternately, if you are going to be using the status reports for drawing on a screen you might want internal machine format – always in MM and always relative to the homed position. The offsets and units are useful if you want both a drawing and a DRO, as you can use the current offsets and the units to compute the values that show in the DRO. ‘t’ is a shorthand for true. Example:
    {“sr”:{“line”:t,”mpox”:t,”mpoy”:t,”mpoz”:t,”ofsx”:t,”ofsy”:t,”ofsz”:t,”vel”:t, “unit”:t,”stat”:t}}

    See the status reports page for details:
    https://github.com/synthetos/TinyG/wiki/Status-Reports

    You can also just ask for the values you want:
    {“posx”:null}
    {“posy”:null}
    {“posz”:null}

    Or ask for the pos (or mpo) group. You will get all 6 axes:
    {“pos”:null}

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.