Step/Dir Servo Closed Loop with Encoder

More
11 Aug 2019 06:28 #141894 by Type_Zero_Design
Hello Everyone,

Starting this thread here to prevent continuing to clutter Tommy's PID tuning thread. I have attached my current .Hal file.

So as the title says I am looking to figgure out how to close the loop in LCNC with my Step/Dir servos. I have been doing a ton of searching and reading the .Hal manual but still struggling to figgure out exactly what needs to be done to complete this in Hal.

Currently, I can jog the machine and have confirmed that I am getting accurate movment on all axis. I know that I need to connect my encoders to the correct areas, but i'm not 100% on what those are.

Im not sure what the encoder name is to even to connect to.

Also ive seen mention of setting up the stepgen in velocity mode but i dont see the line mentioned to do that in my .hal file

I appreciate the feedback.

File Attachment:

File Name: TC225_2019-08-11.hal
File Size:10 KB
Attachments:

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

More
11 Aug 2019 07:42 #141900 by Hakan
What hardware do you have to read the encoders? 7i85?

To close the loop there is really one line to change
net x-pos-fb     <= hm2_7i76e.0.stepgen.00.position-fb
to
net x-pos-fb     <= hm2_7i76e.0.encoder.00.position
provided the encoder is called that.

Then you need to adjust the PID parameters. This should hopefully get you going at least
P =                1
I =                0.0
D =                0.0
FF0 =              0.0
FF1 =              1.0
FF2 =              0.0
BIAS =             0.0
DEADBAND =         0.0
MAX_OUTPUT =       0.0

My guess is that you have the velocity loop in the servo controller and adjust it using the controller software.

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

More
13 Aug 2019 18:37 #142067 by andypugh

Also ive seen mention of setting up the stepgen in velocity mode but i dont see the line mentioned to do that in my .hal file


You are already set up in velocity mode:
setp   hm2_7i76e.0.stepgen.00.control-type     1

In fact, as was pointed out in the post above, you only actually need to change part of one line.
You might also need to add a little bit of I-gain to make use of the feedback.

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

Time to create page: 0.137 seconds
Powered by Kunena Forum