Spindle Step/Dir and as C axis one the same Servo
24 Aug 2024 20:24 - 25 Aug 2024 12:11 #308558
by ustaL
Spindle Step/Dir and as C axis one the same Servo was created by ustaL
Before I ask for help, I will write a little here about what I have already tried and the course of my thoughts. Perhaps I just can not implement my thought correctly, perhaps my conclusions are not correct.
- Mesa 7i95T
- Servo for Spindle AND Axis C (one physical servo)
- Lathe
I want to make rotation on the spindle to some degree to do another work with the milling/drilling, then turn to lathe work and so on. For now, lets assume that I have a 1:1 ratio between Servo and Spindle (1000 rpm Servo == 1000 rpm Spindle, 15 degree Servo = 15 degree Spindle)
From my point of view, I chose Dir/Step for both jobs (speed/velocity and rotation/position, next velocity and position modes).
PncConf doesn't work because for new Boards all pins have another naming convention. Mesa support can't help. Only suggest configuring the already existing board in PncConf and "fix ini/hal files to 7i95t somehow".
MecaCT doesn't work because the spindle tab doesn't work at all (firmware PWM could help, but this is not what I chose: step/dir). So I have to make INI and HAL files from scratch.
I did spindle config via pid + motion.spindle AND axisC via joint+pid and both of them use the same hm2_7i95.0.stepgen.N
BUT
1. I'm not sure to use PID in both spindle modes (velocity and position)
2. I'm confused that PncConf generates (that was my manual for linear/angular settings) all configs with stepgen.control-type = 1 (which is velocity mode according to the manual)
3. I think that position mode (really stepgen position mode) could be used only in 1:1 ratio for rotation. In another case we have a ratio in screw. So our goal is not to rotate 50 degrees on Motor level, but to move to 2.125mm in XYZ or rotate somewhere in CNC. So LinuxCNC calculates how many pulses/steps we need to move in one direction to 2.125mm with speed X (how fast we need to be at 2.125mm)
1+2+3 = LinuxCNC used stepgen velocity mode for linear and angular axis. Am I correct? So from the customer's perspective there is a difference between positions for ** degree, and moving for ** mm, but from LinuxCNC this is all about pulse count if frequency (Infinite/Finite Number of Pulses). For Spindle use Infinite.
So my Servo motor has 10.000 pulses for 1 rotation. For "spindle velocity" mode it means 10.000 pulses per 1 motor rotation (in cases of 1:1 ratio 1 Spindle rotation). So machine unit = one rotation. So SCALE 10.000 for 1 unit. In case of rotation, machine unit = 1 degree. So SCALE became 10.000/360 = ~28 steps. So here we have different settings for the same stepgen. Also question maxvel and maxaccel, ff0, ff1, pid?
BUT I have problem with switching between two modes.
When the spindle is working, stepgen.N.position-fb increasing each rotation which affect axis-c feedback. To avoid this issue I use stepgen.N.position-reset true. Ok from velocity I could switch to rotation and somehow make rotations. But when I finish rotation, I cannot switch to "Spindle Velocity", because axis C trying to save current rotation degrees.
So right now, to be honest, I have no idea how it should work and I need advice and help
I have a feeling that I went in the wrong direction and am trying to make a configuration work that should not work in principle. Here is my vision of how it should work:
1. Spindle Velocity mode + switch off sync AxisC/joint (like stepgen.N.position-reset)
2. Spindle Position mode (without changing scale, accel, vel, pid etc... because this is the same motor, the same signals, just change machine units from RPM to degrees), enable sync AxisC/joint and stepgen
3. Switch back to Velocity mode + switch off sync Axis C/joint again by resetting current pos and pos-fb
4. Repeat
- Mesa 7i95T
- Servo for Spindle AND Axis C (one physical servo)
- Lathe
I want to make rotation on the spindle to some degree to do another work with the milling/drilling, then turn to lathe work and so on. For now, lets assume that I have a 1:1 ratio between Servo and Spindle (1000 rpm Servo == 1000 rpm Spindle, 15 degree Servo = 15 degree Spindle)
From my point of view, I chose Dir/Step for both jobs (speed/velocity and rotation/position, next velocity and position modes).
PncConf doesn't work because for new Boards all pins have another naming convention. Mesa support can't help. Only suggest configuring the already existing board in PncConf and "fix ini/hal files to 7i95t somehow".
MecaCT doesn't work because the spindle tab doesn't work at all (firmware PWM could help, but this is not what I chose: step/dir). So I have to make INI and HAL files from scratch.
I did spindle config via pid + motion.spindle AND axisC via joint+pid and both of them use the same hm2_7i95.0.stepgen.N
BUT
1. I'm not sure to use PID in both spindle modes (velocity and position)
2. I'm confused that PncConf generates (that was my manual for linear/angular settings) all configs with stepgen.control-type = 1 (which is velocity mode according to the manual)
3. I think that position mode (really stepgen position mode) could be used only in 1:1 ratio for rotation. In another case we have a ratio in screw. So our goal is not to rotate 50 degrees on Motor level, but to move to 2.125mm in XYZ or rotate somewhere in CNC. So LinuxCNC calculates how many pulses/steps we need to move in one direction to 2.125mm with speed X (how fast we need to be at 2.125mm)
1+2+3 = LinuxCNC used stepgen velocity mode for linear and angular axis. Am I correct? So from the customer's perspective there is a difference between positions for ** degree, and moving for ** mm, but from LinuxCNC this is all about pulse count if frequency (Infinite/Finite Number of Pulses). For Spindle use Infinite.
So my Servo motor has 10.000 pulses for 1 rotation. For "spindle velocity" mode it means 10.000 pulses per 1 motor rotation (in cases of 1:1 ratio 1 Spindle rotation). So machine unit = one rotation. So SCALE 10.000 for 1 unit. In case of rotation, machine unit = 1 degree. So SCALE became 10.000/360 = ~28 steps. So here we have different settings for the same stepgen. Also question maxvel and maxaccel, ff0, ff1, pid?
BUT I have problem with switching between two modes.
When the spindle is working, stepgen.N.position-fb increasing each rotation which affect axis-c feedback. To avoid this issue I use stepgen.N.position-reset true. Ok from velocity I could switch to rotation and somehow make rotations. But when I finish rotation, I cannot switch to "Spindle Velocity", because axis C trying to save current rotation degrees.
So right now, to be honest, I have no idea how it should work and I need advice and help
I have a feeling that I went in the wrong direction and am trying to make a configuration work that should not work in principle. Here is my vision of how it should work:
1. Spindle Velocity mode + switch off sync AxisC/joint (like stepgen.N.position-reset)
2. Spindle Position mode (without changing scale, accel, vel, pid etc... because this is the same motor, the same signals, just change machine units from RPM to degrees), enable sync AxisC/joint and stepgen
3. Switch back to Velocity mode + switch off sync Axis C/joint again by resetting current pos and pos-fb
4. Repeat
Last edit: 25 Aug 2024 12:11 by ustaL.
Please Log in or Create an account to join the conversation.
24 Aug 2024 21:15 #308559
by PCW
Replied by PCW on topic Spindle Step/Dir and as C axis one the same Servo
Probably easiest to use a Mesact configuration for a 7I95/7I95T to start with
so you have the basics setup. (AFAIK pncconf doesn't know the 7I95/7I95T)
You need a PID for the position mode so I would just setup the spindle as a C axis
as normal for a step/dir system which includes the PID. Next the actual stepgen velocity
command is selected by a mux component to come from either the PID output
(C Axis mode) or directly from the spindle speed command (rescaled appropriately)
The trickiest part is changing modes from spindle to C Axis, this probably requires
homing to index. This can be done without an encoder as long as you have an
index signal, and the proper (step/dir index) firmware.
so you have the basics setup. (AFAIK pncconf doesn't know the 7I95/7I95T)
You need a PID for the position mode so I would just setup the spindle as a C axis
as normal for a step/dir system which includes the PID. Next the actual stepgen velocity
command is selected by a mux component to come from either the PID output
(C Axis mode) or directly from the spindle speed command (rescaled appropriately)
The trickiest part is changing modes from spindle to C Axis, this probably requires
homing to index. This can be done without an encoder as long as you have an
index signal, and the proper (step/dir index) firmware.
Please Log in or Create an account to join the conversation.
24 Aug 2024 23:12 #308563
by ustaL
Replied by ustaL on topic Spindle Step/Dir and as C axis one the same Servo
Done. Done. Done.
Change Spindle to C -> Done.
Problem with C to Spindle, because I have left some signals in stepgen-pos and stepgen-pos-fb. And if I change smth -> joint 2 error, because pid thinking (for example value eq 150), and I change it to zero.
BUT, next hack works (but I don't use this hack).
1. Spindle 1000 RPM
2. Stop spindle (m5)
3. Switch to Axis C (disable reset stepgen.pos and stepgen.pos-fb, so they are 0, but active)
4. Rotate what ever (stepgen.pos and pos-fb have, for example, 150.0)
5. Revers axis C to 0.0 (less than max error)
6. Change velocity source of signal (from C to Spindle) (mux2)
7. Stop updating the joint C pos and pos-fb (mux2)
8. Change stepgen maxvel, maxacccel, scale
9. Enable stepgen.position-reset -> true
So in general for joint (axis C)
- rotate for 150, 50 times, whatever
- move back to 0
....(here is spindle on again) but according to pos-fb we are at zero (because postion-reset)
Commands 3-9 in both directions I move to two separate custom M commands.
So will be nice to avoid changing the stepgen settings.
Also, I think a better solution exists.
I think tomorrow I should add settings to the first message to better understanding (to late for today).
Change Spindle to C -> Done.
Problem with C to Spindle, because I have left some signals in stepgen-pos and stepgen-pos-fb. And if I change smth -> joint 2 error, because pid thinking (for example value eq 150), and I change it to zero.
BUT, next hack works (but I don't use this hack).
1. Spindle 1000 RPM
2. Stop spindle (m5)
3. Switch to Axis C (disable reset stepgen.pos and stepgen.pos-fb, so they are 0, but active)
4. Rotate what ever (stepgen.pos and pos-fb have, for example, 150.0)
5. Revers axis C to 0.0 (less than max error)
6. Change velocity source of signal (from C to Spindle) (mux2)
7. Stop updating the joint C pos and pos-fb (mux2)
8. Change stepgen maxvel, maxacccel, scale
9. Enable stepgen.position-reset -> true
So in general for joint (axis C)
- rotate for 150, 50 times, whatever
- move back to 0
....(here is spindle on again) but according to pos-fb we are at zero (because postion-reset)
Commands 3-9 in both directions I move to two separate custom M commands.
So will be nice to avoid changing the stepgen settings.
Also, I think a better solution exists.
I think tomorrow I should add settings to the first message to better understanding (to late for today).
The following user(s) said Thank You: PCW
Please Log in or Create an account to join the conversation.
24 Aug 2024 23:56 #308564
by PCW
Replied by PCW on topic Spindle Step/Dir and as C axis one the same Servo
To avoid the following error you can loop-back the joint position command to the joint position feedback
(at least when in spindle mode or changing modes)
(at least when in spindle mode or changing modes)
Please Log in or Create an account to join the conversation.
- Masiwood123
- Away
- Platinum Member
Less
More
- Posts: 324
- Thank you received: 77
25 Aug 2024 18:55 #308626
by Masiwood123
Replied by Masiwood123 on topic Spindle Step/Dir and as C axis one the same Servo
do you have a servo driver that can work in two independent modes step/dir (position), and analog input (velocity mode)? take a look at the video, I did it by introducing ``A `` as standard axis for changing the position, and the motor rotates like a classic lathe through the gcode M3 ``S``command by analog signal.
Please Log in or Create an account to join the conversation.
- besriworld
- Offline
- Elite Member
Less
More
- Posts: 239
- Thank you received: 66
25 Aug 2024 20:39 #308631
by besriworld
Replied by besriworld on topic Spindle Step/Dir and as C axis one the same Servo
The setting of the Pid regulator seems not good
Please Log in or Create an account to join the conversation.
29 Aug 2024 22:30 #308984
by ustaL
So if you have tips how I could switch back to Velocity mode without rolling back to pos-cmd == 0.0 -> please give an advice.
How to fix out of sync joint/pid.a-axis pos-cmd with stepgen, when spindle/pid.spindle works with the same stepgen. I feel it looks like the problem should be resolved in 1-2 rows in HAL/INI file.
Replied by ustaL on topic Spindle Step/Dir and as C axis one the same Servo
I saw your lathe. Yes, my servo could work with analog and step/dir. But my board 7i95T hasn't analog output. But this is not a problem (my spindle works via S3, M codes fine). Main issue for now is "when the spindle rotates in velocity mode pos-cmd change (stepgen module) it's value, but axis A (joint and pid modules) have old one". From LinuxCNC perspective Axis A have no action, but stepgen "somehow" changed it's position (because there is another module spindle and spindle.pid who send commands for velocity). To avoid this issue I'm making reset BEFORE using Axis A, and rotate to 0.0 AFTER using Axis A (so stepgen pos-cmd became 0.0, joint became 0.0, pid.a became 0.0). Then I making reset (block pos-cmd to change it's value) and start working with Spindle (velocity mode). So only in this case pid.a == joint == stepgen.pos-cmd == 0.0 EVEN is stepgen is rotating via Spindle commands.do you have a servo driver that can work in two independent modes step/dir (position), and analog input (velocity mode)? take a look at the video, I did it by introducing ``A `` as standard axis for changing the position, and the motor rotates like a classic lathe through the gcode M3 ``S``command by analog signal.
So if you have tips how I could switch back to Velocity mode without rolling back to pos-cmd == 0.0 -> please give an advice.
How to fix out of sync joint/pid.a-axis pos-cmd with stepgen, when spindle/pid.spindle works with the same stepgen. I feel it looks like the problem should be resolved in 1-2 rows in HAL/INI file.
Please Log in or Create an account to join the conversation.
30 Aug 2024 00:46 #308996
by PCW
Replied by PCW on topic Spindle Step/Dir and as C axis one the same Servo
I would always leave the stepgen in velocity mode
and use a mux component to switch the source of the
stepgen velocity command from the PID output (C mode)
to commanded spindle speed (spindle mode)
Then a change to velocity mode is trivial. To maintain
position reference when changing back to C mode, you likely
need to home the C axis to index. Does the spindle have an encoder?
If not, a single index input will do if you have 7I95T firmware
with Step/Dir index (7i95t_sdid.bin)
and use a mux component to switch the source of the
stepgen velocity command from the PID output (C mode)
to commanded spindle speed (spindle mode)
Then a change to velocity mode is trivial. To maintain
position reference when changing back to C mode, you likely
need to home the C axis to index. Does the spindle have an encoder?
If not, a single index input will do if you have 7I95T firmware
with Step/Dir index (7i95t_sdid.bin)
Please Log in or Create an account to join the conversation.
- Masiwood123
- Away
- Platinum Member
Less
More
- Posts: 324
- Thank you received: 77
30 Aug 2024 08:45 #309013
by Masiwood123
Replied by Masiwood123 on topic Spindle Step/Dir and as C axis one the same Servo
I don't know how linuxcnc can bypass the count of Axis since it uses the same step generator for two modes. I believe it can, that's more a question for professionals, from my point of view I'm not very far from ``pncconfig``-. in my case, i bypassed it with only one relay that changes the mode on the driver via the M command M64, M65. but since you don't have an analog output, unfortunately really don't know how to help.
Please Log in or Create an account to join the conversation.
30 Aug 2024 18:34 #309038
by ustaL
Example: spindle mode -> axis mode -> rotate to 300 degrees -> enable spindle with MDI command
How it works now: spindle mode -> axis mode -> rotate to 300 degrees ->rotate back to 0.0 -> enable spindle with MDI command
For the first mode change Spindle to Axis I'm, disabling (stepgen.position-reset = true). It mean that nothing happen with stepgen.position-fb (it be 0.0 instead of rotation count). So when I'm enabling Axis with joint.pos-fb == 0.0 everything is fine. But I can't do it twice OR I need somehow set stepgen.position-fb to zero with joint.pos-fb before enable Spindle mode.
Replied by ustaL on topic Spindle Step/Dir and as C axis one the same Servo
That's correct. And I'm asking if is it possible not to take any action and just enable Spindle.Then a change to velocity mode is trivial. To maintain
position reference when changing back to C mode, you likely
need to home the C axis to index. Does the spindle have an encoder?
Example: spindle mode -> axis mode -> rotate to 300 degrees -> enable spindle with MDI command
How it works now: spindle mode -> axis mode -> rotate to 300 degrees ->rotate back to 0.0 -> enable spindle with MDI command
For the first mode change Spindle to Axis I'm, disabling (stepgen.position-reset = true). It mean that nothing happen with stepgen.position-fb (it be 0.0 instead of rotation count). So when I'm enabling Axis with joint.pos-fb == 0.0 everything is fine. But I can't do it twice OR I need somehow set stepgen.position-fb to zero with joint.pos-fb before enable Spindle mode.
Please Log in or Create an account to join the conversation.
Time to create page: 0.085 seconds