Hal Standalone and a Java gui
- tommylight
- Away
- Moderator
- Posts: 19219
- Thank you received: 6440
Thank you, you are right, i do not know it although i can mess with it easily and i am fully aware it can do some things that would need many hoops to be jumped when done with anything else. It just uses to much for litle things, like "onmouseover" and similar, and to much of a security risc. But these days everything has become a security risc.
Python does a lot of things easily, but the version changes and the new additions are causing people agravation.
Same goes for all other programing languages/scripting languages, all have good things and not so good things.
Regards,
Tom.
Please Log in or Create an account to join the conversation.
It turned out a very useful and modern look software, and it took me little time to program.
Of course there are a lot of guis out there which are ready to be used, and wx and qt are ready with Hal widgets, but I cannot do those exotic things..
I'm sure many things i wrote are not optimized and can be slow, but when I try to replicate some of the things i need in python i get stuck with stupid things..
for example: which is the right library to draw a rectangle and then how to generate an event on mouse click inside that? it should be trivial, but it's hard!
In the meantime, while studying python, I'm digging into the kivy gui library, which seems fast, easy and modern too.
Please Log in or Create an account to join the conversation.
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.
Won't work in a standalone HAL session, as far as I know.
Please Log in or Create an account to join the conversation.
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..
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.
if you know how, i'm still interested in this road.
Please Log in or Create an account to join the conversation.
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.
i'll look into that in the next days.
Please Log in or Create an account to join the conversation.
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.
Attachments:
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.