Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] m command for get parser state #37

Closed
holla2040 opened this issue May 14, 2018 · 9 comments
Closed

[feature] m command for get parser state #37

holla2040 opened this issue May 14, 2018 · 9 comments

Comments

@holla2040
Copy link

m114 calls mprint_current_position

grbl has a 'parser state' command "$G", see https://github.com/gnea/grbl/wiki/Grbl-v1.1-Commands
which displays the parser modes, G0/G1, G90/G91, G20/G21 etc.

Having the parser state query-able enables GUIs to be restarted during GUI development. Upon reset, the GUI can query parser state and display modes of the running machine. Otherwise the GUI has a set machine's state to know values which are persisted across GUI reboots.

@holla2040 holla2040 changed the title feature request - m command for get parser state [feature] m command for get parser state May 14, 2018
@hzeller
Copy link
Owner

hzeller commented May 14, 2018 via email

@holla2040
Copy link
Author

Sorry for being a newbie here, didn't know yet about direct variable querying. I'll learn about this tonight.
Your M117 command with variable expansion will work fine as long as the machine modals have a variable representation. For example, is there a variable for modal_g0_g1_? I'm sure there is, I just need to figure out which one it is. Thanks for the comment.

@hzeller
Copy link
Owner

hzeller commented May 14, 2018 via email

@holla2040
Copy link
Author

Hartley,
Thanks for the fast reply and for the great info!
Craig
ps. personally I'd like to see the format be json, so my python and js code can easily parse (1 line of code). But that introduces a funky cross pollination of formatting. Any format that easily splits will be easy for python to parse.

@hzeller
Copy link
Owner

hzeller commented May 15, 2018

So here is another thought: I recently added a 'status server' which allows to query basic machine parameters, but at this point it is not at all specified what we want in this service (unforttunately, this is not on the mailing list, I was mailing this directly to some developers).

Right now, you can set --status-server=<port> when running machine control. It listens on a socket and on a single-letter query 'p' prints out the current position as JSON.

Typical interaction:

p
{"x_axis":100.000, "y_axis":122.000, "z_axis":0.000, "note":"experimental"}

Right now, this is totally experimental as a proof of concept, but we should come up with a list of things that we can do with this status server, which is essentially a side-channel to the regular GCode stream.

  • Query options: dump positions and variables, somewhat related to this issue. In case of a 3D printer, would also output the temperatures etc.
  • Limited capability to modify the current machine that does not mess with positioning, e.g. changing speed factors or acceleration parameters.
  • Issuing pause and emergency stops
  • Act as an input channel for other machine pauses (e.g. tool change etc.)

I should probably open a separate issue for this to discuss.

@hzeller
Copy link
Owner

hzeller commented May 15, 2018

I've opened #38 to discuss status server stuff.

@holla2040
Copy link
Author

what? my json dreams are already in the works? you are the man! Will check it out a little later.

@holla2040
Copy link
Author

have you looked at serial-port-json-server
https://github.com/chilipeppr/serial-port-json-server
webserver with websocket promotion. It the way chilipeppr, http://chilipeppr.com/, connects browser based guis to localhosted grbl arduinos. Basically a http, websocket serial port bridge. Super simple.

ideas there may be useful for your vision of connecting your side channel to other pieces.

@holla2040
Copy link
Author

Moved discussion to #38

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants