G-codes/offsets/tools with .Net

Moderators: TomKerekes, dynomotion

Moray
Posts: 191
Joined: Thu Apr 26, 2018 10:16 pm

Re: G-codes/offsets/tools with .Net

Post by Moray » Sun Dec 15, 2019 6:41 pm

Thanks for clarifying that Tom.
TomKerekes wrote:
Sun Dec 15, 2019 5:15 pm
It would probably be better to issue a warning.
I just realised I meant to add that I was testing in KMotionCNC, and it doesn't issue any kind of warning when you use duplicate tool IDs.

Moray
Posts: 191
Joined: Thu Apr 26, 2018 10:16 pm

Re: G-codes/offsets/tools with .Net

Post by Moray » Mon Dec 16, 2019 12:29 am

And I've just realised I don't need to generate a dedicated tool file.

However, if I use SetTool/GetTool functions, how do you delete a tool from the interpreter?

User avatar
TomKerekes
Posts: 947
Joined: Mon Dec 04, 2017 1:49 am

Re: G-codes/offsets/tools with .Net

Post by TomKerekes » Mon Dec 16, 2019 12:42 am

Hi Moray,

The Interpreter's ToolTable has a fixed length (128 entries). To remove a tool from the table use SetTool to set all of the fields to zero.
Regards,

Tom Kerekes
Dynomotion, Inc.

Moray
Posts: 191
Joined: Thu Apr 26, 2018 10:16 pm

Re: G-codes/offsets/tools with .Net

Post by Moray » Mon Dec 16, 2019 9:34 pm

Thanks for that.
I currently have a basic but working tool system, which I'll revisit later.

Anyway, my next challenge. Jogging.

I've looked at how KMotionCNC handles it, and it's a bit beyond my understanding of C++!
I see each jog button initialises it's own CMotionButton, but my understanding stops there. I see that jogging commands ultimately start a new thread to handle the jog, and there is lots of functionality in Motion.cpp to handle buttons, but I get lost trying to understand how the logic from a jog button press, through to the jog happening.


I've also looked at how the KFlopWebNC handles it, and it ultimately just ends up commanding an axis jog.

Now is there any reason why KMCNC uses such a complex method?
Or can I just rely on directly commanding jogs, while ensuring that it's actually safe to jog?
I.e. we're not in the middle of running some G-code.

User avatar
TomKerekes
Posts: 947
Joined: Mon Dec 04, 2017 1:49 am

Re: G-codes/offsets/tools with .Net

Post by TomKerekes » Mon Dec 16, 2019 11:43 pm

Hi Moray,
Now is there any reason why KMCNC uses such a complex method?
It becomes complicated when non-linear kinematics and/or geometric corrections are used. In those cases to Jog along a straight line requires Jogging multiple axes in a dynamically changing manner. We have been working on a newer method that better handles the varying acceleration times when multiple axes are involved which may or may not be even more complex. It's difficult as we want the Operator to be able to change directions and speed at random with quick response and unlike GCode the path is not predetermined.

HTH
Regards,

Tom Kerekes
Dynomotion, Inc.

Moray
Posts: 191
Joined: Thu Apr 26, 2018 10:16 pm

Re: G-codes/offsets/tools with .Net

Post by Moray » Mon Dec 16, 2019 11:53 pm

I suspected kinematics/geo correction might be the case.

I'm assuming using the basic Jog() call, ignores any kinematics/geo correction?

User avatar
TomKerekes
Posts: 947
Joined: Mon Dec 04, 2017 1:49 am

Re: G-codes/offsets/tools with .Net

Post by TomKerekes » Tue Dec 17, 2019 5:15 pm

I'm assuming using the basic Jog() call, ignores any kinematics/geo correction?
Correct.
Regards,

Tom Kerekes
Dynomotion, Inc.

Moray
Posts: 191
Joined: Thu Apr 26, 2018 10:16 pm

Re: G-codes/offsets/tools with .Net

Post by Moray » Tue Dec 17, 2019 9:57 pm

Thanks for that Tom.

I've managed to get a basic jog working for now, so I'll extend that to the other axis, then look at improving things later.

Moray
Posts: 191
Joined: Thu Apr 26, 2018 10:16 pm

Re: G-codes/offsets/tools with .Net

Post by Moray » Tue Dec 31, 2019 10:12 pm

I'm working on the DRO process, and have roughly been following the KMCNC code, but seem to have hit a snag.
TransformActuatorstoCAD isn't available in .net/C#

Am I correct in guessing that ConvertAbsoluteToInterpreterCoord and ConvertAbsoluteToMachine are the relevant .net methods?

If so, is there any specific requirement for getting the KM_Interpreter?
Or can I just add it to the same timer as where KM_Mainstatus gets updated?

Moray
Posts: 191
Joined: Thu Apr 26, 2018 10:16 pm

Re: G-codes/offsets/tools with .Net

Post by Moray » Tue Dec 31, 2019 10:45 pm

OK, scrap the ConvertAbsoluteTo functions, as I've done some digging and realised they work in solely in CAD space, not counts.

So is it possible to convert machine counts, to CAD while allowing for the Kinematics?

Post Reply