VMC related HAL questions.
Going to try your component now.
I can't get spindle cw/ccw to cooperate though. No matter if I invert encoder rotation, switches the motor leads, edits the ini the spindle always speeds up from commanded speed. Any ideas?
Please Log in or Create an account to join the conversation.
It should start rotating, then stop when it gets to the correct angle. Are you saying it rotates continuously?I commented out that line and now it rotates when i write "M19 R0 Q5"
This might be part of the same problem.I can't get spindle cw/ccw to cooperate though. No matter if I invert encoder rotation, switches the motor leads, edits the ini the spindle always speeds up from commanded speed. Any ideas?
What happens if you start the config then open a ternimal:
halcmd -kf
unlinkp hm2_5i25.0.7i77.0.1.analogout5 (this is so you can set it manually)
setp hm2_5i25.0.7i77.0.1.analogout5 500 (should be 500 rpm forward)
setp hm2_5i25.0.7i77.0.1.analogout5 -500 (should be 500 rpm reverse)
net spindle-vel-cmd hm2_5i25.0.7i77.0.1.analogout5 (back to as you were)
exit
Please Log in or Create an account to join the conversation.
Tried those commands and it rotates the correct way.
I installed the component, edited the "spindle.hal" file and got no errors on startup.
Added two screenshots, about 1min between them.
I'll also attach spindle.hal if I might have screwed something up in there. Commented all lines containing "near"
Please Log in or Create an account to join the conversation.
Yes, it rotates until it times out
Tried those commands and it rotates the correct way.
Does the encoder count the correct way. ie for forward rotation do the encoder counts increase?
The actual counts don't matter so much, but the "position" needs to increase by 1.0 per revolution forwards and decrease backwards. If it counts the wrong way then negate the encoder scale.
If you look in Halscope and the PID error is increasing then that is a give-away that the PID and the encoder disagree about which way is forwards.
Please Log in or Create an account to join the conversation.
The pid error goes up under acceleration but then it's straight as an arrow.
One thing comes to mind, the spindle drive I have has a built in compensation function that might screw things up?
Or no, it should not matter as the pid should just decrease the output if the drive tries to increase the speed.
If I increase P in the ini-file then it starts at a higher rpm than requested and still slowly climbs up.
Please Log in or Create an account to join the conversation.
Don't know if you saw in the screenshots that the spindle turns about 6times the requested speed. S60 = 380rpm
EDIT: Also, "orient.0.angle" & orient.0.position" is always 0. I would thing one of them should be actual angle of the spindle?
Please Log in or Create an account to join the conversation.
Tried I = 0 & ff0 = 0 and then the pid value stays the same as do the rpm's
Don't know if you saw in the screenshots that the spindle turns about 6times the requested speed. S60 = 380rpm
EDIT: Also, "orient.0.angle" & orient.0.position" is always 0. I would thing one of them should be actual angle of the spindle?
While testing you might have to M5 to get motion.spindle-orient to go to zero so that the orient comp can calculate a new angle.
Spindle too fast seems to mean that your [SPINDLE]OUTPUT_SCALE is wrong. That should be the spindle speed at 10V command signal.
You said that spindle pos increases by 1 for forwards. Does it decrease backwards?
I have absolutely no idea what is going on any more. Do the PID command and feedback numbers make any sense?
The problem is probably these two lines
net spindle-vel pid.0.feedback # & encoder.3.velocity for a real machine
...
net spindle-vel-fb <= hm2_5i25.0.encoder.03.velocity
You need to be consistent in the signal naming. If you want to use spindle-vel-fb then use it everywhere.
Also, the position pid has no feedback either, so that is why that isn't working:
#net spindle-pos pid.1.feedback orient.0.position near.0.in1 # & encoder.5.position for a real machine
#net spindle-pos-cmd orient.0.command pid.1.command near.0.in2
You have commented out the command _and_ the feedback to the position PID. Just delete the "near" stuff, don't comment out the rest of the net, that is needed.
Elsewhere in the code you are using "spindle-revs" for the spindle position, so be consistent with that again here.
Please Log in or Create an account to join the conversation.
Output scale is the same as before all closed loop testing, and then it was pretty close to requested.
Yes, it decreases if I turn it ccw.
I've not written any lines in that hal file myself, at best I copy/paste, edit or remove the lines you tell me to
So it should be "spindle-vel" and not "spindle-vel-fb" ?
I commented those lines because they contain "near.0" Didn't understand that I just should remove the near part of the line.
I will continue tomorrow as it's getting quite late here now
Please Log in or Create an account to join the conversation.
The PID components both believe that the system is at zero position and zero velocity, so there is no surprise that they are not working.Output scale is the same as before all closed loop testing, and then it was pretty close to requested.
Well, yes, but you need to try to understand what you are pasting, especially when combining two different HAL files.I've not written any lines in that hal file myself, at best I copy/paste, edit or remove the lines you tell me to
Whichever makes the most sense to you, it is your HAL file and you can call signals (the first thing after "net" anything you like. kara-nopeus-palaute would be fine too.So it should be "spindle-vel" and not "spindle-vel-fb" ?
Please Log in or Create an account to join the conversation.
I understand that "net" connects "signals" to each other. But is there no difference in what order they come in the file?
To me this seems the most logical way to do it.
Example:
net spindle-vel <= hm2_5i25.0.encoder.03.velocity
net spindle-vel => motion.spindle-speed-in
net spindle-vel pid.0.feedback
Also,
M3 S500 = 5V
M3 S1000 = 10V
But in my previous config that was pretty much spot on, S500 = 1V, S5000 = 10V.
I'll attach my hopeless little hal file and hope that the gurus of this forum has the time to check it out.
Please Log in or Create an account to join the conversation.