0

Line Robot - Basic lessons - Exercises - Smooth wall following

One of many exercises useful for RCJ Rescue Line and Maze.

Task: smoothly follow a wall.

We learned how to follow a wall, but the motion was rather erratic. The robot was constantly changing direction, either going too much toward or away from the wall. The old code is below. Can You write a code that will make movement smoother?

void RobotLine::loop() {
	if (rightFront() > 100)
		go(80, 20);
	else
		go(20, 80);
}