UI for HAL development

More
05 Jul 2021 18:18 - 27 Jul 2021 20:45 #213772 by mic
UI for HAL development was created by mic
Hi together,
in this Thread i want to show some work in progress and collect some ideas to deal with unsolved issues.
There are some current Threads about HAL visualisation like halviewer but for users wich are new to lcnc it´s not very easy to deal with HAL.
For that reason and for easy debugging a graphical representation of the complete HAL environment would be very nice.

Current Features:
  • Show HAL Component Instances
  • Connect Component Instances with Drag and Drop
  • Show all available HAL Components with description
  • Add Instances of  Components to HAL with Drag and Drop (multiple instances not supported)
  • Show HAL Values of Signals

Planned Features:
  • Generate and edit HAL Files

Now the Repo is available on Github: github.com/dev-git-usr/HAL-Editor
But pay attention - it´s only a proof of concept, it may crash your LCNC instance -> don´t use in production environment.

Ideas and feedback is also very welcome.
Attachments:
Last edit: 27 Jul 2021 20:45 by mic.
The following user(s) said Thank You: tommylight, Grotius, MX_Master, robertspark, ggsxx

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

More
05 Jul 2021 23:00 #213801 by andypugh
Replied by andypugh on topic UI for HAL development

Hi together,Most features can be done with halcmd but it´s not able to list all availble components. Does anyone know how to list all available Components with the Pins and Parameters of these Components without adding them to HAL?


I think that it is a difficult problem, as the HAL pins can be altered by load-time parameters. (And in the case of Mesa smart-serial devices the pin names are chosen by the daughter-card firmware, so are not even in the LinuxCNC database)

I am afraid that the only option I can think of is look in /usr/lib/linuxcnc/modules for the list.
Then consider parsing the manpage output to find the modparams.

For modules that are already loaded, it may be possible to interrogate files in /proc/ and /sys/ but having started a halrun session and loaded an and2 I was not able to find it anywhere. (bit maybe I looked incompetently)
The following user(s) said Thank You: mic

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

More
06 Jul 2021 19:21 #213885 by mic
Replied by mic on topic UI for HAL development
Thank you very much. I thought Ports are static things... so far so bad... But looking in /usr/lib/linuxcnc/modules is a good Idea. After some rethinking it´s ok to know the ports of a component after adding it to HAL.

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

More
11 Jul 2021 11:25 - 11 Jul 2021 11:28 #214244 by mic
Replied by mic on topic UI for HAL development
It´s going on in small steps as you can see in the Video:
www.dropbox.com/s/fid4uskzyyuoulf/HAL-Editor_small.mp4?dl=0

now it´s possible to view Manuals, add and remove Components to HAL an connect them by Signals...
At the moment i have some trouble adding multiple instances of a Component like "loadrt and2 count=3" - HAL does not support adding an instance if another instance of a component does already exist.

Question to some experienced HAL-Guys: Is there a possibility to deal with adding Components at Runtime?
Could I use a workaround like removing the Component and adding the needed count of Instances and connect the previous existing ones again or are there some pitfalls?

Thank you very much.
Last edit: 11 Jul 2021 11:28 by mic.

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

More
11 Jul 2021 11:29 #214246 by Aciera
Replied by Aciera on topic UI for HAL development
Do you know about 'twopass'?

linuxcnc.org/docs/html/hal/twopass.html

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

More
11 Jul 2021 11:33 #214247 by mic
Replied by mic on topic UI for HAL development
Yes, but as far as i can see twopass is processing HAL files and combines multiple commands to a single one before executing but i need to add components on runtime.

The Manual says:
With TWOPASS processing, all [HAL]HALFILES are first read and multiple appearances of loadrt directives for each module are accumulated. User components (loadusr) are loaded in order but no other hal commands are executed in the initial pass.

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

More
11 Jul 2021 12:18 - 11 Jul 2021 12:33 #214250 by Aciera
Replied by Aciera on topic UI for HAL development
As far as I know it is not possible to add components at runtime. There has been work on this in machinekit but, as far as I'm aware, none of it has been incorporated into linuxcnc.
But maybe Andy has more information on this.

I don't quite understand why you need to add the components at runtime. Why would you run the hal file and edit it at the same time? Would you not create/edit the hal file and then run it, just like when using a texteditor?

I guess it could be interesting to use your editor at runtime to monitor signals but for that there is no need to add components while monitoring.
Last edit: 11 Jul 2021 12:33 by Aciera.
The following user(s) said Thank You: mic

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

More
11 Jul 2021 15:17 #214271 by mic
Replied by mic on topic UI for HAL development

I don't quite understand why you need to add the components at runtime. Why would you run the hal file and edit it at the same time? Would you not create/edit the hal file and then run it, just like when using a texteditor?

Because I think thats the easiest way to build a drag and drop editor for HAL . As Andy said it´s possible that ports are altered by runtime parameters, so I have to simulate the complete HAL to build a proper "offline" editor. I thought it´s easier to go the other way round and send some commands to HAL like "add component xy", see what´s happened and view the result it in the editor.

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

More
11 Jul 2021 15:31 #214273 by Aciera
Replied by Aciera on topic UI for HAL development
Yes, but would it not be sufficient to run the hal file once, grab the pin list and then close it again?
The following user(s) said Thank You: mic

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

More
11 Jul 2021 22:20 #214332 by Grotius
Replied by Grotius on topic UI for HAL development
I think one way is to perform a "halcmd stop" then "halrun -U or a cleanup command" then reload hal file and then "halcmd start"
If you imagine the halpin's etc in a circulair buffer. This buffer must reserve memory before it can add pin's. Therefore
the hal has to be stopped.
In programming land, inserting value's into a existing array's (vectors) is in fact copying the whole array again with a new value with it.

One way to insert pin's at runtime is to copy the hal into another thread and switch back when the process of moderating is finished. I did not test this. It's just an idea.




 
The following user(s) said Thank You: mic

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

Time to create page: 0.083 seconds
Powered by Kunena Forum