This article presents a real-time automatic system which contains optimum path selection, obstacle avoidance and position recognition in an indoor environment by robocar. Many sub-goals are set according to the experiment field especially for the crossroads. After assign the destination, it will select the shortest path for the robocar by dynamic programming. And the robocar will track the sub-goals, also it will avoid the obstacles based on the distance information gained by laser range sensor. A simple driving lane is designed in our laboratory and we did the experiment to test our automatic driving system.