The goal of the robot path planning problem is to determine an optimal collision-free path for a mobile robot between a start and a target point in an environment surrounded by obstacles. Optimal collision-free trajectory planning for mobile robot is always a major issue in robotics due to the necessity for the robots' course of movement. In recent years, as the emergence of another member of the swarm intelligence family-bacterial foraging optimization (BFO), the bacterial foraging strategy has attracted a great deal of interests. In this work, the path planning problem is approached by the mobile robot that mimics the foraging strategy of BFO algorithm. The objective is to minimize the path length and the number of turns without colliding with an obstacle. In the simulation studies, two test scenarios of static environment with different obstacle distribution are adopted to evaluate the performance of the proposed method. Simulation results show that our method is able to generate a collision-free path in complex environment.