at_PID

More
24 May 2012 16:25 #20340 by Fremder
at_PID was created by Fremder
Hi all ;-)

can everybody help me to "test" the

at_PID
linuxcnc.org/docs/html/man/man9/at_pid.9.html

i work for testing with the "servo_sim.hal"
and can't run / start axis ..

loadrt at_pid num_chan=2 / names=name1,name2

have any a little sample for me ;-)

bigThanks

ritsch

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

More
24 May 2012 17:14 #20343 by andypugh
Replied by andypugh on topic Re:at_PID
My understanding is that at_PID isn't terribly effective. However that probably means it needs more attention.

What is the problem you are having with it? What does the error dump say when you try to start Axis?

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

More
25 May 2012 05:50 - 25 May 2012 05:51 #20365 by Fremder
Replied by Fremder on topic Re:at_PID
Hi Andy,

i not sure ...
a) i can start without the Parameters etc.

... and not sure
b) i can use at_pid with the "servo_SIM.hal" ...

Starting HAL User Interface program: halui
Shutting down and cleaning up LinuxCNC...
Killing task linuxcncsvr, PID=2466
Removing HAL_LIB, RTAPI, and Real Time OS modules
Removing NML shared memory segments
Cleanup done

Debug file information:
Can not find -sec MOT -var MOT -num 1 ############## no IDEA why ;-)
Can not find -sec IO -var IO -num 1
Can not find -sec LINUXCNC -var NML_FILE -num 1
Can not find -sec EMC -var NML_FILE -num 1
insmod: error inserting '/usr/realtime-2.6.32-122-rtai/modules/linuxcnc/at_pid.ko': -1 Operation not permitted
custSampler.hal:31: exit value: 1
custSampler.hal:31: insmod failed, returned -1
See the output of 'dmesg' for more information.
2466
==============
in the dmesg i see
[ 825.708581] HAL: ERROR: duplicate variable 'pid.0.enable'
...
i have "beginer-problems": )

1) loadrt at_pid # without num and names its ok ... standard its 3
2) must do this ?
addf at_pid servo-thread or any ?
3) must set the parameters BEVOR start
4) its ok this "hals" write in the custSampler.hal ?
:(
===================
Last edit: 25 May 2012 05:51 by Fremder.

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

More
25 May 2012 09:15 #20377 by andypugh
Replied by andypugh on topic Re:at_PID
Fremder wrote:

[ 825.708581] HAL: ERROR: duplicate variable 'pid.0.enable'

4) its ok this "hals" write in the custSampler.hal ?


The problem seems to be that the custom.hal is trying to re-do things from the first HAL file.

It's probably easier in this case to edit the sim-servo HAL file in your configs directory directly, rather than try to use the custom.hal.

(You can always get the unedited version back from wherever LinuxCNC keeps the sample configs)

As a first step, clear out the custom.hal, and replace "pid" with "at_pid" in the main HAL file. (and be aware that you are going to have to read the error messages to see what the problems are)

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

More
25 May 2012 10:14 - 25 May 2012 10:21 #20379 by Fremder
Replied by Fremder on topic Re:at_PID
... replace pid to at_pid
============
Print file information:
RUN_IN_PLACE=no
LINUXCNC_DIR=
LINUXCNC_BIN_DIR=/usr/bin
LINUXCNC_TCL_DIR=/usr/lib/tcltk/linuxcnc
LINUXCNC_SCRIPT_DIR=
LINUXCNC_RTLIB_DIR=/usr/realtime-2.6.32-122-rtai/modules/linuxcnc
LINUXCNC_CONFIG_DIR=
LINUXCNC_LANG_DIR=/usr/share/linuxcnc/tcl/msgs
INIVAR=inivar
HALCMD=halcmd
LINUXCNC_EMCSH=/usr/bin/wish8.5
LINUXCNC - 2.5.0
Machine configuration directory is '/home/rb1/linuxcnc/configs/axisTim'
Machine configuration file is 'axis_mm.ini'
INIFILE=/home/rb1/linuxcnc/configs/axisTim/axis_mm.ini
PARAMETER_FILE=sim_mm.var
TASK=milltask
HALUI=halui
DISPLAY=axis
Starting LinuxCNC...
Starting LinuxCNC server program: linuxcncsvr
Loading Real Time OS, RTAPI, and HAL_LIB modules
Starting LinuxCNC IO program: io
Starting HAL User Interface program: halui
Shutting down and cleaning up LinuxCNC...
Killing task linuxcncsvr, PID=4751
Removing HAL_LIB, RTAPI, and Real Time OS modules
Removing NML shared memory segments
Cleanup done

Debug file information:
Can not find -sec MOT -var MOT -num 1
Can not find -sec IO -var IO -num 1
Can not find -sec LINUXCNC -var NML_FILE -num 1
Can not find -sec EMC -var NML_FILE -num 1
HAL: ERROR: function 'at_pid.0.do-pid-calcs' not found
servo_sim.hal:44: addf failed
4751
PID TTY STAT TIME COMMAND
Stopping realtime threads
Unloading hal components

