— This paper addresses a method to optimize the robot motion planning in dynamic environments, avoiding the moving and static obstacles while the robot drives towards the goal. The method maps the dynamic environment into a model in the velocity space, computing the times to potential collision and potential escape and the associated robot velocities. The problem of finding a trajectory to the goal is stated as a constrained nonlinear optimization problem. The initial seed trajectory for the optimization is directly generated in the velocity space using the model built. The method is applied to robots which are subject to both kinematic constraints (i.e. involving the configuration parameters of the robot and their derivatives), and dynamic constraints, (i.e. the constraints imposed by the acceleration/deceleration capabilities). Some experimental results are discussed.