I know that we can use some algorithms like LQR, MPC, or even PID to make the robot follows the trajectory references. In the simulation like MATLAB, I usually specify the trajectory reference by a function. Let say, given a sequence of points generated by a path planning algorithm, then I want to do a real experiment of trajectory tracking over those sequence of points. My question is: - How to specify the errors towards the path in real situation. My impression is the generated path by path planning algorithm is uncertain due to the error of the robot sensing. And unlike the line following robot which has a real physical line for the reference, the generated path from path planning is virtual, e.g. it does not exist in the real world. I am really confused about these matter.
The error needs always to be computed against some physical quantities that can be measured, otherwise it makes no sense in practical scenarios. It is thus expressed as $e=r-y$, where $r$ is the reference whereas $y$ accounts for the measured feedback (I have used the typical notation of a control scheme).
The feedback $y$ can be the outcome of direct measurements provided by the sensors (e.g. the encoders of the wheels of the line-follower robot) or an estimation of different quantities resulting by applying a model to those actual measurements (e.g. the prediction of the 2D position of the robot on the floor given by the integration of the wheels encoders).
Similarly, the reference $r$ can also result from a direct observation of the reality (e.g. it can be the line to track as acquired by the robot's sensors) or from a plan designed to attain a task. An example of the latter context is the planning used to move the robot from the initial position A to a target position B in the 2D world. This reference can be a simple line (virtual one) connecting A to B or a more complex path (still virtual) if we are in the presence of obstacles. Here the task is to reach B, not to follow any specific line that exists traced on the floor.
From a control standpoint, there is no difference whether $r$ is "real" (i.e. measured) or "virtual" (i.e. planned). The central point is that the reference and the feedback need to be consistent between each other, meaning that they must account for the same physical quantities expressed in the same units: if $y$ is the wheels speed in [deg/s], then $r$ cannot be a spatial position in [m].