There are a lot of way to get this information, but one of the more simple, is to use an encoder.
On the motors I mounted on my robot (a garage door 24V 18A peak, gear worm reduced), there was an encoder, but was mono directional, in the meaning that it counts only in one way and you cannot know if it is going forward or backward, unless you merge it with the input signal of the motor to know in which way the encoder is going to. Do this job could be quite hard, and unnecessary.
In this way I decide to add to my motors 2 incremental encoder that provide the correct ticks count.
There are a lot of kind of encoders, with the formula more ticks you want per round more you will pay.
After a lot of surfing on the internet , I found a middle way on ebay, that consist in a
OAK GRIGSBY 9 series
that provide me 400 ticks per round with a max of 3000 rpm for less then 10$ each.
The problem now is how to add the encoder to the motor. The first solution I found is remove the gear from the encoder and fix it axially in one of the two motor shaft. The encoder could run up to 3000 rpm and none of the both shaft could go over that threshold.
Thinking on this solution, at least 2 problem remain:
-work on the fast shaft could be quite hard, the material could be heat treatment, and cause the "high" velocity we need to hit the centre of the axle, and in a post tooling could be very stressful and will compromise the correct working of the motor.
-the slow axle is directly fixed on the gear, that provide a little nipple that is used like a axial bearing so make an hole in that point will remove it, and make the motor useless.
Looking better on the slow shaft I see that the "nipple" give enough space to fit in a gear and preserve the part that touch the case.
Mounted the gear on the motor shaft I drilled the little one and fix it on the encoder, after this I cut 3 holes on the metal frame a little larger to fit the encoder.
The gears provide 2 good things that are a little slack between the gear to avoid tooling imprecision, and a ticks multiplier.
This is how the work finally appear.
I'm trying it now and it work perfectly, but I don't know how long could survive.
Thanks to anyone who want to share is opinion or ask something about it.