From bbbe0f38e30275113771fd7acb3e705cc09f5341 Mon Sep 17 00:00:00 2001 From: kngwyu Date: Tue, 30 Jun 2020 16:33:07 +0900 Subject: [PATCH] Fix gym warning --- mujoco_maze/maze_env.py | 2 +- mujoco_maze/maze_task.py | 15 ++++++++++----- mujoco_maze/point.py | 2 +- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/mujoco_maze/maze_env.py b/mujoco_maze/maze_env.py index 2164e5a..1d2f5a1 100644 --- a/mujoco_maze/maze_env.py +++ b/mujoco_maze/maze_env.py @@ -268,7 +268,7 @@ class MazeEnv(gym.Env): def _get_obs_space(self) -> gym.spaces.Box: shape = self._get_obs().shape - high = np.inf * np.ones(shape) + high = np.inf * np.ones(shape, dtype=np.float32) low = -high # Set velocity limits wrapped_obs_space = self.wrapped_env.observation_space diff --git a/mujoco_maze/maze_task.py b/mujoco_maze/maze_task.py index 31c9b29..f2a04e3 100644 --- a/mujoco_maze/maze_task.py +++ b/mujoco_maze/maze_task.py @@ -1,15 +1,20 @@ from abc import ABC, abstractmethod -from typing import Dict, List, Tuple, Type +from typing import Dict, List, NamedTuple, Type import numpy as np from mujoco_maze.maze_env_utils import MazeCell -Rgb = Tuple[float, float, float] -RED = (0.7, 0.1, 0.1) -GREEN = (0.1, 0.7, 0.1) -BLUE = (0.1, 0.1, 0.7) +class Rgb(NamedTuple): + red: float + green: float + blue: float + + +RED = Rgb(0.7, 0.1, 0.1) +GREEN = Rgb(0.1, 0.7, 0.1) +BLUE = Rgb(0.1, 0.1, 0.7) class MazeGoal: diff --git a/mujoco_maze/point.py b/mujoco_maze/point.py index 198162b..a92d2d7 100644 --- a/mujoco_maze/point.py +++ b/mujoco_maze/point.py @@ -31,7 +31,7 @@ class PointEnv(AgentModel): def __init__(self, file_path: Optional[str] = None): super().__init__(file_path, 1) - high = np.inf * np.ones(6) + high = np.inf * np.ones(6, dtype=np.float32) high[3:] = self.VELOCITY_LIMITS high[self.ORI_IND] = np.pi low = -high