The differential driven two-wheeled inverted pendulum mobile robot has advantage of high maneuverability, which can maintain the balance on slopes and rough terrain and can pivot around a the central axis of its body in narrow spaces. It can be used to carry human beings as well as other goods. This paper studies the method of path planning for this robot in the known environments. The path planner based on optimization is proposed. This planner takes full account of the distance and angle between the robot and the target, velocity and obstacles to the navigation evaluation function, and then formulates the path planning problem in the discrete optimization problem. On the current state of robot, the range of input is determined by dynamic window, then the avoidance obstacles optimization input is solved by genetic algorithm. In this paper, the relationship of the target and obstacles is also accounted. Numerical simulations were performed to illustrate the effectiveness of the proposed planner in static, moving obstacles and dynamic object tracking, respectively. Through the simulation research and experiments, it is shown that the robot can be confirmed as mobile platform for transporting human and goods.