fix the render_mode in via_point_reacher and hole reacher

This commit is contained in:
Hongyi Zhou 2023-11-22 11:24:23 +01:00
parent cee8d59107
commit 052abcbf1c
2 changed files with 5 additions and 5 deletions

View File

@ -197,7 +197,7 @@ class HoleReacherEnv(BaseReacherDirectEnv):
self.fig.gca().set_title(
f"Iteration: {self._steps}, distance: {np.linalg.norm(self.end_effector - self._goal) ** 2}")
if mode == "human":
if self.render_mode == "human":
# arm
self.line.set_data(self._joints[:, 0], self._joints[:, 1])
@ -205,7 +205,7 @@ class HoleReacherEnv(BaseReacherDirectEnv):
self.fig.canvas.draw()
self.fig.canvas.flush_events()
elif mode == "partial":
elif self.render_mode == "partial":
if self._steps % 20 == 0 or self._steps in [1, 199] or self._is_collided:
# Arm
plt.plot(self._joints[:, 0], self._joints[:, 1], 'ro-', markerfacecolor='k',

View File

@ -146,7 +146,7 @@ class ViaPointReacherEnv(BaseReacherDirectEnv):
self.fig.gca().set_title(f"Iteration: {self._steps}, distance: {self.end_effector - self._goal}")
if mode == "human":
if self.render_mode == "human":
# goal
if self._steps == 1:
self.goal_point_plot.set_data(goal_pos[0], goal_pos[1])
@ -158,7 +158,7 @@ class ViaPointReacherEnv(BaseReacherDirectEnv):
self.fig.canvas.draw()
self.fig.canvas.flush_events()
elif mode == "partial":
elif self.render_mode == "partial":
if self._steps == 1:
# fig, ax = plt.subplots()
# Add the patch to the Axes
@ -178,7 +178,7 @@ class ViaPointReacherEnv(BaseReacherDirectEnv):
plt.ylim([-1.1, lim])
plt.pause(0.01)
elif mode == "final":
elif self.render_mode == "final":
if self._steps == 199 or self._is_collided:
# fig, ax = plt.subplots()