In the near future, mobile robots will play an important roll in various tasks in factory automations or indoor services. Such various tasks involve specifications like urgency or safety. As a result, planners must take those factors into account to generate motions for mobile robots. This paper proposes a trajectory planning method addressing this problem : Environment, moving obstacles, robot motion dynamics, and user's specifiaations are described with cost functions, and an optimization technique is applied. Our method can be applied to some time-varying environments that the time-space technique cannot treate, can consider the motion dynamics, and need not prepare particular algorithms for each user's specifiaction.