How turn off servo loop for one axis?
- tommylight
- Away
- Moderator
Less
More
- Posts: 18816
- Thank you received: 6320
16 Aug 2023 02:40 #278108
by tommylight
Replied by tommylight on topic How turn off servo loop for one axis?
Done, thank you.IMHO a better place would be in 'Advanced Configuration'. Maybe a mod could move it there
The following user(s) said Thank You: JPL
Please Log in or Create an account to join the conversation.
16 Aug 2023 11:40 #278161
by Taichi
Replied by Taichi on topic How turn off servo loop for one axis?
I really appreciate the forum's help. The forum and the lcnc developers have been very helpful in getting this rather complex machine working again. Forum participants helped from reflashing the mesa boards to the full functionality of the machine no worse than a siemens or fanuc CNC. And these systems cost a lot, like a spaceship.
Also I started to understand the structure of lcnc. Therefore, when I myself solved the problem for which I asked, I tried to describe how I solved it. So someone else who faces the same problem will read the forum and maybe it will help him.
The language barrier is a bit of a hindrance, I'm from Ukraine, and I often use a translator. That is why I questioned whether I expressed myself correctly. Thank you.
Also I started to understand the structure of lcnc. Therefore, when I myself solved the problem for which I asked, I tried to describe how I solved it. So someone else who faces the same problem will read the forum and maybe it will help him.
The language barrier is a bit of a hindrance, I'm from Ukraine, and I often use a translator. That is why I questioned whether I expressed myself correctly. Thank you.
Please Log in or Create an account to join the conversation.
16 Aug 2023 17:48 - 16 Aug 2023 18:25 #278187
by Taichi
Can I break this thread so the system doesn't track the position. -> net a-pos-fb => pid.a.feedback
Or physically turn off the encoder, but specify the system so that there is no feederror
Replied by Taichi on topic How turn off servo loop for one axis?
#*******************
# AXIS A JOINT 3
#*******************
setp pid.a.Pgain [JOINT_3]P
setp pid.a.Igain [JOINT_3]I
setp pid.a.Dgain [JOINT_3]D
setp pid.a.bias [JOINT_3]BIAS
setp pid.a.FF0 [JOINT_3]FF0
setp pid.a.FF1 [JOINT_3]FF1
setp pid.a.FF2 [JOINT_3]FF2
setp pid.a.deadband [JOINT_3]DEADBAND
setp pid.a.maxoutput [JOINT_3]MAX_OUTPUT
setp pid.a.error-previous-target true
net a-index-enable <=> pid.a.index-enable
net a-enable => pid.a.enable
net a-pos-cmd => pid.a.command
net a-pos-fb => pid.a.feedback
net a-output <= pid.a.output
# ---PWM Generator signals/setup---
setp hm2_5i25.0.7i77.0.1.analogout3-scalemax [JOINT_3]OUTPUT_SCALE
setp hm2_5i25.0.7i77.0.1.analogout3-minlim [JOINT_3]OUTPUT_MIN_LIMIT
setp hm2_5i25.0.7i77.0.1.analogout3-maxlim [JOINT_3]OUTPUT_MAX_LIMIT
net a-output => hm2_5i25.0.7i77.0.1.analogout3
net a-pos-cmd <= joint.3.motor-pos-cmd
net a-enable <= joint.3.amp-enable-out
# ---Encoder feedback signals/setup---
setp hm2_5i25.0.encoder.03.counter-mode 0
setp hm2_5i25.0.encoder.03.filter 1
setp hm2_5i25.0.encoder.03.index-invert 0
setp hm2_5i25.0.encoder.03.index-mask 0
setp hm2_5i25.0.encoder.03.index-mask-invert 0
setp hm2_5i25.0.encoder.03.scale [JOINT_3]ENCODER_SCALE
net a-pos-fb <= hm2_5i25.0.encoder.03.position
net a-vel-fb <= hm2_5i25.0.encoder.03.velocity
net a-pos-fb => joint.3.motor-pos-fb
net a-index-enable joint.3.index-enable <=> hm2_5i25.0.encoder.03.index-enable
net a-pos-rawcounts <= hm2_5i25.0.encoder.03.rawcounts
# ---setup home / limit switch signals---
net a-home-sw => joint.3.home-sw-in hm2_5i25.0.7i77.0.0.input-06-not
net a-neg-limit => joint.3.neg-lim-sw-in
net a-pos-limit => joint.3.pos-lim-sw-in
Or physically turn off the encoder, but specify the system so that there is no feederror
FERROR = 0.5 ------ > FERROR = 0 MIN
_FERROR = 0.05 -----> MIN_FERROR = 0
Last edit: 16 Aug 2023 18:25 by Taichi.
Please Log in or Create an account to join the conversation.
17 Aug 2023 05:10 #278230
by spumco
Replied by spumco on topic How turn off servo loop for one axis?
I - think - the solution is to use a mux component to swich the encoder's output between the spindle PID and the axis PID.
The switch is made using a pair of M-codes (axis mode on/off). When in spindle mode, the encoder is connected to spindle PID, and vice-versa for axis mode. And the axis-mode M-code also contains an un-home then home command.
So every time you activate the axis it will turn on encoder.N.index-enable, connect the output to the PID (via the mux), and then run the homing process.
I don't think physically turning off the encoder is the way to go.
Hopefully somone else can confirm or elaborate on the above.
The switch is made using a pair of M-codes (axis mode on/off). When in spindle mode, the encoder is connected to spindle PID, and vice-versa for axis mode. And the axis-mode M-code also contains an un-home then home command.
So every time you activate the axis it will turn on encoder.N.index-enable, connect the output to the PID (via the mux), and then run the homing process.
I don't think physically turning off the encoder is the way to go.
Hopefully somone else can confirm or elaborate on the above.
Please Log in or Create an account to join the conversation.
17 Aug 2023 09:58 - 17 Aug 2023 10:02 #278245
by Aciera
Replied by Aciera on topic How turn off servo loop for one axis?
I'm not familiar with analog servo setups but I have implemented a rotary axis/spindle switch with a motor drive that could be run in position(step/dir)/velocity(analog) mode. Which means I did not run the motor with the stepgen while in spindle mode.
forum.linuxcnc.org/10-advanced-configura...code?start=30#272218
I wonder if you could do something similar so I'll try to give a quick overview of what was involved.
Say we start with the rotary running in axis mode.
Switch to spindle mode:
1. Move rotary to position zero
2. Store the current encoder count and switch the rotary feedback from the encoder count to the stored count. (this means the rotary axis 'thinks' it is standing still while in spindle mode)
3. In my case I switch the drive to speed mode and use normal spindle command (M3 Sxxxx) to output an analog signal to run the motor as a spindle. In your case I wonder if you could maybe switch to a different pwm generator.
To switch from spindle back to rotary:
1. use M19 spindle orient to bring the spindle to the zero position. There is a special component that resets the encoder count on a mesa board to zero on an index pulse (in my case this pulse comes from the encoder output of my motor drive if you don't have an index signal you may have to generate one using an extra sensor on the motor). This basically 'rehomes' the rotary.
2. we can now reconnect the encoder count to the rotary feedback position. Note that, depending on the accuracy of the spindle orientation the spindle will have overshot the zero position and the encoder may be somewhere past the zero count. The moment this count is reconnected to the rotary feedback it will be seen as a position error and will be corrected by the pid. This might require relaxing the f-error value to avoid triggering a following error.
All the relevant components (encoder switching, spindle-orient) and mcodes are attached to the post linked above and the one immediately following it.
Maybe this give you some ideas about how to proceed in your situation.
forum.linuxcnc.org/10-advanced-configura...code?start=30#272218
I wonder if you could do something similar so I'll try to give a quick overview of what was involved.
Say we start with the rotary running in axis mode.
Switch to spindle mode:
1. Move rotary to position zero
2. Store the current encoder count and switch the rotary feedback from the encoder count to the stored count. (this means the rotary axis 'thinks' it is standing still while in spindle mode)
3. In my case I switch the drive to speed mode and use normal spindle command (M3 Sxxxx) to output an analog signal to run the motor as a spindle. In your case I wonder if you could maybe switch to a different pwm generator.
To switch from spindle back to rotary:
1. use M19 spindle orient to bring the spindle to the zero position. There is a special component that resets the encoder count on a mesa board to zero on an index pulse (in my case this pulse comes from the encoder output of my motor drive if you don't have an index signal you may have to generate one using an extra sensor on the motor). This basically 'rehomes' the rotary.
2. we can now reconnect the encoder count to the rotary feedback position. Note that, depending on the accuracy of the spindle orientation the spindle will have overshot the zero position and the encoder may be somewhere past the zero count. The moment this count is reconnected to the rotary feedback it will be seen as a position error and will be corrected by the pid. This might require relaxing the f-error value to avoid triggering a following error.
All the relevant components (encoder switching, spindle-orient) and mcodes are attached to the post linked above and the one immediately following it.
Maybe this give you some ideas about how to proceed in your situation.
Last edit: 17 Aug 2023 10:02 by Aciera.
The following user(s) said Thank You: spumco
Please Log in or Create an account to join the conversation.
17 Aug 2023 10:07 #278247
by Taichi
Replied by Taichi on topic How turn off servo loop for one axis?
Please Log in or Create an account to join the conversation.
17 Aug 2023 10:29 #278250
by Aciera
linuxcnc.org/docs/html/gcode/m-code.html#mcode:m62-m65
Then you can use and AND component to connect the relevant 'motion.digital-out-0x' pin and whatever signal you currently use to drive hm2_5i25.0.7i77.0.0.output-16
Replied by Aciera on topic How turn off servo loop for one axis?
You could use M64/M65 to switch hal pins 'motion.digital-out-0N'How can I program M-code to enable and disable hm2_5i25.0.7i77.0.0.output-16?
linuxcnc.org/docs/html/gcode/m-code.html#mcode:m62-m65
Then you can use and AND component to connect the relevant 'motion.digital-out-0x' pin and whatever signal you currently use to drive hm2_5i25.0.7i77.0.0.output-16
There is no such Gcode, which is why we have to use the M19 spindle orient to 'rehome' the rotary spindle before we can use it as a rotary axis.I can't find the g-code that will send the axis to find a home...
The following user(s) said Thank You: spumco
Please Log in or Create an account to join the conversation.
27 Aug 2023 09:55 - 27 Aug 2023 09:56 #279084
by Taichi
Replied by Taichi on topic How turn off servo loop for one axis?
Hello, in general, the problem with controlling the axis as a spindle was solved. Two relays were installed and they are controlled by M64 and M65. The first relay turns off the power to the encoder, and the second relay passes 10V through the potentiometer. Now, to execute the program, you must first grind the surface and then turn the axis back on. The position of the axis when it is turned on and will be the index. And relative to this position, you can do any operations with correct angles. After that, you can turn off the axis again and turn on the spindle and polish again, but back in the axis mode you will no longer get into the index. I made it through two relays so that there was no reaction to the rattling of the contacts. Encoder power is turned on after the LCNC has gained control over 10v for this axis.
Thanks to everyone who helped. Best regards. The forum branch can be closed.
- machine working video
Thanks to everyone who helped. Best regards. The forum branch can be closed.
- machine working video
Last edit: 27 Aug 2023 09:56 by Taichi.
Please Log in or Create an account to join the conversation.
27 Aug 2023 10:19 #279085
by Aciera
Replied by Aciera on topic How turn off servo loop for one axis?
Somewhat unusual way of doing it but I'm glad you found a solution that works for you.
Thanks for reporting back.
Thanks for reporting back.
Please Log in or Create an account to join the conversation.
Time to create page: 0.121 seconds