# After planning a path, how do I ensure the robot is following the planned path?

After planning a path using a path-planning algorithm, e.g. RRT* or A* how do I ensure the physical robot is actually following the planned path?

After doing some research, I've come across Craig Reynolds' path-following algorithm.

However, given a fixed-size arena how do I know where the location of my robot in the arena and that it is about to traverse out of the path? I would imagine some sort of triangulation/gps is needed to know the location of the robot, am I right?

The robot we are given for this project is a 4 four-wheel steering robot that cannot rotate on the spot (non-differential drive). In addition, we only have infrared sensors and a camera.

Is there any way to make the robot follow the planned path with high accuracy? The planned path has some steering angles.

• I don't have time to write a full answer, so I will just leave a comment. But what you are describing sounds like it can be solved really well using feedback control, such as a PID controller. Sep 27 '21 at 14:00

This problem can be solved by various types of controllers.

Firstly, I would suggest you to create intermediary points in between two consecutive points your Path Planning Algorithm calculates. Try to make the intermediary points frequent. The frequency of these intermediary points will also define the movement characteristic of the robot (agressive, slow but steady...). That, way you are going to have a trajectory for your robot to follow.

Then the most basic Controller type you can try would be a classical PID Controller. A PID controller will iteratively calculate the configuration error of your robot (position, and/or orientation), and then create control signals for your robot by multiplying, differentiating, and integrating this error. I will check my sources and may add some resources/articles for you to look.

Sometimes a PID Controller may not perform well. Given your robot type, you may need to try different Controller Algorithms, maybe you can look at some simpler methods; such as Stanley, Pure-Pursuit Controller.

For the precise detection of the robot location; this a gigantic area, with many different methods and approaches. You can use IMU sensor's accelerometer data to calculate the linear acceleration of the vehicle (be careful; the data you read directly from the accelerometer is not the pure linear acceleration), then double integrate it to have the position. Be warned that result of this operation will be nowhere near accurate. You may search for how to fuse different sensors' reading to improve this data. Or, if you have a small arena for your robot; you may use a LIDAR-like sensor or maybe a camera, which can perform precise localization.

As I mentioned, both localization and control fields have many different methods which vary in computational need. If you are new to this field, I would recommend you to study PID Controllers first.

With problems like this, you will need apriori knowledge of your operating area. Since you know that it is a fixed-size arena, you could build a map and use localization within the map to know where you are / if you stray away from your path. There are several visual methods to create such a map. I'd suggest you start with ORB_SLAM.