W5100S-EVB-PICO stepgenerator and encoder driver

More
1 year 3 months ago - 1 year 3 months ago #332645 by PCW
The issue with the sampling speed has to do with velocity calculations,
mainly at lower speeds or lower resolution encoders:

Imagine you have a 1000 count (250 PPR) encoder turning at 30 RPM (= 0.5 RPS so 500 Hz count rate)
If sampled at LinuxCNCs standard 1 KHz rate, you would get 1 count every other
sample, since the most basic velocity calculations would use the difference in counts to determine
the velocity, the velocity calculation would alternate between 0 RPM (count change of 0) and 60 RPM
(count change of 1). At higher speeds the problem gets better but does not go away, at 90 RPM
with the same encoder/sample rate, you would get alternating counts of 1 and 2 so alternating
velocity calculations of 60 and 120 RPM.

You can of course filter the velocity value since the average value will be correct, but this is not desirable
if the velocity is used for feedback as it lowers the control bandwidth.

The normal way  this is improved is by velocity estimation, which changes the velocity calculation from
delta_counts/sample_time to delta_counts/time_between_counts. This typically requires that the low level
hardware timestamp count changes to allow the time_between_counts to be determined.

Once you have decent velocity estimation, you can do tricks like position interpolation, allowing
use of very low resolution encoders for constant speed spindle synchronized motion like threading.
Last edit: 1 year 3 months ago by PCW.
The following user(s) said Thank You: atrex77

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

More
1 year 2 months ago #332648 by atrex77
Thank you PCW, now everything is clear and understandable. I think i solve this purely on the Pico side.

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

More
1 year 2 months ago #332650 by tuxcnc

The normal way  this is improved is by velocity estimation, which changes the velocity calculation from
delta_counts/sample_time to delta_counts/time_between_counts.
It is true, but not solution for G33.1
In most worst case, the spindle stops, but the component waits for next pulse from encoder...
I have for tests small lathe with servo as spindle engine (velocity mode). It can stops (from 1500 to 0 rpm) at about 100 ms. (This is especially intended for fast G33.1)
In my opinion, the best is use high resolution encoder, and average speed from a 8 or 16 servo_thread periods.
Some cheap chinese encoders has bandwith 100-150 kHz, so in most cases 2500 P/R will be good.
But there is another problem. In my project I use STM32 with hardware quadrature counter, so this uses interrupts only for counter overflows.
Chips with no hardware quadrature counter must use interrupts for every encoders edges, it means hundreds of thousands interrupts per seconds, so it is very bad idea...

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

More
1 year 2 months ago #332651 by PCW
Velocity estimation is unrelated to G33.1 as G33.1 only looks at position.

If you do position interpolation, it's only for threading (Constant speed)

Also, as I mentioned, you need hardware timestamp support for velocity estimation.

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

More
1 year 2 months ago #332655 by tuxcnc

Velocity estimation is unrelated to G33.1 as G33.1 only looks at position.
 
It is not true.
Tool moves while spindle stops, even if position is reached.

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

More
1 year 2 months ago - 1 year 2 months ago #332656 by PCW
Sorry , I guess you are right, G33.1 also looks at the spindle speed 
But this works better with good velocity estimation, Though as I mentioned
you cannot use position interpolation except for constant speed applications
like threading on a lathe.

This is wrong because the TP does use the velocity value:

It is precisely true, LinuxCNCs TP only looks at the encoders position
in G33.1 moves. There is no other information path.


Looking a bit more into this, It does not look like the encoder velocity
( spindle.spindle_num].spindleSpeedIn ) is used for position mode synchronized
moves (G33 G76 etc) but only velocity mode synchronized moves (G95).
At least with a quick look at  tp.c 
 
Last edit: 1 year 2 months ago by PCW.
The following user(s) said Thank You: tommylight

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

Moderators: PCW, jmelson
Time to create page: 0.078 seconds
Powered by Kunena Forum