Abstract In this paper the trajectory tracking control algorithm with obstacle avoidance capability is presented. As a robot gets into a neighborhood of the obstacle, the collision avoidance behavior is turned on. It is implemented using the artificial potential function (APF) that increases to infinity as the robot approaches a boundary of the obstacle. This feature guarantees collision avoidance. As avoidance behavior is active only in the neighborhood of the obstacle it does not affect the motion when there is no risk of the collision. Authors show that trajectory of the robot converges to desired one when a robot is out of the APF area. Due to a local characteristic of the APF, the implementation of the algorithm of the robot that uses only on-board sensors is possible. The stability proof is presented for both a near obstacle and obstacle-free areas. Effectiveness of the algorithm is illustrated with experiments on a real robot in an environment with static circle-shaped obstacles.