Hal Standalone and a Java gui

  • tommylight
  • Away
  • Moderator
  • Moderator
More
7 years 2 months ago #143466 by tommylight
Replied by tommylight on topic Hal Standalone and a Java gui
@Reinhard
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.

More
7 years 2 months ago - 7 years 2 months ago #143477 by dab77
Replied by dab77 on topic Hal Standalone and a Java gui
I've done some software in java, and i've created my own gui library with all the standard widgets and some special one (once you start..), and i.e. one thing I needed was the ability to change the opacity of the widgets, because I had a video stream as a background and the buttons and texts over. Other than this It was very simple to draw over the video stream in 3D, mixing on the same window 3D and 2D widgets..
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.
Last edit: 7 years 2 months ago by dab77.

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

More
7 years 2 months ago #143478 by andypugh
Replied by andypugh on topic Hal Standalone and a Java gui
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
Replied by andypugh on topic Hal Standalone and a Java gui
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
Replied by Reinhard on topic Hal Standalone and a Java gui
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.

Time to create page: 0.352 seconds
Powered by Kunena Forum