  Learning from Demonstration (LfD) is a popular approach that allows humans to
teach robots new skills by showing the correct way(s) of performing the desired
skill. Human-provided demonstrations, however, are not always optimal and the
teacher usually addresses this issue by discarding or replacing sub-optimal
(noisy or faulty) demonstrations. We propose a novel LfD representation that
learns from both successful and failed demonstrations of a skill. Our approach
encodes the two subsets of captured demonstrations (labeled by the teacher)
into a statistical skill model, constructs a set of quadratic costs, and finds
an optimal reproduction of the skill under novel problem conditions (i.e.
constraints). The optimal reproduction balances convergence towards successful
examples and divergence from failed examples. We evaluate our approach through
several 2D and 3D experiments in real-world using a UR5e manipulator arm and
also show that it can reproduce a skill from only failed demonstrations. The
benefits of exploiting both failed and successful demonstrations are shown
through comparison with two existing LfD approaches. We also compare our
approach against an existing skill refinement method and show its capabilities
in a multi-coordinate setting.
