cbfinn / gps

Guided Policy Search
http://rll.berkeley.edu/gps/
Other
593 stars 239 forks source link

fix axis_limits error in python/gps/gui/gps_training_gui.py #88

Closed foolyc closed 6 years ago

foolyc commented 6 years ago

there is an error in calculate the axis limits for GUI plotting which do not consider the policy sample

def _calculate_3d_axis_limits(self, traj_sample_lists, pol_sample_lists):
    ...
    sample_lists = traj_sample_lists
    if pol_sample_lists:
         sample_lists += pol_sample_lists
         # sample_lists += traj_sample_lists    # original code
     ....
foolyc commented 6 years ago

if this bug not fixed, the function plot in python/gps/gui/plotter_3d.py will set sample in policy sample which out of the axis limits to NaN :

        xs[np.any(np.c_[xs < xlim[0], xs > xlim[1]], axis=1)] = np.nan
        ys[np.any(np.c_[ys < ylim[0], ys > ylim[1]], axis=1)] = np.nan
        zs[np.any(np.c_[zs < zlim[0], zs > zlim[1]], axis=1)] = np.nan

This will lead to the failure of policy optimization without deepcopy of policy sample(the original code does not use deepcopy yet).

cbfinn commented 6 years ago

LGTM. Thanks!