# Estimating angular speed from position for control purpose

I am new to robotics, however I am designing a PID to control the angular velocity (azimuth, elevation) of a couple of Faulhaber motors. The input to the PID control is the actual angular velocity, which is not observed though, since it is derived from the position of each motor at time $t$.

The PID sample period is aprox. 30 ms, whereas the input data rate from the joystick is aprox. 300 samples/s, corresponding to a sample period of 3.33 ms. The joystick input gets transformed into the desired angle speed, that the PID will control.

I was initially filtering position data using a normal 2D linear Kalman Filter, but the angular velocity is not linear (by formula), hence I switched to Extended Kalman filtering.

My questions are the following:

1. Is this latter approach that makes use of EKF correct?
2. Which are the parameters that I have to check in order to properly set the update rate of the PID loop?

A sample period for the PID of 5-10 ms is usually fine, given the low mechanical cut-off frequency of the motor (higher rates are better, but not required). Then, acquire the joystick at >50 ms.