\section{State Control of Wheelchair}\label{statecontrol}

A finite state machine (FSM) controller was developed using the concept that wheelchair motion is achieved by controlling the left (L) and right (R) wheels separately. Equal L and R values correspond to forward-reverse movement of the wheelchair. A pair of different L and R values produces turning to the left if L is lesser, or right if R is lesser. This is based on the fact that to manoeuvre a turn in a given direction, left for instance, the velocity of the left wheel must be decreased and that of the right increased. A three-state Mealy machine was used to determine L and R values. L and R can take a maximum value of 100 and minimum of -50. \textquoteleft{Stop}' is represented by null values of L and R. In any state, \textquoteleft{Forward}' command causes the mean of the L and R values to be incremented by 25. \textquoteleft{Reverse}' causes the same to be decremented and hence serves the purpose of decreasing the velocity step by step and then proceeding to reverse the wheelchair. While the wheelchair is turning left, \textquoteleft{Left}' causes the L value to be decremented by 10 and the R value to be incremented by 10. If \textquoteleft{Left}' occurs when the wheelchair is turning right, the mean of L and R is changed in the same way. A constraint of this Mealy machine is that the difference between L and R values must not be greater than 40. This condition is handled by preventing commands from being executed that would result in this scenario.