1. A method of generating robot trajectories, comprising: gathering human motion trajectories in a first workspace; adapting, by at least one computing device, the human motion trajectories from the first workspace into robot-reachable motion trajectories in a second workspace based on a joint space of a robot model; generating, by the at least one computing device, motion harmonics with reference to the robot-reachable motion trajectories using functional principal component analysis; specifying at least one constraint for a new goal; searching, by the at least one computing device, weights of the motion harmonics to identify a new motion trajectory to reduce discrepancy from the human motion trajectories and error due to the at least one constraint; and directing, by the at least one computing device, a robot to move according to the new motion trajectory.