Firstly, the paper proposes a chaotic mapping based differential evolution algorithm. By introducing the concept of chaotic map, both the group initialization and reconstruction of offspring of classical differential evolution algorithm are modified to improve accuracy and stability. And several contrast tests on the typical Benchmark functions verify the global convergence and stability of the algorithm. Then, the improved algorithm is applied to online trajectory optimization. The best trajectory online is realized by using the characteristics of its fast searching and doing not rely on gradient information. By combining the ideas of rolling window, the method of local minimum escape is proposed. Finally, the simulation result on ball and plate system shows the effectiveness of the proposed method.