- LinuxCNC
- General LinuxCNC Questions
- Need a bit of help with a Raspberry PI 4 GPIO Glass scales control loop
Need a bit of help with a Raspberry PI 4 GPIO Glass scales control loop
- yagias
- Offline
- Junior Member
Less
More
- Posts: 21
- Thank you received: 0
21 Feb 2021 09:48 #199590
by yagias
Replied by yagias on topic Need a bit of help with a Raspberry PI 4 GPIO Glass scales control loop
That's great.
I'll get right on it.
I'll get right on it.
Please Log in or Create an account to join the conversation.
- yagias
- Offline
- Junior Member
Less
More
- Posts: 21
- Thank you received: 0
21 Feb 2021 11:00 - 21 Feb 2021 11:02 #199593
by yagias
Replied by yagias on topic Need a bit of help with a Raspberry PI 4 GPIO Glass scales control loop
So… there were some re-declarations of things like debounce.0. but I sorted those out.
I attached an updated version of the HAL.
Went and tested but saw the same result.
But I noticed that you put in net xpos-fp => joint.0.motor-pos-fb # feedback to joint data e.g. xpos–fp. Was that on purpose or should it had been xpos-fb?
Just for kicks i changed it to xpos-fb with much greater success
It doesn’t seem to be correcting anything at this point but I’m assuming that comes down to tuning.
I attached an updated version of the HAL.
Went and tested but saw the same result.
But I noticed that you put in net xpos-fp => joint.0.motor-pos-fb # feedback to joint data e.g. xpos–fp. Was that on purpose or should it had been xpos-fb?
Just for kicks i changed it to xpos-fb with much greater success
It doesn’t seem to be correcting anything at this point but I’m assuming that comes down to tuning.
Attachments:
Last edit: 21 Feb 2021 11:02 by yagias.
Please Log in or Create an account to join the conversation.
- chris@cnc
- Offline
- Platinum Member
Less
More
- Posts: 529
- Thank you received: 139
21 Feb 2021 11:58 #199595
by chris@cnc
Replied by chris@cnc on topic Need a bit of help with a Raspberry PI 4 GPIO Glass scales control loop
But I noticed that you put in net xpos-fp => joint.0.motor-pos-fb # feedback to joint data e.g. xpos–fp. Was that on purpose or should it had been xpos-fb?
No that was a mistake. But i wonder. Your other data called
pos-cmd and so on. I thing that the Point. We have to clear this Syntax. It seems now your Feedback is working. Can you move your axis in jog? Where are your command data written?
No that was a mistake. But i wonder. Your other data called
pos-cmd and so on. I thing that the Point. We have to clear this Syntax. It seems now your Feedback is working. Can you move your axis in jog? Where are your command data written?
The following user(s) said Thank You: yagias
Please Log in or Create an account to join the conversation.
- Hakan
- Offline
- Platinum Member
Less
More
- Posts: 504
- Thank you received: 157
21 Feb 2021 12:00 #199596
by Hakan
Replied by Hakan on topic Need a bit of help with a Raspberry PI 4 GPIO Glass scales control loop
I see you have the position command directly to stepgen. To engage feedback the position command has to go via the pid component so it can adjust for the position deviation.
The following user(s) said Thank You: yagias
Please Log in or Create an account to join the conversation.
- yagias
- Offline
- Junior Member
Less
More
- Posts: 21
- Thank you received: 0
21 Feb 2021 12:20 #199597
by yagias
Replied by yagias on topic Need a bit of help with a Raspberry PI 4 GPIO Glass scales control loop
@ Chris You’re back early
Regarding the syntax i’m pretty much up for anything you may recommend.
Yes. I’m able to move the axis and as long as my ferror is high enough i don’t get a joint following error.
(which is obvious even to me)
“Where are your command data written?” I’m sorry but i don’t understand the question?
(well having read Hakans post i think i do)
If i understand this right ??? commands are going to
net xpos-cmd joint.0.motor-pos-cmd => stepgen.0.position-cmd
@ Hakan
That would explain it and it makes sense.
BTW: I may not be right and have you mixed up with someone else but if i’m right i’m a fan of your videos.
Just want to take a second here to say thank you guys. This makes a world of difference to me.
Regarding the syntax i’m pretty much up for anything you may recommend.
Yes. I’m able to move the axis and as long as my ferror is high enough i don’t get a joint following error.
(which is obvious even to me)
“Where are your command data written?” I’m sorry but i don’t understand the question?
(well having read Hakans post i think i do)
If i understand this right ??? commands are going to
net xpos-cmd joint.0.motor-pos-cmd => stepgen.0.position-cmd
@ Hakan
That would explain it and it makes sense.
BTW: I may not be right and have you mixed up with someone else but if i’m right i’m a fan of your videos.
Just want to take a second here to say thank you guys. This makes a world of difference to me.
Please Log in or Create an account to join the conversation.
- Hakan
- Offline
- Platinum Member
Less
More
- Posts: 504
- Thank you received: 157
21 Feb 2021 13:18 #199605
by Hakan
Replied by Hakan on topic Need a bit of help with a Raspberry PI 4 GPIO Glass scales control loop
Yes I make some bad videos so that must be me
Here is my z-axis, it uses stepper motor and encoder for feedback. It uses hm2-components instead of the basic encoder and stepgen, but the principle is the same. Check how the pid component comes in, I think it can be the same obviously with the right naming.
Here is my z-axis, it uses stepper motor and encoder for feedback. It uses hm2-components instead of the basic encoder and stepgen, but the principle is the same. Check how the pid component comes in, I think it can be the same obviously with the right naming.
#*******************
# AXIS Z
#*******************
setp pid.z.Pgain [JOINT_2]P
setp pid.z.Igain [JOINT_2]I
setp pid.z.Dgain [JOINT_2]D
setp pid.z.bias [JOINT_2]BIAS
setp pid.z.FF0 [JOINT_2]FF0
setp pid.z.FF1 [JOINT_2]FF1
setp pid.z.FF2 [JOINT_2]FF2
setp pid.z.deadband [JOINT_2]DEADBAND
setp pid.z.maxoutput [JOINT_2]MAX_OUTPUT
setp pid.z.error-previous-target true
setp pid.z.maxerror 0.0
net z-index-enable <=> pid.z.index-enable
net z-enable => pid.z.enable
net z-pos-cmd => pid.z.command
net z-vel-cmd => pid.z.command-deriv
net z-pos-fb => pid.z.feedback
net z-output => pid.z.output
# Step Gen signals/setup
setp hm2_7i76e.0.stepgen.02.dirsetup [JOINT_2]DIRSETUP
setp hm2_7i76e.0.stepgen.02.dirhold [JOINT_2]DIRHOLD
setp hm2_7i76e.0.stepgen.02.steplen [JOINT_2]STEPLEN
setp hm2_7i76e.0.stepgen.02.stepspace [JOINT_2]STEPSPACE
setp hm2_7i76e.0.stepgen.02.position-scale [JOINT_2]STEP_SCALE
setp hm2_7i76e.0.stepgen.02.step_type 0
setp hm2_7i76e.0.stepgen.02.control-type 1
setp hm2_7i76e.0.stepgen.02.maxaccel [JOINT_2]STEPGEN_MAXACCEL
setp hm2_7i76e.0.stepgen.02.maxvel [JOINT_2]STEPGEN_MAXVEL
# --- Z axis encoder feedback signals/setup
setp hm2_7i76e.0.encoder.02.counter-mode 0
setp hm2_7i76e.0.encoder.02.filter 1
setp hm2_7i76e.0.encoder.02.index-invert 0
setp hm2_7i76e.0.encoder.02.index-mask 0
setp hm2_7i76e.0.encoder.02.index-mask-invert 0
setp hm2_7i76e.0.encoder.02.scale 1000
# ---closedloop stepper signals---
net z-pos-cmd <= joint.2.motor-pos-cmd
net z-vel-cmd <= joint.2.vel-cmd
net z-output <= hm2_7i76e.0.stepgen.02.velocity-cmd
net z-pos-fb <= hm2_7i76e.0.encoder.02.position
net z-pos-fb => joint.2.motor-pos-fb
net z-enable <= joint.2.amp-enable-out
net z-enable => hm2_7i76e.0.stepgen.02.enable
net z-vel-fb <= hm2_7i76e.0.encoder.02.velocity
net z-vel-fb => pid.z.feedback-deriv
Please Log in or Create an account to join the conversation.
- yagias
- Offline
- Junior Member
Less
More
- Posts: 21
- Thank you received: 0
21 Feb 2021 13:48 #199608
by yagias
Replied by yagias on topic Need a bit of help with a Raspberry PI 4 GPIO Glass scales control loop
@ Hakan
Well… I’m a fan all the same. They feel like real life not the polished version.
Tried this out and that brings us/me back to the original problem.
I’m running position mode not velocity. And as stated in the first two replies and based on your configuration apparently i need to be in velocity mode. I have no objection to running velocity mode what so ever but i can’t figure out how to do that either.
I spent yesterday reading countless configurations and forum posts as well as the stepconf component description but none of it put me in a position to make the changes to the configuration. Well i made tons of changes but none of it worked. I’m clearly missing something here… Hence my cry for help yesterday.
Well… I’m a fan all the same. They feel like real life not the polished version.
Tried this out and that brings us/me back to the original problem.
I’m running position mode not velocity. And as stated in the first two replies and based on your configuration apparently i need to be in velocity mode. I have no objection to running velocity mode what so ever but i can’t figure out how to do that either.
I spent yesterday reading countless configurations and forum posts as well as the stepconf component description but none of it put me in a position to make the changes to the configuration. Well i made tons of changes but none of it worked. I’m clearly missing something here… Hence my cry for help yesterday.
Please Log in or Create an account to join the conversation.
- Aciera
- Offline
- Administrator
Less
More
- Posts: 4006
- Thank you received: 1730
21 Feb 2021 14:08 - 21 Feb 2021 14:13 #199610
by Aciera
Replied by Aciera on topic Need a bit of help with a Raspberry PI 4 GPIO Glass scales control loop
According to this:
it seems you would set the mode to velocity here:
Maybe try:
[edit]
For more information including some examples:
linuxcnc.org/docs/html/hal/rtcomps.html
it seems you would set the mode to velocity here:
loadrt stepgen step_type=0,0,0
Maybe try:
loadrt stepgen step_type=0,0,0 ctrl_type=v,v,v
[edit]
For more information including some examples:
linuxcnc.org/docs/html/hal/rtcomps.html
Attachments:
Last edit: 21 Feb 2021 14:13 by Aciera.
Please Log in or Create an account to join the conversation.
- chris@cnc
- Offline
- Platinum Member
Less
More
- Posts: 529
- Thank you received: 139
21 Feb 2021 14:14 #199611
by chris@cnc
Replied by chris@cnc on topic Need a bit of help with a Raspberry PI 4 GPIO Glass scales control loop
what do you want to do in velocity mode? Usually axes are in position mode and spindle in velocity mode.
Please Log in or Create an account to join the conversation.
- Hakan
- Offline
- Platinum Member
Less
More
- Posts: 504
- Thank you received: 157
21 Feb 2021 14:20 #199614
by Hakan
Replied by Hakan on topic Need a bit of help with a Raspberry PI 4 GPIO Glass scales control loop
You can also work in position mode. I tried both and found the velocity mode worked better.
The other change needed is to set FF0=1 instead of FF1=1 for position mode if I remember right.
The other change needed is to set FF0=1 instead of FF1=1 for position mode if I remember right.
Please Log in or Create an account to join the conversation.
- LinuxCNC
- General LinuxCNC Questions
- Need a bit of help with a Raspberry PI 4 GPIO Glass scales control loop
Time to create page: 0.110 seconds