fix the render_mode in via_point_reacher and hole reacher
This commit is contained in:
parent
cee8d59107
commit
052abcbf1c
@ -197,7 +197,7 @@ class HoleReacherEnv(BaseReacherDirectEnv):
|
|||||||
self.fig.gca().set_title(
|
self.fig.gca().set_title(
|
||||||
f"Iteration: {self._steps}, distance: {np.linalg.norm(self.end_effector - self._goal) ** 2}")
|
f"Iteration: {self._steps}, distance: {np.linalg.norm(self.end_effector - self._goal) ** 2}")
|
||||||
|
|
||||||
if mode == "human":
|
if self.render_mode == "human":
|
||||||
|
|
||||||
# arm
|
# arm
|
||||||
self.line.set_data(self._joints[:, 0], self._joints[:, 1])
|
self.line.set_data(self._joints[:, 0], self._joints[:, 1])
|
||||||
@ -205,7 +205,7 @@ class HoleReacherEnv(BaseReacherDirectEnv):
|
|||||||
self.fig.canvas.draw()
|
self.fig.canvas.draw()
|
||||||
self.fig.canvas.flush_events()
|
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:
|
if self._steps % 20 == 0 or self._steps in [1, 199] or self._is_collided:
|
||||||
# Arm
|
# Arm
|
||||||
plt.plot(self._joints[:, 0], self._joints[:, 1], 'ro-', markerfacecolor='k',
|
plt.plot(self._joints[:, 0], self._joints[:, 1], 'ro-', markerfacecolor='k',
|
||||||
|
@ -146,7 +146,7 @@ class ViaPointReacherEnv(BaseReacherDirectEnv):
|
|||||||
|
|
||||||
self.fig.gca().set_title(f"Iteration: {self._steps}, distance: {self.end_effector - self._goal}")
|
self.fig.gca().set_title(f"Iteration: {self._steps}, distance: {self.end_effector - self._goal}")
|
||||||
|
|
||||||
if mode == "human":
|
if self.render_mode == "human":
|
||||||
# goal
|
# goal
|
||||||
if self._steps == 1:
|
if self._steps == 1:
|
||||||
self.goal_point_plot.set_data(goal_pos[0], goal_pos[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.draw()
|
||||||
self.fig.canvas.flush_events()
|
self.fig.canvas.flush_events()
|
||||||
|
|
||||||
elif mode == "partial":
|
elif self.render_mode == "partial":
|
||||||
if self._steps == 1:
|
if self._steps == 1:
|
||||||
# fig, ax = plt.subplots()
|
# fig, ax = plt.subplots()
|
||||||
# Add the patch to the Axes
|
# Add the patch to the Axes
|
||||||
@ -178,7 +178,7 @@ class ViaPointReacherEnv(BaseReacherDirectEnv):
|
|||||||
plt.ylim([-1.1, lim])
|
plt.ylim([-1.1, lim])
|
||||||
plt.pause(0.01)
|
plt.pause(0.01)
|
||||||
|
|
||||||
elif mode == "final":
|
elif self.render_mode == "final":
|
||||||
if self._steps == 199 or self._is_collided:
|
if self._steps == 199 or self._is_collided:
|
||||||
# fig, ax = plt.subplots()
|
# fig, ax = plt.subplots()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user