This is a video showing an example script commanding the manipulator to move in the x directions in specific increments. It is controlled by a closed loop feedback PID controller. This controller allows for the ability to accurately command and execute a serious of precise fixed movements.
Simulink model showing the PID closed loop feedback controller.
Instead of controlling the angular displacement of the servo via the duration of a pulse with a specified width, the angle of the servo was controlled via a closed loop position controller that utilized the feedback signal wire. The primary performance requirement of this controller is to minimize steady-state error. Transient performance is of much less interest.
Angular Position Response of Servo
Through the use of the above PID controller, we were able to control the angular position of the servo within roughly 3° with reasonable transient performance. The actual transient performance of the position controller was not evaluated.
MATLAB Selection of Single Point and Displaying Pixel Coordinates
A MATLAB script was written that takes a snapshot of the current video feed. The user can then click anywhere on the image and the pixel coordinate location is output. Ultimately, the user can use this method to find the displacement in pixels between the current location of the end effector and an arbitrary target location.
MATLAB calculation of the Pixel Distance Between Points
Additionally, MATLAB has a built-in image viewer app. Within this app the user can measure the pixel distance of a line that was drawn. This is a more direct method of finding the displacement between two points.
Automatic Detection of Corner Points
MATLAB’s detectharrisfeatures function is utilized to automatically detect the tick marks on the ruler. This function detects corners in a 2D image using the Harris–Stephens algorithm and returns cornerPoints objects. This algorithm is a generic method of detecting the tick marks on the ruler for us to measure the distance between these corner points.