Install PID module for LinuxCNC

More
14 Nov 2017 16:21 #101788 by Antonio B.
Antonio B. created the topic: Install PID module for LinuxCNC
Hi guys,
In my hal file I'm trying to load a PID module with directive in order to configure an optical line (stripe) on my machine :

loadrt pid num_chan=1

but when I run the linuxcnc it fails with the error:

error could not insert module pid.ko invalid parameters loadrt pid num_chan=1

I tried to run comp command but I obtain command not found

How can I fix it?

Thanks a lot in advance for your support.

Antonio
More
14 Nov 2017 17:21 #101793 by Todd Zuercher
Todd Zuercher replied the topic: Install PID module for LinuxCNC
Do you already have PIDs loaded in your hal file?

You can not loadrt the same hal component on more than one line.
More
14 Nov 2017 17:24 #101794 by Antonio B.
Antonio B. replied the topic: Install PID module for LinuxCNC
Can you provide more details please?
How can I need to load PIDs in my hal file?

Regards,
Antonio
More
14 Nov 2017 17:29 - 14 Nov 2017 17:32 #101795 by Todd Zuercher
Todd Zuercher replied the topic: Install PID module for LinuxCNC
Could you post a copy of your hal file?

For example if your config already has 3 pid loops for controlling your axis and you want to add a 4th one.
Change the line:
loadrt pid num_chan=3
to
loadrt pid num_chan=4

It will not work to have two lines (even it they are in different hal files.)
loadrt pid num_chan=3
loadrt pid num_chan=1
Last Edit: 14 Nov 2017 17:32 by Todd Zuercher.
More
14 Nov 2017 18:21 #101796 by Antonio B.
Antonio B. replied the topic: Install PID module for LinuxCNC
this is my file content
I havent a duplicated loadrt directive for pid

######## FEEDBACK ASSI #############

#loadrt encoder num_chan = 3 # DA AGGIUNDERE AL NUMERO TOTALE DI ENCODER NEL FILE HAL PRINCIPALE

loadrt pid num_chan = 3 # numero totali pid

##### REALTIME####

#addf encoder.update-counters base-thread

#addf encoder.capture-position servo-thread

addf pid.0.do-pid-calcs servo-thread
addf pid.1.do-pid-calcs servo-thread
addf pid.2.do-pid-calcs servo-thread


######################## ASSE X ##################

###### PARAMETRI PID ######

setp pid.0.Pgain = 1
setp pid.0.Igain = 0
setp pid.0.Dgain = 0
setp pid.0.bias = 0
setp pid.0.FF0 = 0
setp pid.0.FF1 = 1
setp pid.0.FF2 = 0
setp pid.0.deadband = 0.01


######## DEFINIRE IL TIPO DI ENCODER #########

setp encoder.6.counter-mode 1

#### IMPOSTARE LA SCALA DELL'ENCODER IN BASE ALLE PULSAZIONI X UNITÀ MACCHINA####

setp encoder.6.position-scale 200 # PERCHÈ LA MIA RIGA HA UNA CLASSE DI PRECISIONE DI 0.005mm


###### ENCODER #######

net encoder.6.phase-A <= parport.3.pin-xx-in


##### ENCODER POSITION COUNT TO PID #######

net encoder.6.position => pip.0.feedback
net encoder.6.position => axis.0.motor-pos-fb

#### PID COMAND TO MOTION COMAND

net axis.0.motor-pos-cmd => pid.0.command

net pid.0.output => stepgen.0.velocity-cmd


net stepgen.0.step => xstep
net stepgen.o.dir => xdir

#### ABILITAZIONE #########

#net xenable axis.0.amp-enable-out => stepgen.0.enable



######################## ASSE Y ##################


###### PARAMETRI PID ######

setp pid.1.Pgain = 1
setp pid.1.Igain = 0
setp pid.1.Dgain = 0
setp pid.1.bias = 0
setp pid.1.FF0 = 0
setp pid.1.FF1 = 1
setp pid.1.FF2 = 0
setp pid.1.deadband = 0.01


######## DEFINIRE IL TIPO DI ENCODER #########

setp encoder.7.counter-mode 1

#### IMPOSTARE LA SCALA DELL'ENCODER IN BASE ALLE PULSAZIONI X UNITÀ MACCHINA####

setp encoder.7.position-scale 200 # PERCHÈ LA MIA RIGA HA UNA CLASSE DI PRECISIONE DI 0.005mm


###### ENCODER #######

net encoder.7.phase-A <= parport.3.pin-xx-in


##### ENCODER POSITION COUNT TO PID #######

net encoder.7.position => pip.1.feedback
net encoder.7.position => axis.1.motor-pos-fb

#### PID COMAND TO MOTION COMAND

net axis.1.motor-pos-cmd => pid.1.command

net pid.1.output => stepgen.1.velocity-cmd


net stepgen.1.step => xstep
net stepgen.1.dir => xdir

#### ABILITAZIONE #########

#net xenable axis.1.amp-enable-out => stepgen.1.enable




######################## ASSE Z ##################


###### PARAMETRI PID ######

