This paper tries to present an trajectory planning algorithm applied in an intelligent driver model to control an unmanned ground vehicle in complex environment. The proposed trajectory planning algorithm takes into account of the surrounding environment, including lanes and road geometries, surrounding obstacles, including static obstacles and moving obstacles, and traffic infrastructure, and a decision making process determines an optimum trajectory to follow safely and comfortably based on the analysis of the travelable region and traffic rules. The concept presented in this paper is demonstrated through simulation and the results are discussed.