Component Execution Order

More
15 Mar 2017 19:49 #89684 by islander261
Hello

Sorry if this has been covered many times before, I couldn't find a complete explanation.

It is my understanding from reading other threads is that the order HAL components are executed is the same order they are called in the HAL file(s). So my questions are:

Is this the order the component is loaded with the loadrt command or when the component is instantiated with the addf command?

When a configuration has multiple HAL files (my extra tabs in GMOCCAPY) or other files called out in the base .INI file what order are the HAL files components executed? To expand on this what effect does this have on signal and pin visibility across multiple HAL files?

Is it bad form to use components such that order of execution may matter?

TIA

John

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

More
15 Mar 2017 22:18 #89694 by PCW
Replied by PCW on topic Component Execution Order
Real time component functions are executed in the addf order
and order is critical for some functions.

Not sure about additional hal file section order but I dont think its common to
have real time functions in extension hal file sections

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

More
16 Mar 2017 18:59 #89766 by andypugh
Replied by andypugh on topic Component Execution Order

Is this the order the component is loaded with the loadrt command or when the component is instantiated with the addf command?


They are executed in "add" order.

If you are using multiple HAL files and this is a problem, then the "addf" command can take an optional numerical argument to specify the place in the execution list.

This does not seem to be documented anywhere, except the halcmd built-in help.:

halrun
help addf
The following user(s) said Thank You: rotwang

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

More
02 Apr 2017 00:35 #90745 by rodw
Replied by rodw on topic Component Execution Order
I noticed that Dewey Garrett has set the order of some components in his external offset example as follows:
# order so offset computation precedes motion-* threads
addf summer   servo-thread 1
addf zo       servo-thread 2

See
github.com/LinuxCNC/linuxcnc/blob/dgarr/...nal_offsets/hpid.hal

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

More
27 Apr 2017 14:29 #92216 by rotwang
Replied by rotwang on topic Component Execution Order
Very interesting, with a little trial and error I found that adding -2 to my lcd and matrix_kb lines like so:-
addf lcd servo-thread -2
addf matrix_kb servo-thread -2
stacks them neatly in order of occurence just before the hm2-write at the end of the servo-thread list.

Looks to be useful.
Roger

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

Time to create page: 0.132 seconds
Powered by Kunena Forum