Home › Forums › TinyG › TinyG Support › g2core line mode / protocol question
Tagged: g2core TinyG2 line protocol gui
- This topic has 8 replies, 2 voices, and was last updated 7 years, 3 months ago by cmcgrath5035.
-
AuthorPosts
-
July 24, 2017 at 11:02 am #10469talpaMember
Hi
I’m having no luck finding an existing application that just works for me for sending G-Code to an Arduino Due running g2core hocked up to a 3040 CNC.
(I’m running an “edge” based firmware on the Due)I have tried
https://goko.fr/
https://winder.github.io/ugs_website/
https://github.com/synthetos/node-g2core-apiAt least on my laptop running Debian unstable the programs goko and ugs have a hard time simply connecting to g2core, I have been unable to run node-g2core-api due to what seems to be a sort of version issue with nodejs.
Also I need the CNC to be running offline so ChiliPeppr is more or less out of the question.
Anyway when connecting to the g2core using minicom (a serial terminal) I can move the CNC around without problems.
I therefor thought that I could simply write a small python script to send g-code to to the g2core. I could then later on perhaps expand it into a small GUI using wxpython.I have written a script and it sort of works.
The way I understand:
https://github.com/synthetos/g2/wiki/g2core-Communications#linemode-protocolis that I need to keep track of the acknowledge {‘r’ responds that should match the number of lines/requests the script sends
(that should generate such responds.)
Additionally I’m apparently allowed to have up to 4 outstanding requests that have yet to be acknowledged before I should sending more lines.However when I send a “large” g-code file the g2core keeps quickly sending me {‘r’ responds for each line the script sends.
The script there for keeps sending lines to the g2core… and everyone is happy until the communication fails due to:
{“er”:{“fb”:100.26,”st”:28,”msg”:”Failed to get planner buffer – mp_get_write_buffer()”}}
{“er”:{“fb”:100.26,”st”:36,”msg”:”Failed to get planner buffer – aline()”}}Even when I reduce the “sliding window size” to 1 reducing the protocol to:
Send a line, wait for a {‘r’ before sending another
The g2core still keeps on requesting data until it fails.The following is some output from the script leading up to the error while sending a dummy file:
<- {“r”:{},”f”:[1,0,17]}
-> {“gc”:”G1 X0″}
<- {“r”:{},”f”:[1,0,16]}
<- {“sr”:{“posx”:9.898,”vel”:198.33}}
-> {“gc”:”G1 X10″}
<- {“r”:{},”f”:[1,0,17]}
-> {“gc”:”G1 X0″}
<- {“r”:{},”f”:[1,0,16]}
-> {“gc”:”G1 X10″}
<- {“r”:{},”f”:[1,0,17]}
<- {“sr”:{“posx”:8.129,”vel”:1000}}
-> {“gc”:”G1 X0″}
<- {“r”:{},”f”:[1,0,16]}
-> {“gc”:”G1 X10″}
<- {“r”:{},”f”:[1,0,17]}
<- {“sr”:{“posx”:3.99}}
-> {“gc”:”G1 X0″}
<- {“er”:{“fb”:100.26,”st”:28,”msg”:”Failed to get planner buffer – mp_get_write_buffer()”}}
<- {“er”:{“fb”:100.26,”st”:36,”msg”:”Failed to get planner buffer – aline()”}}
<- {“r”:{},”f”:[1,36,16]}
-> {“gc”:”G1 X10″}
<- {“r”:{},”f”:[1,206,17]}I must be overlooking something, but what?
Does the line mode described in the wiki not work with the g2core code in brand “edge”?
Have I misunderstood the protocol in regard to how the g2core is suppoed to halt the transmission of more data?Any help would be appreciated.
Kind regards Visti Andresen
July 24, 2017 at 11:41 am #10473cmcgrath5035ModeratorCan I assume you have looked at items over at
that might relate here?
You will likely get more help by logging this as an Issue – there is not a lot of experience with line mode as yet, so getting developers attention will help.July 24, 2017 at 11:58 am #10475talpaMemberYes but I haven’t found anything that matches my issue.
I will try to log an issue (and upload my script code to github for easier replication)
However I still assume it is a bug on my part as preventing overflow on the receiving g2core is a critical and probably well tested functionality as it is required for sending “large” files.
Btw. I have also tested branch “master” with my script with the same result.
July 24, 2017 at 12:56 pm #10476talpaMemberIn case anyone is interested I have uploaded the code to:
https://github.com/talpadk/g2coreguiNext task logging an issue at the github page for g2core
July 24, 2017 at 1:59 pm #10477cmcgrath5035ModeratorI did not pull down your code.
Any chance the code is (improperly) seeing incoming {sr…. responses as {r… responses and incrementing ?
Just a wild guess……
July 25, 2017 at 4:41 am #10481talpaMemberQuite all right I only just finished cleaning up the code and filling an issue on github.
https://github.com/synthetos/g2/issues/287
Unfortunately it does not seem to be as simple as ‘sr’ being seen as containing ‘r’.
I actually considered that some time ago…So I would call is a good wild guess 🙂
July 25, 2017 at 5:36 am #10482talpaMemberI’m 99% sure it is caused by a bug in g2core’s handling of {‘gc’ where it mistakes them for control lines.
Sending the g-code without json wrapping works just fine 🙂July 25, 2017 at 8:52 am #10484cmcgrath5035ModeratorInteresting, good find. I’ll keep an eye on Issue 287
July 29, 2017 at 10:29 am #10496cmcgrath5035ModeratorI just added some comments to your Issue 1 at node-g2core-api.
Seems node8.js is needed.
I did not try to send a gcode file
- This reply was modified 7 years, 3 months ago by cmcgrath5035.
- This reply was modified 7 years, 3 months ago by cmcgrath5035.
-
AuthorPosts
- You must be logged in to reply to this topic.