Print Head Location determination


#1

Hi,
I'm working on a college project in which I need to extract information about the print head's position. I am totally new to OctoPrint and I'm having trouble developing API's. The printer already displays the print head co-ordinates and all I need is to extract that information. How do I do that? I know there are plugins which help to move the print head but how do they extract the position of the print head?
BTW I'm using ANET A8 Printer which is a Prusa i3 Clone.

Thanks.


#2

I'm guessing that M114 is your friend here.

If it were me, I think I would review the plugins which are already available and try to figure out if one is similar: send a gcode and then interpret the response. Many do this, btw. Once you've found an existing plugin then review the open source code and see what it would take to do this for M114.