Install PID module for LinuxCNC
- Bello
-
Topic Author
- Offline
- Senior Member
-
Less
More
- Posts: 43
- Thank you received: 2
14 Nov 2017 16:21 #101788
by Bello
Install PID module for LinuxCNC was created by Bello
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
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
Please Log in or Create an account to join the conversation.
- Todd Zuercher
-
- Offline
- Platinum Member
-
Less
More
- Posts: 4998
- Thank you received: 1459
14 Nov 2017 17:21 #101793
by Todd Zuercher
Replied by Todd Zuercher on 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.
You can not loadrt the same hal component on more than one line.
Please Log in or Create an account to join the conversation.
- Bello
-
Topic Author
- Offline
- Senior Member
-
Less
More
- Posts: 43
- Thank you received: 2
14 Nov 2017 17:24 #101794
by Bello
Replied by Bello on 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
How can I need to load PIDs in my hal file?
Regards,
Antonio
Please Log in or Create an account to join the conversation.
- Todd Zuercher
-
- Offline
- Platinum Member
-
Less
More
- Posts: 4998
- Thank you received: 1459
14 Nov 2017 17:29 - 14 Nov 2017 17:32 #101795
by Todd Zuercher
Replied by Todd Zuercher on 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
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.
The following user(s) said Thank You: Bello
Please Log in or Create an account to join the conversation.
- Bello
-
Topic Author
- Offline
- Senior Member
-
Less
More
- Posts: 43
- Thank you received: 2
14 Nov 2017 18:21 #101796
by Bello
Replied by Bello on 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
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
Please Log in or Create an account to join the conversation.
- rodw
-
- Offline
- Platinum Member
-
Less
More
- Posts: 11252
- Thank you received: 3760
15 Nov 2017 03:44 - 15 Nov 2017 03:45 #101813
by rodw
Replied by rodw on 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:
to:
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.
The following user(s) said Thank You: Bello
Please Log in or Create an account to join the conversation.
- Bello
-
Topic Author
- Offline
- Senior Member
-
Less
More
- Posts: 43
- Thank you received: 2
15 Nov 2017 08:13 #101824
by Bello
Replied by Bello on topic Install PID module for LinuxCNC
Thank you!
Yes, seems that the issue was a '#' after the number......
Antonio
Yes, seems that the issue was a '#' after the number......
Antonio
The following user(s) said Thank You: rodw
Please Log in or Create an account to join the conversation.
- Bello
-
Topic Author
- Offline
- Senior Member
-
Less
More
- Posts: 43
- Thank you received: 2
15 Nov 2017 16:52 #101853
by Bello
Replied by Bello on 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 #######################
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 #######################
Please Log in or Create an account to join the conversation.
- rodw
-
- Offline
- Platinum Member
-
Less
More
- Posts: 11252
- Thank you received: 3760
15 Nov 2017 20:57 #101864
by rodw
Replied by rodw on topic Install PID module for LinuxCNC
You have created a signal with
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 <= 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
Please Log in or Create an account to join the conversation.
- Bello
-
Topic Author
- Offline
- Senior Member
-
Less
More
- Posts: 43
- Thank you received: 2
16 Nov 2017 11:25 #101890
by Bello
Replied by Bello on 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.
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.
Please Log in or Create an account to join the conversation.
Time to create page: 0.145 seconds