- Posts: 972
- Thank you received: 0
Encoders
natholego11 wrote: so seeing that the DYN4 will do all the PID internally, I suppose i need to remove the connection to the PID on the spindle. is that as simple as setting all the PID values to 0? or do I need to remove the hal components of the PID for the spindle?
No, Setting the PID to 0 is well....setting the PID to 0. PID is a single component with multiple pins and to remove it is to "rewire" the hal file without it.....really if you're going to try to do all of the stuff you want to you will have to get familiar with hal. And just as I said above, others have said setting a PID to 0 is basically removing it, this has not been my experience. If the PID works for ya, use the PID, it did not work for me with the DYN4 so I took 5 minutes and removed it.
You can check out this fella's youtube video. He had quite a time setting up the DMM spindle motor. He ran into issues with using the encoder and stepgen single ended like you are. I spoke to him a couple of times and I don't really agree with alot of the conclusions that were drawn here but he also had some PID issues, I had issues with lousy autotune software but that's about it.
Please Log in to join the conversation.
- tommylight
-
- Offline
- Administrator
-
- Posts: 22012
- Thank you received: 4
I was not sure it would, so thanks for confirming that.blazini36 wrote:
Without what? the PID? it works fine with the Spindle PID removed,tommylight wrote: I do not think you have to remove those, most probably it will not work without it.
Please Log in to join the conversation.
- natholego11
- Topic Author
- Offline
- Senior Member
-
- Posts: 71
- Thank you received: 0
So I got the linear encoders wired up and input into HAL. but as I am reading through the INI documentation I am noticing that the PID functionality is adjusting voltages sent to servos. im not sure that is going to work for me here as I am sending step and direction signals to my clearpath servos. so How do I get the PID and FF0,1,2 commands to work for my system? I played with it a little bit but I couldnt even get any of the axis' to oscillate.
on a side note, when I power the machine up the encoders get power as well, at what point does the encoder count begin? after the application starts up? or is the 7i96 taking counts once it has power? if this is the case I would prefer that the counter is reset to 0 after the system boots up and the machine is homed. is there a good way to do this? would it be a simple encoder.01.counter = 0 or something?
Here is my current HAL and INI files
HAL:
INI:
Please Log in to join the conversation.
- tommylight
-
- Offline
- Administrator
-
- Posts: 22012
- Thank you received: 4
- Only X axis has encoder feedback
- X axis has a value of 10 for MAX_OUTPUT, i do not think that is correct, i have it at 0 and works properly with encoder feedback.
MAX_OUTPUT = 10 should be for servo systems with +-10V control.
Please Log in to join the conversation.
- Todd Zuercher
- Offline
- Platinum Member
-
- Posts: 4739
- Thank you received: 2
For the X-axis, do you have the linear encoder connected to hm2_7i96.0.encoder.01?
If so it is controlling the PID, (Where originally hm2_7i96.0.stepgen.00.position-fb was).
Now you need to tune the PID by increasing P until it becomes unstable (should be somthing between 1 and 1000). Basically you'll then follow the steps use in an ordinary velocity servo tuning tutorial.
Please Log in to join the conversation.
No idea what you have going on with your encoders there. You have a highspeed dedicated encoder channel but you're using a GPIO MPG encoder input for the Spindle? The spindle drive is outputting quadrature but you have the encoder channel set to step/direction? Are your linear scales incremental quadrature (A+B )? or are they step/direction too? Do you plan on changing direction at all?
Encoder counts begin when the 7i96 is initialized. It is the 7i96 itself that is doing the counting. You have absolutely no reason to want to reset the counts, and your config doesn't use counts anyway, it uses the encoder position. The encoder's position isn't being used directly, the real position is coming from the motion.joint pins and that is what resets to 0 while homing. The encoder position is taken for it's position for where it is now compared to where it was and where it goes from here......the actual hm2 position value doesn't matter and it's never reset, otherwise you would have some connection to the 7i96.0.encoder.xx.reset pin as that resets count and position. SO basically if the encoder position is 10.257 when the home switch is activated, then the encoder's 10.257 becomes what the motion controller knows as "0" disregarding the switch offsets your config set.
Please Log in to join the conversation.
- natholego11
- Topic Author
- Offline
- Senior Member
-
- Posts: 71
- Thank you received: 0
I ended up using the encoder from the DMM spindle. so I am no longer using the other encoder. I might keep that for a home position or a spindle orientation position sensor in the future. but I ended up moving to the DMM encoder.
on the linear encoders they are TTL encoders. and from what I can tell they are working as they should, I did some moving around last night and when I input the 4064 pul/in on the ballscrew I am getting very close to the calculated pul/in on the encoder (5um/div = 5080pul/in) I think I am getting like 5085 or something, so pretty pleased with that, and I have my deadband set at 0.0005 which if i read correctly is the allowable variation the PID is tuning to.
That being the case you are saying i need to tune the PID during a cut? not just jogging the machine around? I get it that there arnt any loads on the machine (other than the inertia of the components that make up the machine) but I feel like i should see at least something when its just jogging around.
@Todd
do you have any references for the "velocity tuning tutorial?" Ill give it a try assuming everything i have setup is correct.
Please Log in to join the conversation.
natholego11 wrote: @Blazini,
I ended up using the encoder from the DMM spindle. so I am no longer using the other encoder. I might keep that for a home position or a spindle orientation position sensor in the future. but I ended up moving to the DMM encoder.
on the linear encoders they are TTL encoders. and from what I can tell they are working as they should, I did some moving around last night and when I input the 4064 pul/in on the ballscrew I am getting very close to the calculated pul/in on the encoder (5um/div = 5080pul/in) I think I am getting like 5085 or something, so pretty pleased with that, and I have my deadband set at 0.0005 which if i read correctly is the allowable variation the PID is tuning to.
That being the case you are saying i need to tune the PID during a cut? not just jogging the machine around? I get it that there arnt any loads on the machine (other than the inertia of the components that make up the machine) but I feel like i should see at least something when its just jogging around.
Look here:
linuxcnc.org/docs/html/man/man9/hostmot2.9.html
In your hal file:
setp hm2_7i96.0.encoder.01.counter-mode 0 (X)
setp hm2_7i96.0.encoder.04.counter-mode 1 (spindle)
This has nothing to do with "TTL". Transistor to Transistor Logic means "single ended" as referred to in the Mesa manual as opposed to differential. Quadrature, as opposed to Step/direction is what you are setting with "counter-mode". Quadrature is comparing 4 pulse edges between 2 separate phases, and the order the pulses come in from the 2 phases is what the controller understands as your encoder changing direction. Step/direction, uses a single pulse channel and holds the direction channel high or low to determine the direction change while the pulses are exactly the same. So if your DMM servo is outputting quadrature on AB channels, why do you have it set for step/direction? I never used the "MPG" encoder config but isn't your dedicated encoder channel still hm2_7i96.0.encoder.00? So why use a GPIO encoder channel for your fastest encoder?
Of course you can't tune the PID while it's cutting, lol I have nothing more to add to that conversation.
Please Log in to join the conversation.
- natholego11
- Topic Author
- Offline
- Senior Member
-
- Posts: 71
- Thank you received: 0
I wanted to say thank you for your help and insight and training! I think I got it tuned yesterday, I need to take a cut and verify that everything measures correctly, but I have the deadband set on all 3 axis to 0.0003 and it seems stable. on to the next thing! gotta figure out the rest of my inputs and out puts.
Thanks again!
Please Log in to join the conversation.
