# Visual servoing: simple control law

The problem

I have a control scheme like the one in the image attached below (Source: Robotics, Vision and Control Fundamental Algorithms In MATLAB®, Peter Corke). But instead of a robotic arm, I have a pan/tilt head.

I am not sure what control law of the outer loop (IBVS controller) should I use. The input of this controller is the visual error in pixel units (in my case, the error is the difference between the image center and the centroid of the object of interest), and the output is the commanded position set-point of the inner loop. Notice that the output (set-point of the inner controller) is an absolute angular position, it is not a velocity or an angular variation / increment.

What I have tried

Like in this thread: Determining transfer function of a PTU for visual tracking I chose a simple proportional controller. However, I noticed that the output of this controller is an angular variation instead of an absolute angular position.

To solve this problem, I added the previous angular variation to the current angular variation. This way, the resulting position is an absolute angular position and can be properly interpreted by the inner loop.

Is this approach the same as using a PI? I mean, the strategy of adding angular increments is equivalent of using the integral term of a PI controller? Am I using an incremental PID or a positional PID, or a mixture of both? What am I exactly doing? I cannot find any papers that use this approach, most of them use a velocity control.

Results

The following results, for a proportional gain of 0.0004, where obtained. As it can be seen, there is no steady state error (even though I used only a P controller).

Another thing that bothers me is that the commanded tilt angle has a harder time reaching the steady state than the pan angle. Same behaviour is observed for smaller gains. Any idea why does this happen only in one angle?

What you have implemented is a sort of proportional velocity controller. In turn, this controller can be seen as a pure integral position unit. The presence of the integral explains why you're able to reach for the setpoint with no steady-state error.

I can argue that it is somehow expected that the tilt joint responds slightly worse than the pan joint with the same controller's gain. In fact, the motor actuating the tilt needs to counteract the gravity, whereas the pan actuation is usually transparent to gravity. However, to confirm this hypothesis, one should have a look at the physical assembly of the camera.

No worries though, you ought only to tune up the tilt gain to achieve better performance. Also, inserting a derivative term can help you dampen the initial snap overshoot.