stulp / dmpbbo

Python/C++ library for Dynamical Movement Primitives and Black-Box Optimization
GNU Lesser General Public License v2.1
224 stars 90 forks source link

Suggest adding in start / end markers to demoOptimizationDmp.py #42

Closed studywolf closed 5 years ago

studywolf commented 5 years ago

something like

    # Plot start / end markers on trajectory
    ax_rollout.plot(h[0].get_xdata()[0], h[0].get_ydata()[0], 'rx', mew=3, label='start')
    ax_rollout.plot(h[0].get_xdata()[-1], h[0].get_ydata()[-1], 'bx', mew=3, label='end')
    plt.legend()

after line 107 in runOptimizationTask.py just adds a start and end marker to the demo. Just a suggestion to make it a little easier to parse on first glance:

Optimization_with_covar_update=decay

stulp commented 5 years ago

I've added that in f18090a.

Please note that adding these labels is done in the plotRollout function in TaskViapoint. The (black-box) optimization algorithm does not know what it is optimizing (hence "black-box"), so runOptimizationTask does not (and should not) have any knowledge of how to plot the rollouts. Therefore, it calls plotRollout in the Task of TaskSolver, see: https://github.com/stulp/dmpbbo/blob/master/python/dmp_bbo/runOptimizationTask.py#L93

Object-oriented design thus allows me to keep the knowledge about what is being optimized (in TaskViapoint and other Tasks) separate from how to optimize it (in runOptimization functions).