Arduino Leonardo and linears encoders.
So i cant make a Closed loop using the actual pulse count command i have now, can i?
Sorry but i havent fully understand you, when you say an analogue velocity request, are you talking about the velocity request of the linear encoders? Because the linear encoders are digital too. Sorry but i don´t understand why i have to do the pulse train equivalent to an analogue velocity request.
I have used the google translator but as almost always is been not helpfully.
Searching on the web i found that TTL signals were composed by 3 different phases, in this pdf says that the 216 t uses just two.
pdf.directindustry.com/pdf/incat/216-t-4906-14503-_14.html Page 14.
Tomorrow i will read yours. I have to go now.
Maybe my questions to mesanet were too much bad redacted!
Thank you again!
Please Log in or Create an account to join the conversation.
You probably can, but it isn't the way I would choose to do it.So i cant make a Closed loop using the actual pulse count command i have now, can i?
In a typical servo system LinuxCNC uses a PID module to compare where an axis is with where it should be. It then outputs a command signal to move the axis, with the magnitude of the signal related to how fast the axis ought to move. This signal is typically an analogue voltage.Sorry but i havent fully understand you, when you say an analogue velocity request, are you talking about the velocity request of the linear encoders? Because the linear encoders are digital too. Sorry but i don´t understand why i have to do the pulse train equivalent to an analogue velocity request.
With your current system the situation is that a stepgen is told where the axis should be, it compares that position to the current position, and outputs the correct number of pulses to move the motor to that new position.
One way of combining the two systems would be to use a PID controller (which is comparing command position to linear-scale position) to add an offset to the command value before it is passed to the stepgen. But I am not sure that would work very well.
The idea of using the velocity-mode stepgen is that it converts your system into a much more conventional-looking servo system. The PID outputs a velocity command, then the velocity command is passed to the drive as a pulse train. Instead of how _many_ pulses being used to control the servo position in the drive, it is now how _fast_ the position command changes.
You don't need index. That is only useful on rotary encoders.Searching on the web i found that TTL signals were composed by 3 different phases, in this pdf says that the 216 t uses just two.
Please Log in or Create an account to join the conversation.
wiki.linuxcnc.org/cgi-bin/wiki.pl?Combin..._Devices_On_One_Axis
quadrature linear encoders are usualy TTL , and can have 2 or 3 channels (phases) usualy A B I ( the mitutoyo is 2 channel A B ) the I Channel is mostly used with rotary encoders and counts one pulse per rev so in effect it knows it's start point
linear encoders do not need this , as andy mentioned .
Please Log in or Create an account to join the conversation.
And the same for the inputs from the linear scales, i will have to use this method of density pulses too, won´t i?
If you think it will work better with this method i will do it like this. I suposse to make all this stuff i have to program the hal file. Until now i´ve just used the stepconf wizard and make some little programing for enhace a pendant to linuxcnc on the custom_hal.hal but i have to investigate more to know how to change the method for the PID ( position control to velocity control ). Can you give me any advise of where start reading or doing?
So the incremental digital linear scales just work with 2 phases, in TTL mode. The third phase is and index for a rotary encoder to know when it pass through the 0º. Ok
Thank you again!
Regards.
Please Log in or Create an account to join the conversation.
I say this because at the end i don´t want to enhace the two closed loops to linuxcnc, i just want one closed loop to be done by linuxcnc. The one from the linear scales.
The closed loop between servo and drive will be done by the driver but linuxcnc won´t mind about it. I don´t know if i´m explaining good the situation because my english is very poor. Do you understand me?
Thank you.
regards.
Please Log in or Create an account to join the conversation.
Not quite.Ok, so i understand that i can manage my servos not with a count of pulses (position), yes with a density of pulses (velocity). And this will produce a similar analogue voltage control, isn´t it?
And the same for the inputs from the linear scales, i will have to use this method of density pulses too, won´t i?
The linear encoders will provide position information in absolute mm.
The output to the drives would be pulse rate, ie requested velocity.
You nearly always have an "offset" between the controlled parameter and the input in a PID loop. The classic example is filling a tank, where water level is the controlled parameter, and water flow rate is what is adjusted to achieve that.
Yes, this is going to have to be a manual config, though you should probably start with a sample servo config (or a stepconf config) and edit them.If you think it will work better with this method i will do it like this. I suposse to make all this stuff i have to program the hal file.
There are lots of ways that you could try this, luckily it's just software and it is "free" to experiment with different control modes.
Try reading the docs here: www.linuxcnc.org/docs/html/hal/intro.html
And the others in the HAL section here: www.linuxcnc.org/docs/html/
But be aware that these docs are rather about "how" to set up a HAL, not "what" you need.
Your control loop will be:
PID command = axis.N.motor-position-cmd
PID feedback = encoder.N.position (from the scales)
PID output => stepgen.N.command (velocity mode stepgen)
Then you have the fun of adjusting PGain, Igain, Dgain etc.
if you start with a servo config then the iNI file will be set up with Pgain and friends, and that means you can use the Machine=>Calibration utility.
Please Log in or Create an account to join the conversation.
Now i´m fighting with the hal file, but to enhace an USB pendant to linuxcnc. I did it with with a joypad and i have no problem following the instructions of the URL:
wiki.linuxcnc.org/cgi-bin/wiki.pl?Simple_Remote_Pendant
So i bought a USB mill pendant and i´m trying to make the code to enhace it to linuxcnc. The thing is the gamepad used PINS of type bit ( 0 or 1 output), and each button had it own PIN. Now the pendant i´ve bought just uses 4 PINS and they are of type float, u32 o s32.
So now each PINS has many buttons and it depends of its value they are assigned. For example:
Hidcomp.0.PIN1.raw are type s32 and with this pin i can manage many buttons, if i hit first button it shows value 6, if i press second button it shows value 12...
So now i have one PIN for many buttons, and they dont work like bits. Doing the correct programing can i enhace ir correctly to linuxcnc??
The code i´ve seen in the web is just for bit mode working. I know a bit of programing in c++, so i suposse that i have to asign a variable to that pins to keep the value when i press the button. Can i do something like this in Hal code??
Thank you very much.
Please Log in or Create an account to join the conversation.
That seems a bit painful. is there any underlying bit-pattern logic?Hidcomp.0.PIN1.raw are type s32 and with this pin i can manage many buttons, if i hit first button it shows value 6, if i press second button it shows value 12....
it may be that the pendant is trying to produce keyboard scan codes. :-/
I think the way to do this might be to convert the S32 to a float using
www.linuxcnc.org/docs/html/man/man9/conv_s32_float.9.html
Then set up a set of comparators, then use their "equals" outputs as the bit-values to link to halui etc:
www.linuxcnc.org/docs/html/man/man9/comp.9.html
ie
...
net val_as_float conv_s32_float.0.out => comp.0.in comp.1.in comp.2.in comp.3.in
...
with a comp for each button.
Please Log in or Create an account to join the conversation.
So with the command you have posted every time i push a button, it keep the float value in all comps?
Example: I push button 1, that button shows a value of -0.997. So that value will be kept in all comps (comp.0.in, comp.1.in,....) or i have to expecificate the comp i want to keep the value?
The pendant i´ve bought is this one:
If you know any hal file done to this kind of pendant it would be great, because i want to use the LCD too.
Thank you very much.
Please Log in or Create an account to join the conversation.
Normally it would be, but the "comp" HAL component works with float values.Ok, hidcomp creates 4 diferent PINs, and for each PIN 3 diferent type of, and one of them is float. I put you the s32 one because i thought it was the easyer to manage.
[/quote]So with the command you have posted every time i push a button, it keep the float value in all comps?[/quote]Sorry, I am not sure what you mean by "keep" in that sentence.
Can you make a table of values for all pins and all buttons? Perhaps I can figure out the logic.
I had a look a the website, and it is a bit too expensive for me to buy one to experiment with.
Interestingly the "support" section of the salecnc website offers a support file called "Shuttlepro.rar" which might indicate that the internals are from
www.thomann.de/gb/contour_av_solutions_s...W_g7UCFYlb3god1y8AqQ
In which case we have:
linuxcnc.org/docs/html/man/man1/shuttlexpress.1.html
What name does our MPG give itself in HID?
Please Log in or Create an account to join the conversation.