A system comprising: a memory storing instructions; and at least one controller configured to execute the instructions to cause the system to, and obtain an estimated speed (ω obs) of an electric machine and an estimated position (Θ obs) of the electric machine, characterized in that the controller is configured to execute the instructions to cause the system to obtain a measured speed (ω mea) of the electric machine and a measured position (Θ mea) of the electric machine based on an output from a sensor select an observer based on a speed value, obtain the estimated speed (ω obs) of the electric machine and the estimated position (Θ obs) of the electric machine using the selected observer, J determine a first residual representing an error between the filtered estimated speed and a rotor speed command, determine a second residual based on the measured position (Θ mea), wherein the second residual is maintained if there is no change in the measured position and the second residual is incremented if the difference between a speed command and the filtered estimated speed is greater than zero and the speed command is greater than zero, and compare the first residual with a third threshold and the second residual with a fourth threshold to identify a sensor failure if both residuals (N M) exceed the respective threshold, determine a control output based on the measured speed (ω mea) and the measured position (Θ mea), the control output being the measured speed (ω mea) and the measured position (Θ mea) or, once a sensor failure is identified, the estimated speed (ω obs) and the estimated position (Θ obs), and control the electric machine using the control output. a memory storing instructions; and at least one controller configured to execute the instructions to cause the system to, and obtain an estimated speed (ω obs) of an electric machine and an estimated position (Θ obs) of the electric machine, characterized in that the controller is configured to execute the instructions to cause the system to obtain a measured speed (ω mea) of the electric machine and a measured position (Θ mea) of the electric machine based on an output from a sensor select an observer based on a speed value, obtain the estimated speed (ω obs) of the electric machine and the estimated position (Θ obs) of the electric machine using the selected observer, J determine a first residual representing an error between the filtered estimated speed and a rotor speed command, determine a second residual based on the measured position (Θ mea), wherein the second residual is maintained if there is no change in the measured position and the second residual is incremented if the difference between a speed command and the filtered estimated speed is greater than zero and the speed command is greater than zero, and compare the first residual with a third threshold and the second residual with a fourth threshold to identify a sensor failure if both residuals (N M) exceed the respective threshold, determine a control output based on the measured speed (ω mea) and the measured position (Θ mea), the control output being the measured speed (ω mea) and the measured position (Θ mea) or, once a sensor failure is identified, the estimated speed (ω obs) and the estimated position (Θ obs), and control the electric machine using the control output. obtain a measured speed (ω mea) of the electric machine and a measured position (Θ mea) of the electric machine based on an output from a sensor select an observer based on a speed value, obtain the estimated speed (ω obs) of the electric machine and the estimated position (Θ obs) of the electric machine using the selected observer, J determine a first residual representing an error between the filtered estimated speed and a rotor speed command, determine a second residual based on the measured position (Θ mea), wherein the second residual is maintained if there is no change in the measured position and the second residual is incremented if the difference between a speed command and the filtered estimated speed is greater than zero and the speed command is greater than zero, and compare the first residual with a third threshold and the second residual with a fourth threshold to identify a sensor failure if both residuals (N M) exceed the respective threshold, determine a control output based on the measured speed (ω mea) and the measured position (Θ mea), the control output being the measured speed (ω mea) and the measured position (Θ mea) or, once a sensor failure is identified, the estimated speed (ω obs) and the estimated position (Θ obs), and control the electric machine using the control output.