Arduino Leonardo and linears encoders.

More
23 Jan 2013 01:44 #28981 by casetero
I have to read about the velocity-mode stepgens because is the first time in my life i hear it! I´m mechanic :)

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.

More
23 Jan 2013 02:25 #28984 by andypugh

So i cant make a Closed loop using the actual pulse count command i have now, can i?

You probably can, but it isn't the way I would choose to do it.

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.

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.
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.

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.

You don't need index. That is only useful on rotary encoders.
The following user(s) said Thank You: casetero

Please Log in or Create an account to join the conversation.

More
23 Jan 2013 16:21 #29009 by cncbasher
also see
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 .
The following user(s) said Thank You: casetero

Please Log in or Create an account to join the conversation.

More
23 Jan 2013 23:09 #29029 by casetero
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?

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.

More
24 Jan 2013 00:52 #29032 by casetero
Cncbasher i´ve reading the URL you posted. This show how to enhace the two closed loops to Linuxcnc, doesn´t it?

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.

More
24 Jan 2013 22:00 #29089 by andypugh

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?

Not quite.
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.

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.

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.

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.
The following user(s) said Thank You: casetero

Please Log in or Create an account to join the conversation.

More
25 Jan 2013 01:32 #29097 by casetero
Ok, when the linear scales come i will try to fight with the hal file.

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.

More
25 Jan 2013 01:59 #29099 by andypugh

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....

That seems a bit painful. is there any underlying bit-pattern logic?
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.
The following user(s) said Thank You: casetero

Please Log in or Create an account to join the conversation.

More
25 Jan 2013 19:08 #29128 by casetero
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.

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.

More
25 Jan 2013 20:22 #29129 by andypugh

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.

Normally it would be, but the "comp" HAL component works with float values.
[/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?
The following user(s) said Thank You: casetero

Please Log in or Create an account to join the conversation.

Time to create page: 0.152 seconds
Powered by Kunena Forum