This paper proposes an online viewpoint planning method for a mobile robot to reach a goal position safely and quickly. When a robot passes through a narrow space, it moves slowly while carefully observing surrounding objects and estimating the distances to the objects precisely. On the other hand, the robot moves quickly to a next destination in a widely open space. By considering both the predicted positional uncertainty and the configuration of obstacles, the viewpoint is adaptively determined according to the the clutteredness of the nearby environment. The planner works online to cope with the actual error caused by the real motion. The robot motion is continuously performed with speed control between the planned viewpoints during visual processing. An experimental result using a mobile robot with stereo vision shows the validity of the proposed method.