I'm trying to control an axis position using an user space Python 
script, but I don't relay understand the Python hal library.

So, I want to use Python to periodically set the command position of an 
axis (3 in my case) based on a sensor read out.

To do so I disconnected axis.3.motor-pos-cmd from emcmot.03.pos-cmd by 
removing these lines from my .hal file:

   net emcmot.03.pos-cmd  <= axis.3.motor-pos-cmd
   net motor.03.pos-fb <= hpg.stepgen.03.position-fb

I kept these:

   net emcmot.03.pos-cmd => hpg.stepgen.03.position-cmd
   net motor.03.pos-fb => axis.3.motor-pos-fb

Now I manged to set emcmot.03.pos-cmd by calling halcmd from Python:

   msg = Popen('halcmd sets  emcmot.03.pos-cmd  {:f} '.format(newpos),
         shell=True, stdout=PIPE).stdout.read()

This works as expected and changes the command position, the axis starts 
to move to the new position.

Now I'd like to do the same using the Python HAL interface and get rid 
of the shell command.

I can create a new HAL component and a new pin but how can I access the 
existing signal? Any idea where I night be able to find an example?

See you

Emc-users mailing list

Reply via email to