> On 28 Feb 2019, at 07:19, [email protected] wrote:
> 
> Hey Bas, really appreciate your help with this.
> I've looked for man pages on scarakins and hal_gpio and neither seem to have 
> one yet. I suppose because they are still new in the project.

Hi Bradley,
These files are nothing but new. Scarakins if from around 2003, and hal_gpio 
from around 2012. (which dates are in the source files :) )

> So I looked at the .c source files on github to try and find out how they 
> work. Looking at scarakins.c the comments between line 40 and 74 seem to be 
> the important information, while for hal_gpio.c the relevant information 
> about which pins are available is in lines 59 and 60.
> As how to call them for machinekit, the variables that are to be used are 
> created in the .ini file, while any of the variables that will be connected 
> to physical pins will be declared in a .hal file.
> Does this sound like I'm starting to understand things?

Machinekit’s best feature, the HAL, is the realtime environment where you 
create the logic. This you do by “configuring", as opposed to “coding”. You 
load these software pieces and have a function executed. That’s where the 
thread is for, it executes functions you added to that thread, one by one. See 
it as a chain, where each function is a link.

So in theory you can start from an empty HAL, and (un)load pieces in realtime, 
step by step, adding threads, components/instances and signals as you like.
When you load a .hal file, the lines are executed as you would do it manually 
in an empty HAL, thus creating the configuration for you.

The INI files are just configuration data. Meaning that hal/ini files have 
nothing of variables etc.
so for example, sim.ini contains this line: 
https://github.com/machinekit/machinekit/blob/master/configs/sim/axis/axis.ini#L104
 
<https://github.com/machinekit/machinekit/blob/master/configs/sim/axis/axis.ini#L104>
 which tells that it will load core_sim.hal which is found here 
https://github.com/machinekit/machinekit/blob/master/configs/common/core_sim.hal
 
<https://github.com/machinekit/machinekit/blob/master/configs/common/core_sim.hal>

if you look at this line: 
https://github.com/machinekit/machinekit/blob/master/configs/common/core_sim.hal#L9
 
<https://github.com/machinekit/machinekit/blob/master/configs/common/core_sim.hal#L9>
`loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD 
servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES kins=trivkins 
tp=tp`
would have been exactly the same as this:
`loadrt motmot base_period_nsec=0 servo_period_nsec=1000000 num_joints=3 
kins=trivkins tp=tp`
which you could have loaded manually
loading the values from the ini file:
https://github.com/machinekit/machinekit/blob/master/configs/sim/axis/axis.ini#L80-L93
 
<https://github.com/machinekit/machinekit/blob/master/configs/sim/axis/axis.ini#L80-L93>
https://github.com/machinekit/machinekit/blob/master/configs/sim/axis/axis.ini#L123
 
<https://github.com/machinekit/machinekit/blob/master/configs/sim/axis/axis.ini#L123>

To get a bit of an understanding what’s happening in HAL (a mini HAL primer), 
try the following:
open a new terminal and open an interactive HAL session by typing
export DEBUG=5
halrun -I
have a look at an example session I recorded for you
https://asciinema.org/a/230495

-- 
website: http://www.machinekit.io blog: http://blog.machinekit.io github: 
https://github.com/machinekit
--- 
You received this message because you are subscribed to the Google Groups 
"Machinekit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at https://groups.google.com/group/machinekit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to