
A common problem in autonomous route planning and controls is to implement efficient motor control, sensor feedback, and route planning algorithms to allow a robot to successfully navigate and traverse a line grid maze from a start point to a different destination point in an efficient manner. We present an E-Puck controller that utilizes ground sensor feedback to perform a variety of functions: detect nodes (cross-sections), detect lines just past nodes, provide Braitenberg line tracking functionality, and allow for left and right turns on a line grid. In addition, we present an A* algorithm that is utilized to efficiently solve for a route from a start node to an end node in a line grid maze. Finally, we present tuned parameters for node detection, line just past node detection, line following, turning logic, and ground sensor threshold parameters resulting in a stable system.
This was the project for EECE 5257, Control Systems 1, at Vanderbilt University. I wrote the controller in C and developed it in Webots, a robot simulator, before running it on a real E-Puck on a taped grid.
The robot and the setup
The E-Puck 1.0 is a small differential-wheel robot. Its ground sensor extension pack puts three infrared sensors side by side across the front, which gives a left, a centre, and a right reading, enough to tell where a line is.
The task was a 12 by 12 line grid. I built two copies of it. The virtual one is a texture drawn in Paint3D from pixel calculations that mirror the real board, imported into Webots next to a virtual E-Puck. The physical one is a smooth wooden board, roughly 4 ft by 4 ft, with double strips of 3/8 inch black painters tape forming 6/8 inch lines. In Webots the same C controller can run in the simulation or, by switching to a Bluetooth port, on the real robot.
Following a line
Line following is a simple Braitenberg controller. It takes the difference between the left and right ground sensor readings, multiplies it by a gain between 0 and 1, subtracts that from a fixed standard speed for one wheel and adds it to the other. If the robot drifts off to one side, the difference changes sign and speeds up the opposite wheel, so it always steers back. The result is a gentle sweeping motion along the line.
LeftWheelSpeed = Standard_Speed − Gain × (LeftSensor − RightSensor)
RightWheelSpeed = Standard_Speed + Gain × (LeftSensor − RightSensor)
Nodes, turns and thresholds
Because black tape absorbs infrared light, a sensor reads a lower value over tape than over the board. Each sensor compares its reading to two thresholds, one for a line and one for the board. The lines are narrow enough that only two sensors are ever over one at a time, so when all three read a line the robot is at a node. It checks several consecutive readings to be sure, then drives straight until it is back on a line just past the node. A flag set at the node is flipped when the three sensors no longer see a node together, and line following resumes.
To turn, the robot waits until it is just past the node, runs line following briefly to move away from it, then locks into a turning mode with fixed wheel speeds for the direction. While locked it ignores the sensors, which keeps the line it started on from being confused with the line it will finish on. Part way through the turn it unlocks, and as soon as the ground sensors find a new line it returns to line following. The turn is nearly, but not completely, a rotation in place.
The thresholds differ between the simulation and the real board, and using one set for the other caused significant line-tracking errors. These values were the most stable:
| Environment | Board detected | Line detected |
|---|---|---|
| Simulation | above 700 | below 600 |
| Physical board | above 550 | below 400 |
A reading between the two thresholds counts as neither. The guideline is to overestimate being on the board and underestimate being on the line.
Planning a route with A*
A user describes the maze as a two-dimensional array in which 1 is a drivable node and 0 is a wall. The code parses it into a graph of the directions available at each node and runs A* over it with a push-pop queue. The heuristic is the Manhattan distance from a neighbour to the goal, and the search stops when it reaches the goal. The solution is stored as a chain of references from the goal back to the start, so it is extracted recursively and then reversed.
h(node) = |NeighborNodeX − GoalNodeX| + |NeighborNodeY − GoalNodeY|
The plan is in global directions (up, down, left, right), but the robot needs commands relative to its own heading. A control-flow function walks the solution and converts it, merging repeated steps into commands for the high-level wrapper drive(nodes, direction), where the direction is left, right, or straight. A call such as drive(5, left) goes to the next node, turns left, and drives 5 nodes.
Results on the real robot
On the real board results are not deterministic as they are in simulation, so I tested each of the three basic maneuvers 25 times. For straight lines the robot followed a line across the whole board. A turn counted as successful if it left the line just past a node and picked up the line on the new side.
| Maneuver | Successes | Failures | Success rate |
|---|---|---|---|
| Straight line | 25 | 0 | 100% |
| Left turn | 25 | 0 | 100% |
| Right turn | 23 | 2 | 96% |
Complicated routes under A* exposed more errors. Two changes made them rare. I scaled the Braitenberg gain down to 0.3 to narrow the sweeping motion, and I added a short pause when the robot returns to a line after a node, followed by a brief burst of line following to move away from the node before a turn. With both, the E-Puck rarely fails on complex routes.
Conclusions
The controller uses the ground sensors to detect nodes and the line just past them, to track lines with Braitenberg control, and to turn left or right on a 12 by 12 line grid. A* finds the route and the E-Puck drives it. Error testing tuned the line following, turn logic, and thresholds into a stable system.
A note from 2026
The paper calls the E-Puck holonomic because it can rotate without moving forward. A differential-drive robot is in fact non-holonomic, since it cannot move sideways, and what the paper describes is turning in place. The right-turn figure of 96% comes from 25 trials, which is too few to say it differs from the 100% of the other maneuvers. The paper does not report how long the complex routes were or how many were run, so "rarely fails" is an observation, not a measured rate.
The paper is available as a PDF, and the controller and Webots world are in the GitHub repository.