setp pid.2.Pgain = 1
setp pid.2.Igain = 0
setp pid.2.Dgain = 0
setp pid.2.bias = 0
setp pid.2.FF0 = 0
setp pid.2.FF1 = 1
setp pid.2.FF2 = 0
setp pid.2.deadband = 0.01


######## DEFINIRE IL TIPO DI ENCODER #########

setp encoder.8.counter-mode 1

#### IMPOSTARE LA SCALA DELL'ENCODER IN BASE ALLE PULSAZIONI X UNITÀ MACCHINA####

setp encoder.8.position-scale 200 # PERCHÈ LA MIA RIGA HA UNA CLASSE DI PRECISIONE DI 0.005mm


###### ENCODER #######

net encoder.8.phase-A <= parport.3.pin-xx-in


##### ENCODER POSITION COUNT TO PID #######

net encoder.8.position => pip.2.feedback
net encoder.8.position => axis.2.motor-pos-fb

#### PID COMAND TO MOTION COMAND

net axis.2.motor-pos-cmd => pid.2.command

net pid.2.output => stepgen.2.velocity-cmd


net stepgen.2.step => xstep
net stepgen.2.dir => xdir

#### ABILITAZIONE #########

#net xenable axis.2.amp-enable-out => stepgen.2.enable
More
15 Nov 2017 03:44 - 15 Nov 2017 03:45 #101813 by rodw
rodw replied the topic: Install PID module for LinuxCNC
Comments on the end of a line are not supported in hall files (but I know its on the to do list for the developers).

try changing this:
loadrt pid num_chan = 3 # numero totali pid

to:
# numero totali pid
loadrt pid num_chan = 3 
Last Edit: 15 Nov 2017 03:45 by rodw.
More
15 Nov 2017 08:13 #101824 by Antonio B.
Antonio B. replied the topic: Install PID module for LinuxCNC
Thank you!
Yes, seems that the issue was a '#' after the number......

Antonio
The following user(s) said Thank You: rodw
More
15 Nov 2017 16:52 #101853 by Antonio B.
Antonio B. replied the topic: Install PID module for LinuxCNC
Now I'm able to set the signal for the optical line (stripe) on the X axis in my hal file.
If I move it manually, infact, I saw the X value moving fine on the LinuxCNC window.
The issue here now that I obtain a Joint 0 following error when try to move the X motor and no action or movement my motors is doing.
I think that something is wrong here:

net xstep <= stepgen.0.step
net xdir <= stepgen.0.dir

and I have also tried to replace with:

net stepgen.0.step => xstep
net stepgen.0.dir => xdir

bit I obtain the error xstep do not exists.

This this is my hal file new content.
Can you help me to fix it please?
Thanks in advance


####START########

loadrt pid num_chan=1

addf pid.0.do-pid-calcs servo-thread

setp pid.0.Pgain 100
setp pid.0.Igain 0
setp pid.0.Dgain 0
setp pid.0.bias 0
setp pid.0.FF0 0
setp pid.0.FF1 0
setp pid.0.FF2 0
setp pid.0.deadband 10

setp pid.0.maxoutput 10


setp encoder.5.counter-mode 0
setp encoder.5.position-scale -200 # PERCHÈ LA MIA RIGA HA UNA CLASSE DI PRECISIONE DI 0.005mm


###### ENCODER #######

net x-encoderA <= parport.3.pin-10-in
net x-encoderB <= parport.3.pin-09-in

net x-encoderA => encoder.5.phase-A
net x-encoderB => encoder.5.phase-B


##### ENCODER POSITION COUNT TO PID #######


net feedback-X <= encoder.5.position
net feedback-X => pid.0.feedback
net feedback-X => axis.0.motor-pos-fb

#### PID COMAND TO MOTION COMAND

net pos-com <= axis.0.motor-pos-cmd
net pos-com => pid.0.command

net pid-comand-X <= pid.0.output
net pid-comand-X => stepgen.0.velocity-cmd

net xstep <= stepgen.0.step
net xdir <= stepgen.0.dir



#### ENABLE #########

net xenable axis.0.amp-enable-out => stepgen.0.enable


############END #######################
More
15 Nov 2017 20:57 #101864 by rodw
rodw replied the topic: Install PID module for LinuxCNC
You have created a signal with
net xstep <= stepgen.0.step
net xdir <= stepgen.0.dir

but you have not sent it anywhere. I am not familiar with parallel port setups but I suspect you need connect these signals to the parallel port pins used for step and direction (eg. those connected to your stepper driver. So you to add something like
net xstep =>  parport.3.pin-xx-out
net xdir    =>  parport.3.pin-yy-out
More
16 Nov 2017 11:25 #101890 by Antonio B.
Antonio B. replied the topic: Install PID module for LinuxCNC
Finally seems that I got it working.
I have commented those lines because already defined in main hal file.
The missing directive that I have inserted to get it working is:

setp pid.0.enable true

I forgot to allow the pin, this is the reason that I cannot see my motor movement.

Thanks again for your support as always.
Time to create page: 0.091 seconds
Powered by Kunena Forum