Kernel message information:
[16422.383974] I-pipe: Domain RTAI registered.
[16422.383978] RTAI[hal]: <3.8.1> mounted over IPIPE-NOTHREADS 2.6-03.
[16422.383979] RTAI[hal]: compiled with gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5) .
[16422.384063] RTAI[hal]: mounted (IPIPE-NOTHREADS, IMMEDIATE (INTERNAL IRQs DISPATCHED), ISOL_CPUS_MASK: 0).
[16422.384065] PIPELINE layers:
[16422.384067] fb437e20 9ac15d93 RTAI 200
[16422.384068] c085cb20 0 Linux 100
[16422.396185] RTAI[malloc]: global heap size = 2097152 bytes, <BSD>.
[16422.396391] RTAI[sched]: IMMEDIATE, MP, USER/KERNEL SPACE: <with RTAI OWN KTASKs>, kstacks pool size = 524288 bytes.
[16422.396394] RTAI[sched]: hard timer type/freq = APIC/8327399(Hz); default timing: periodic; linear timed lists.
[16422.396396] RTAI[sched]: Linux timer freq = 250 (Hz), TimeBase freq = 2797570000 hz.
[16422.396398] RTAI[sched]: timer setup = 999 ns, resched latency = 2943 ns.
[16422.396433] RTAI[usi]: enabled.
[16422.409482] RTAI[math]: loaded.
[16422.667551] RTAI[math]: unloaded.
[16422.673110] SCHED releases registered named ALIEN RTGLBH
[16422.797772] RTAI[malloc]: unloaded.
[16422.897643] RTAI[sched]: unloaded (forced hard/soft/hard transitions: traps 0, syscalls 0).
[16422.898857] I-pipe: Domain RTAI unregistered.
[16422.898949] RTAI[hal]: unmounted.

============================
... i "write" the last 8 weeks my self.PIDtuning ;-) ... but its not finish and i see yesterday the at_pid and
look for there functions and ideas etc.....

when the way to run at_pid its toooooo loooooong then i have no time for this BUT
a little ask to

python-hal:
h = hal.commponet("test","rb") # ok
h.newpin... # ok
h.ready # ok
BUT what i must do for LINK pins to linuxcnc maybe to existings pins (PID.Pgain etc.)

_py = xPid("Y")
_py.P =float(commands.getoutput("halcmd getp pid.1.Pgain"))
_py.I =float(commands.getoutput("halcmd getp pid.1.Igain"))
_py.D =float(commands.getoutput("halcmd getp pid.1.Dgain"))
_py.F1 =float(commands.getoutput("halcmd getp pid.1.FF1"))
_py.F2 =float(commands.getoutput("halcmd getp pid.1.FF2"))
mypids.pidY = _py

can you say me a other way to ASK the pins where i make it not in python with newpin ?
i test the
c = linuxcnc.command()
but have no intellisense for find the Parameters or any *cry*

sorry .... i work allways with intellisense but here i must word 99% for found the dokumentation and 1 for programming :(

verry much i write ... give me a smal return ;-)
Last edit: 25 May 2012 10:21 by Fremder.

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

More
25 May 2012 10:23 #20380 by andypugh
Replied by andypugh on topic Re:at_PID
Fremder wrote:

HAL: ERROR: function 'at_pid.0.do-pid-calcs' not found
servo_sim.hal:44: addf failed


This is the problem.
www.linuxcnc.org/docview/html/man/man9/at_pid.9.html
All the pins and functions are still called "pid.N.,,,"
It looks like all you really needed to change was the loadrt line. Sorry.

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

More
25 May 2012 10:29 #20381 by andypugh
Replied by andypugh on topic Re:at_PID
Fremder wrote:

... i "write" the last 8 weeks my self.PIDtuning ;-) .
python-hal:
h = hal.commponet("test","rb") # ok
h.newpin... # ok
h.ready # ok
BUT what i must do for LINK pins to linuxcnc maybe to existings pins (PID.Pgain etc.)

Are you trying to write a Python module to auto-tune the PID, or to write an auto-tuning PID in Python?
Realtime components like PID need to be written in C or "comp" (which is a special HAL preprocessor).

I assume you spotted that "component" is not spelt "commponet" ?

can you say me a other way to ASK the pins where i make it not in python with newpin ?
i test the
c = linuxcnc.command()
but have no intellisense for find the Parameters or any *cry*

Sorry, can you re-phrase the question, I am not entirely sure what you are asking.
[/quote]

One thing I have found useful when HAL editing is to put "show all" in my HAL file straight after all the "loadrt lines". That dumps all the pins, parameters and functions to stdout. You can then copy that into a text file and open that in your editor, and then (with some editors) you get auto-completion.
This helps, a bit.

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

More
25 May 2012 10:31 #20382 by Fremder
Replied by Fremder on topic Re:at_PID
oh ... yes ... its going
only the loadrt at_pid

without this:
# connect encoder index-enables for homing on index
net Xindex-enable encoder.0.index-enable <=> axis.0.index-enable #pid.0.index-enable here come a new error ... i have disable now
net Yindex-enable encoder.1.index-enable <=> axis.1.index-enable
net Zindex-enable encoder.2.index-enable <=> axis.2.index-enable

thanks now i can looooook wat i can do *g*

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

More
25 May 2012 12:28 #20387 by Fremder
Replied by Fremder on topic Re:at_PID
my problem is read in python the PINS

when i import (in python) the hal

i can make good NEW pins
but what i can do to READ the existings-other pins ?

its only the way over "os.system" or commands.getoutput("halcmd getp pid.0.Pgain"))

to read the pins ?

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

More
25 May 2012 12:38 #20388 by andypugh
Replied by andypugh on topic Re:at_PID
Fremder wrote:

can make good NEW pins
but what i can do to READ the existings-other pins ?


If you want your module to read values from other HAL modules, then you need to make input pins in your module, and net them to the other module pins in HAL.

All communication between HAL modules is through HAL pins.

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

Time to create page: 0.153 seconds
Powered by Kunena Forum