- Configuring LinuxCNC
- Configuration Tools
- PnCConf Wizard
- Proposed changes for the default PnCConf stepgen generated configs.
Proposed changes for the default PnCConf stepgen generated configs.
- jtrantow
- Offline
- Premium Member
Less
More
- Posts: 107
- Thank you received: 18
14 Jan 2024 22:10 #290710
by jtrantow
Replied by jtrantow on topic Proposed changes for the default PnCConf stepgen generated configs.
I agree with the good reasons for generating two definitions for x-pos-fb. Even when it's been tuned, I occasionally toggle between open/closed loop when I'm debugging the machine.
I took a look at the generated .hal and the only change I see is the new connection from encoder velocity to pid fb-deriv.
I refined my ideas slightly and updated the control diagrams. 1) my understanding of the current 2.9.2 pncconf output, 2) new cmorey output, 3) proposed output. See the attachment for details. I think it's critical to add some comments to the file that indicate what lines need to be commented out for a particular choice.
#
# The Trajectory Planner gives us the velocity. Using this signal with the PID avoids estimating the velocity command.
#
net x-vel-cmd <= joint.0.vel-cmd => pid.x.feedback-deriv
#
# Enable/Disable BOTH the following TWO lines to use the encoder to close the control loop.
# Use both the encoder position and velocity.
#
net x-pos-fb <= hm2_7i96.0.encoder.00.position => pid.x.feedback => joint.0.motor-pos-fb
net x-vel-fb <= hm2_7i96.0.encoder.00.velocity => pid.x.feedback-deriv
#
# Enable/Disable BOTH the following TWO line to use stepgen position to close the control loop.
# Add a new signal from encoder position so it can be used independent of pid fb signal. This allows encoder to be used as DRO without closing the control loop.
# Do not use the encoder x-vel-fb is you are using the stepgen position for x-pos-fb.
#
net x-pos-encoder <= hm2_7i96.0.encoder.00.position => joint.0.motor-pos-fb
net x-pos-fb <= hm2_7i96.0.stepgen.00.position-fb => pid.x.feedback
I took a look at the generated .hal and the only change I see is the new connection from encoder velocity to pid fb-deriv.
I refined my ideas slightly and updated the control diagrams. 1) my understanding of the current 2.9.2 pncconf output, 2) new cmorey output, 3) proposed output. See the attachment for details. I think it's critical to add some comments to the file that indicate what lines need to be commented out for a particular choice.
#
# The Trajectory Planner gives us the velocity. Using this signal with the PID avoids estimating the velocity command.
#
net x-vel-cmd <= joint.0.vel-cmd => pid.x.feedback-deriv
#
# Enable/Disable BOTH the following TWO lines to use the encoder to close the control loop.
# Use both the encoder position and velocity.
#
net x-pos-fb <= hm2_7i96.0.encoder.00.position => pid.x.feedback => joint.0.motor-pos-fb
net x-vel-fb <= hm2_7i96.0.encoder.00.velocity => pid.x.feedback-deriv
#
# Enable/Disable BOTH the following TWO line to use stepgen position to close the control loop.
# Add a new signal from encoder position so it can be used independent of pid fb signal. This allows encoder to be used as DRO without closing the control loop.
# Do not use the encoder x-vel-fb is you are using the stepgen position for x-pos-fb.
#
net x-pos-encoder <= hm2_7i96.0.encoder.00.position => joint.0.motor-pos-fb
net x-pos-fb <= hm2_7i96.0.stepgen.00.position-fb => pid.x.feedback
Please Log in or Create an account to join the conversation.
- jtrantow
- Offline
- Premium Member
Less
More
- Posts: 107
- Thank you received: 18
14 Jan 2024 22:56 #290716
by jtrantow
Replied by jtrantow on topic Proposed changes for the default PnCConf stepgen generated configs.
One small change in the .hal snippet which used feedback-deriv instead of command-deriv (diagrams are correct)
#
# The Trajectory Planner gives us the velocity. Using this signal with the PID avoids estimating the velocity command.
#
net x-vel-cmd <= joint.0.vel-cmd => pid.x.command-deriv
#
# The Trajectory Planner gives us the velocity. Using this signal with the PID avoids estimating the velocity command.
#
net x-vel-cmd <= joint.0.vel-cmd => pid.x.command-deriv
Please Log in or Create an account to join the conversation.
- PCW
- Offline
- Moderator
Less
More
- Posts: 17904
- Thank you received: 4774
14 Jan 2024 23:36 #290719
by PCW
Replied by PCW on topic Proposed changes for the default PnCConf stepgen generated configs.
As I mentioned before, I would suggest _not_ doing this:
net x-vel-cmd <= joint.0.vel-cmd => pid.x.command-deriv
as it results on higher following errors
net x-vel-cmd <= joint.0.vel-cmd => pid.x.command-deriv
as it results on higher following errors
Please Log in or Create an account to join the conversation.
- 0x2102
- Offline
- Elite Member
Less
More
- Posts: 210
- Thank you received: 75
15 Jan 2024 00:23 #290722
by 0x2102
Replied by 0x2102 on topic Proposed changes for the default PnCConf stepgen generated configs.
Tested this quick. With my setup F (feed) <1000 seems OK, but higher feed rate and my axis went into estop with following error.
Please Log in or Create an account to join the conversation.
- PCW
- Offline
- Moderator
Less
More
- Posts: 17904
- Thank you received: 4774
15 Jan 2024 00:36 #290723
by PCW
Replied by PCW on topic Proposed changes for the default PnCConf stepgen generated configs.
Yes, there appears to be a pipelining issue with motions
commanded velocity pin, at least relative to PIDs calculation
commanded velocity pin, at least relative to PIDs calculation
Please Log in or Create an account to join the conversation.
- jtrantow
- Offline
- Premium Member
Less
More
- Posts: 107
- Thank you received: 18
16 Jan 2024 02:06 #290817
by jtrantow
Replied by jtrantow on topic Proposed changes for the default PnCConf stepgen generated configs.
ok, I withdraw the proposed change to use the x-vel-cmd <= joint.0.vel-cmd => pid.x.command-deriv
I think the other changes are still worth implementing. I did verify that I can generate and run simple (one encoder) PNCconf stepgen configurations on my 7i96+7i85S lathe. I haven't figured out how to access the encoders on the 7i85 without editing the .hal file.
I think the other changes are still worth implementing. I did verify that I can generate and run simple (one encoder) PNCconf stepgen configurations on my 7i96+7i85S lathe. I haven't figured out how to access the encoders on the 7i85 without editing the .hal file.
Please Log in or Create an account to join the conversation.
- jtrantow
- Offline
- Premium Member
Less
More
- Posts: 107
- Thank you received: 18
16 Jan 2024 07:16 #290834
by jtrantow
Replied by jtrantow on topic Proposed changes for the default PnCConf stepgen generated configs.
I have found another problem with the HOME_USE_INDEX and encoder, stepgen, configs. All is good with x-pos-fb <= encoder.position but when you select x-pos-fb <= stepgen.position-fb HOME_USE_INDEX no longer works correctly. I believe this is because stepgen doesn't get reset by x-index-enable. It will work if you use HOME_INDEX_NO_ENCODER_RESET = YES in the .ini. Since the stepgen doesn't get reset on x-index-enable it also causes problems running the encoder.position into the joint.motor-pos-fb and using the HOME_USE_INDEX.
Best solution would be for stepgen to implement the index-enable pin that's in the documentation?
Next best might be to always define HOME_INDEX_NO_ENCODER_RESET = YES which appears to work in both cases.
Next best would be to include comment about needing HOME_INDEX_NO_ENCODER_RESET = YES in the .hal file around the x-pos-fb lines.
Best solution would be for stepgen to implement the index-enable pin that's in the documentation?
Next best might be to always define HOME_INDEX_NO_ENCODER_RESET = YES which appears to work in both cases.
Next best would be to include comment about needing HOME_INDEX_NO_ENCODER_RESET = YES in the .hal file around the x-pos-fb lines.
Please Log in or Create an account to join the conversation.
- jtrantow
- Offline
- Premium Member
Less
More
- Posts: 107
- Thank you received: 18
18 Jan 2024 03:31 #290988
by jtrantow
Replied by jtrantow on topic Proposed changes for the default PnCConf stepgen generated configs.
The default config has a problem of missing a connection to the stepgen index-enable pin. This will only cause a problem with HOME_USE_INDEX or if you try to use the encoder position as joint motor-pos-fb. stepgen index-enable is available in bit files containing "sdi" in the file name. forum.linuxcnc.org/9-installing-linuxcnc...oder?start=10#290984
The only changes I have to make to the 2.9.2 PNCConf generated files (aside from collecting some of the signals to single lines) are the following:
#
# If you want to use x-pos-fb from the stepgenposition-fb with HOME_USE_INDEX or the encoder position as joint fb, then you will need to use a bit file that supports stepgen.00.index-enable.
# This is required when using stepgen position for feedback and doesn't hurt when you use the encoder for feedback.
#
net x-index-enable <=> joint.0.index-enable <=> hm2_7i96.0.encoder.00.index-enable <=> pid.x.index-enable <=> hm2_7i96.0.stepgen.00.index-enable
#
# Enable/Disable BOTH the following lines to use the encoder as the PID -pos-fb.
# Use both the encoder position and velocity.
# This should be the optimal configuration.
net x-pos-fb <= hm2_7i96.0.encoder.00.position => pid.x.feedback => joint.0.motor-pos-fb
net x-vel-fb <= hm2_7i96.0.encoder.00.velocity => pid.x.feedback-deriv
#
# Enable/Disable BOTH the following lines to use stepgen as the PID -pos-fb.
# Add a new signal from encoder position so it can be used independent of pid fb signal. This allows encoder to be used as DRO without closing the control loop.
# Do not use the encoder x-vel-fb is you are using the stepgen position for x-pos-fb.
#
net x-pos-fb <= hm2_7i96.0.stepgen.00.position-fb => pid.x.feedback
net x-pos-encoder <= hm2_7i96.0.encoder.00.position => joint.0.motor-pos-fb
The diagram got a bit complicated when I display the index-enable signals, so I broke it back into two diagrams showing each case. (see attachment) I have tested this on a single axis with simple x max limit + home and with HOME_USE_INDEX for both cases. I haven't spent much time on tuning but I think this all makes sense now and would be worth changing the default configuration.
I'm now happy with my lathe configuration and will make corresponding updates to my mill later this week.
The only changes I have to make to the 2.9.2 PNCConf generated files (aside from collecting some of the signals to single lines) are the following:
#
# If you want to use x-pos-fb from the stepgenposition-fb with HOME_USE_INDEX or the encoder position as joint fb, then you will need to use a bit file that supports stepgen.00.index-enable.
# This is required when using stepgen position for feedback and doesn't hurt when you use the encoder for feedback.
#
net x-index-enable <=> joint.0.index-enable <=> hm2_7i96.0.encoder.00.index-enable <=> pid.x.index-enable <=> hm2_7i96.0.stepgen.00.index-enable
#
# Enable/Disable BOTH the following lines to use the encoder as the PID -pos-fb.
# Use both the encoder position and velocity.
# This should be the optimal configuration.
net x-pos-fb <= hm2_7i96.0.encoder.00.position => pid.x.feedback => joint.0.motor-pos-fb
net x-vel-fb <= hm2_7i96.0.encoder.00.velocity => pid.x.feedback-deriv
#
# Enable/Disable BOTH the following lines to use stepgen as the PID -pos-fb.
# Add a new signal from encoder position so it can be used independent of pid fb signal. This allows encoder to be used as DRO without closing the control loop.
# Do not use the encoder x-vel-fb is you are using the stepgen position for x-pos-fb.
#
net x-pos-fb <= hm2_7i96.0.stepgen.00.position-fb => pid.x.feedback
net x-pos-encoder <= hm2_7i96.0.encoder.00.position => joint.0.motor-pos-fb
The diagram got a bit complicated when I display the index-enable signals, so I broke it back into two diagrams showing each case. (see attachment) I have tested this on a single axis with simple x max limit + home and with HOME_USE_INDEX for both cases. I haven't spent much time on tuning but I think this all makes sense now and would be worth changing the default configuration.
I'm now happy with my lathe configuration and will make corresponding updates to my mill later this week.
Please Log in or Create an account to join the conversation.
Moderators: cmorley
- Configuring LinuxCNC
- Configuration Tools
- PnCConf Wizard
- Proposed changes for the default PnCConf stepgen generated configs.
Time to create page: 0.100 seconds