A robotic controller for generating sequences of movement primitives for sequential tasks of a robot having a manipulator, comprising: at least one control processor; and a memory circuitry storing a dictionary including the movement primitives, a pretrained learning module, and a graph-search based planning module having instructions stored thereon that, when executed by the at least control processor, cause the robotic controller to perform the steps of: acquiring, via an interface controller, demonstration data of one or more demonstration tasks provided by an interface device operated by a user for a planned task, wherein the planned task is represented by an initial state and a goal state with respect to at least one object being manipulated; segmenting each of the demonstration data into multiple segments by selecting features from the demonstration data based on a feature selection method and by using a segmentation metric, wherein each of the multiple segments represents a subtask; generating a planning graph by searching a feasible path for the planned task using the graph-search based planning module and selecting movement primitives from the dictionary in the pretrained learning module, wherein the pretrained learning module has been trained based on collected demonstration data of training demonstration tasks; parameterizing the feasible path represented by the movement primitives as dynamic movement primitives, DMPs, using the initial state and goal state; and implementing the parameterized feasible path as a trajectory according to the selected movement primitives using the manipulator of the robot by tracking and following the parameterized feasible path for the planned task, wherein trajectories of the demonstration tasks are segmented using a metric which represents variance between different demonstrations and within an identical trajectory, wherein the metric is defined as Φ = max(|var w | - | var b |), where var w is the variance within a single demonstration, var b is the variance between demonstrations and Φ is the maximum of the difference between the variances. acquiring, via an interface controller, demonstration data of one or more demonstration tasks provided by an interface device operated by a user for a planned task, wherein the planned task is represented by an initial state and a goal state with respect to at least one object being manipulated; segmenting each of the demonstration data into multiple segments by selecting features from the demonstration data based on a feature selection method and by using a segmentation metric, wherein each of the multiple segments represents a subtask; generating a planning graph by searching a feasible path for the planned task using the graph-search based planning module and selecting movement primitives from the dictionary in the pretrained learning module, wherein the pretrained learning module has been trained based on collected demonstration data of training demonstration tasks; parameterizing the feasible path represented by the movement primitives as dynamic movement primitives, DMPs, using the initial state and goal state; and implementing the parameterized feasible path as a trajectory according to the selected movement primitives using the manipulator of the robot by tracking and following the parameterized feasible path for the planned task, wherein trajectories of the demonstration tasks are segmented using a metric which represents variance between different demonstrations and within an identical trajectory, wherein the metric is defined as Φ = max(|var w | - | var b |), where var w is the variance within a single demonstration, var b is the variance between demonstrations and Φ is the maximum of the difference between the variances.