Step/Dir Servo Closed Loop with Encoder

More
7 years 2 months ago #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.

Attachment not found

Please Log in to join the conversation.

More
7 years 2 months ago #141900 by Hakan
What hardware do you have to read the encoders? 7i85?

To close the loop there is really one line to change
Code:
net x-pos-fb <= hm2_7i76e.0.stepgen.00.position-fb
to
Code:
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
Code:
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 to join the conversation.

More
7 years 2 months ago #142067 by andypugh

Type_Zero_Design wrote: 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:
Code:
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 to join the conversation.

Time to create page: 6.581 seconds
Powered by Kunena Forum