You can control with the python interface.
http://linuxcnc.org/docs/2.7/html/config/python-interface.html
some examples
http://gnipsel.com/linuxcnc/gui/index.html

JT


On 9/20/2016 6:05 AM, Florian Rist wrote:
> Hi,
> 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
> Florian
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Emc-users mailing list
> Emc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/emc-users


------------------------------------------------------------------------------
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to