rll / rllab

rllab is a framework for developing and evaluating reinforcement learning algorithms, fully compatible with OpenAI Gym.
Other
2.89k stars 802 forks source link

TypeError while resetting MountainCar #171

Open LanceGe opened 7 years ago

LanceGe commented 7 years ago

Traceback (most recent call last): File "/home/lance/software/rllab/scripts/run_experiment_lite.py", line 137, in run_experiment(sys.argv) File "/home/lance/software/rllab/scripts/run_experiment_lite.py", line 121, in run_experiment method_call(variant_data) File "/home/lance/coding/rllab/dao/dao_gym_mountaincar.py", line 25, in run_task algo.train() File "/home/lance/coding/rllab/dao/dao.py", line 127, in train observation = self.env.reset() File "/home/lance/software/rllab/rllab/envs/normalized_env.py", line 52, in reset ret = self._wrapped_env.reset() File "/home/lance/software/rllab/rllab/envs/box2d/mountain_car_env.py", line 52, in reset self.cart.linearVelocity = (xvel, self.cart.linearVelocity[1]) File "/home/lance/anaconda2/envs/rllab3/lib/python3.5/site-packages/Box2D/Box2D.py", line 3556, in SetLinearVelocity return Box2D.b2BodySetLinearVelocity(self, *args, **kwargs) TypeError: Converting from sequence to b2Vec2, expected int/float arguments index 0

dementrock commented 7 years ago

Seems to be caused by an erroneous action value. What's the content of dao_gym_mountaincar.py?

gd-zhang commented 6 years ago

@dementrock I encountered the same error, could you help me out? @LanceGe Have you solved it?

Traceback (most recent call last): File "/u/gdzhang/Code/rllab/scripts/run_experiment_lite.py", line 137, in run_experiment(sys.argv) File "/u/gdzhang/Code/rllab/scripts/run_experiment_lite.py", line 124, in run_experiment maybe_iter = concretize(data) File "/u/gdzhang/Code/rllab/rllab/misc/instrument.py", line 1346, in concretize return method(*args, kwargs) File "/u/gdzhang/Code/rllab/rllab/algos/batch_polopt.py", line 120, in train paths = self.sampler.obtain_samples(itr) File "/u/gdzhang/Code/rllab/rllab/algos/batch_polopt.py", line 28, in obtain_samples scope=self.algo.scope, File "/u/gdzhang/Code/rllab/rllab/sampler/parallel_sampler.py", line 125, in sample_paths show_prog_bar=True File "/u/gdzhang/Code/rllab/rllab/sampler/stateful_pool.py", line 150, in run_collect result, inc = collect_once(self.G, args) File "/u/gdzhang/Code/rllab/rllab/sampler/parallel_sampler.py", line 94, in _worker_collect_one_path path = rollout(G.env, G.policy, max_path_length) File "/u/gdzhang/Code/rllab/rllab/sampler/utils.py", line 13, in rollout o = env.reset() File "/u/gdzhang/Code/rllab/rllab/envs/normalized_env.py", line 52, in reset ret = self._wrapped_env.reset() File "/u/gdzhang/Code/rllab/rllab/envs/box2d/mountain_car_env.py", line 52, in reset self.cart.linearVelocity = (xvel, self.cart.linearVelocity[1]) File "/u/gdzhang/anaconda2/envs/rllab3/lib/python3.5/site-packages/Box2D/Box2D.py", line 3556, in SetLinearVelocity return Box2D.b2BodySetLinearVelocity(self, args, kwargs) TypeError: Converting from sequence to b2Vec2, expected int/float arguments index 0

PhilippeMorere commented 6 years ago

I had the same error. As a temporary fix, casting xvel to float works for me. Change this line: File "/u/gdzhang/Code/rllab/rllab/envs/box2d/mountain_car_env.py", line 52, in reset self.cart.linearVelocity = (float(xvel), self.cart.linearVelocity[1])