Hal Standalone and a Java gui

More
7 years 2 months ago #143478 by andypugh
I am not pushing Python on you because I object to Java, or because I am a fan of Python. It is just that LinuxCNC already has a lot of interfaces for Python. You can even re-write G-codes in Python. I don't think it is as easy to do this with Java.

If you create a Python program that includes "import hal" then you can create HAL pins in shared memory and link those to the motor positions. Then setting a new position is just a case of giving the variable a new value, rather than the rather clunky approach of creating "halcmd ..... " strings and passing them to the shell.

linuxcnc.org/docs/2.8/html/hal/halmodule.html

Has some simple examples.

Please Log in or Create an account to join the conversation.

More
7 years 2 months ago #143479 by andypugh
Note that linuxcnc.org/docs/2.8/html/config/python-interface.html
Won't work in a standalone HAL session, as far as I know.

Please Log in or Create an account to join the conversation.

More
7 years 2 months ago #143482 by dab77
Replied by dab77 on topic Hal Standalone and a Java gui


I very like the idea of java working together with hal services. Java offers the most freedom on UI and has a very clean event system.

But using Runtime.exec is the worst possibility for IPC.
Don't know enuf about NML, but I guess its based on shared memory. To use that, java needs a little help of C - just like Python does too. JNI is the right javatask for that.

one thing i've looked at is JNI , but then i couldn't find enough info on how to 'speak' to hal, or use NML. ..so i left that road..
if you know how, i'm still interested in this road.

Please Log in or Create an account to join the conversation.

More
7 years 2 months ago #143581 by Reinhard
Take a look at "src/emc/usr_intf/axis/extensions/emcmodule.cc" and there at emcSendCommand and emcWaitCommandComplete ...
Another directory, you should dig into is src/libnml ...

I guess, these both emc-functions is all you need to code in JNI - all other stuff could be coded in pure Java :)

Cheers Reinhard

Please Log in or Create an account to join the conversation.

More
7 years 2 months ago #143644 by dab77
Replied by dab77 on topic Hal Standalone and a Java gui
thanks for addressing me.
i'll look into that in the next days.

Please Log in or Create an account to join the conversation.

More
7 years 1 month ago #144187 by Reinhard
Hi,

i have very little spare time actually, so it took a while.
But I succeeded in creating a java prototype that is able to print position - pretty easy :)

I started an axis linuxcnc and started the demo. Then I paused the execution and started the java app, which just printed the position. Then I compared the shown values. Looks good.
So I guess, I can implement the NML-layer for java apps :)

Cheers Reinhard

Please Log in or Create an account to join the conversation.

Time to create page: 0.065 seconds
Powered by Kunena Forum