summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAriel Kwiatkowski <ariel.j.kwiatkowski@gmail.com>2021-09-29 23:10:18 +0200
committerGitHub <noreply@github.com>2021-09-29 23:10:18 +0200
commit496e614f7743a28e95e927890dfb5938c24b7090 (patch)
tree5bebb84f1170389fc9eceda3b1f5a92497c143d5
parentce26271923e48c297b623285421ac1c2ad06e623 (diff)
downloadbullet3-496e614f7743a28e95e927890dfb5938c24b7090.tar.gz
Explicitly state the datatypes in creating action/obs spaces
This should get rid of the annoying warnings that pop up whenever an environment is created. Numpy's default datatype is float64, gym's is float32, the env is actually float32, but the initialization doesn't make it explicit so it causes redundant warnings. ``` /path/lib/python3.9/site-packages/gym/logger.py:34: UserWarning: WARN: Box bound precision lowered by casting to float32 warnings.warn(colorize("%s: %s" % ("WARN", msg % args), "yellow")) ```
-rw-r--r--examples/pybullet/gym/pybullet_envs/robot_bases.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/pybullet/gym/pybullet_envs/robot_bases.py b/examples/pybullet/gym/pybullet_envs/robot_bases.py
index 1e22f1bbd..951470ac3 100644
--- a/examples/pybullet/gym/pybullet_envs/robot_bases.py
+++ b/examples/pybullet/gym/pybullet_envs/robot_bases.py
@@ -22,10 +22,10 @@ class XmlBasedRobot:
self.ordered_joints = None
self.robot_body = None
- high = np.ones([action_dim])
- self.action_space = gym.spaces.Box(-high, high)
- high = np.inf * np.ones([obs_dim])
- self.observation_space = gym.spaces.Box(-high, high)
+ high = np.ones([action_dim], dtype=np.float32)
+ self.action_space = gym.spaces.Box(-high, high, dtype=np.float32)
+ high = np.inf * np.ones([obs_dim], dtype=np.float32)
+ self.observation_space = gym.spaces.Box(-high, high, dtype=np.float32)
#self.model_xml = model_xml
self.robot_name = robot_name