Hierarchical trajectory generation for a class of nonlinear systems