# PID with position and velocity goal?

I'm trying to design a control system for a robot that tracks moving object. Thus I want to robot to match the position and velocity state of the object. I don't want robot to simply to arrive at the position, but I want to arrive at the position with the same velocity of the object.

Object velocity and position data will be provided externally.

I'm not sure if a traditional PID controller (with velocity controls) with just a position based error is enough. Wouldn't position only state goal result in tracking that is always lagging behind?

Is PID what I want or should I be looking at something else like trajectory controls?

In the case of MIMO systems (Multi-Input, Multi-Ouput), my warm suggestion is to go with State Space Control, which will give you enough freedom to move the closed-loop poles and thus achieve your control requirements. One viable solution, explored quite a lot in literature, is to employ a LQR controller coupled with a state observer, where here the state is obviously composed of position and velocity.

With regards to the use of a simple PID, I believe these two following questions are very much related:

If in fact you need the robot to be at the same speed as the tracked object at the time it arrives with it, you might need to employ more sophisticated methods. However, a controller that is the correct type will achieve asymptotically 0 tracking error on position (implying zero error on velocity by extension). Type is the amount of integrators in your controller. Now if your object you will be tracking is moving linearly, you need a type 1 controller. If it is changing its speed as well as its position (up to quadratic paths), you need a type 2 controller. My point is that if you know the constraints on the motion of the object you're tracking, and your specifications are that you must asymptotically approach the velocity and position of your object, you may be able to get away with employing a PID controller + integrator, which would look something like this: $$\frac{k_{d}s^2+k_{p}s+k_{i}}{s^2}$$

or this:

$$\frac{k_{d}s^2+k_{p}s+k_{i}}{s^3}$$

Careful though, these integrators can make your system unstable. You can test in Matlab.

• This answer contains nice arguments on the required controller's type. Commented Jun 20, 2016 at 12:14

In many cases, a single traditional PID controller is adequate to track an object and match both position and velocity of the object. With the error term of the PID in terms of position, the integral term ("I" of the PID) and the derivative term (the "D" term in the PID) each help compensate for the velocity of the object.

No matter what control system you use, if the object makes a sudden unexpected movement, the tracking will lag behind -- that's part of the nature of our causal universe. (Please tell us if there are any, even completely infeasible, ways of eliminating all lag from an object tracker).

There are various feedforward approaches that can reduce (but never eliminate) the lag in a PID controller. In your case, rather than the (traditional, error-amplifying) approach that makes D proportional to the derivative of the position error, you may have less lag by directly measuring the speed of the object and the speed of your tracker and setting D proportional to their difference. (Or perhaps proportional to the speed of the object alone).

If you want the tracker to arrive at the velocity of the object at the same instant that it arrive at the position of the object, then you want a control system "without overshoot". There are lots of applications that require such a control system, and PID control systems can be tuned such that they have no overshoot after a step impulse. (You probably already know that most PID control systems are tuned using a different critera that allows some overshoot and oscillation in order to reduce the lag in settling time; people using such systems use the term "overdamped" to describe settings that have no overshoot).