Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in training #3

Open
RemaDaher opened this issue May 5, 2020 · 1 comment
Open

Error in training #3

RemaDaher opened this issue May 5, 2020 · 1 comment

Comments

@RemaDaher
Copy link

Hello,
When I run the following command:

python -m baselines.run --alg=ppo2 --env=RobotExploration-v0 --network=cnn --num_timesteps=2e7

I get the following error:

Traceback (most recent call last):
File "/home/rema/anaconda3/envs/housexpo/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/home/rema/anaconda3/envs/housexpo/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/rema/Thesis/baselines/baselines/run.py", line 250, in
main(sys.argv)
File "/home/rema/Thesis/baselines/baselines/run.py", line 216, in main
model, env = train(args, extra_args)
File "/home/rema/Thesis/baselines/baselines/run.py", line 80, in train
**alg_kwargs
File "/home/rema/Thesis/baselines/baselines/ppo2/ppo2.py", line 142, in learn
obs, returns, masks, actions, values, neglogpacs, states, epinfos = runner.run() #pylint: disable=E0632
File "/home/rema/Thesis/baselines/baselines/ppo2/runner.py", line 38, in run
self.obs[:], rewards, self.dones, infos = self.env.step(actions)
File "/home/rema/Thesis/baselines/baselines/common/vec_env/vec_env.py", line 108, in step
return self.step_wait()
File "/home/rema/Thesis/baselines/baselines/common/vec_env/dummy_vec_env.py", line 51, in step_wait
obs, self.buf_rews[e], self.buf_dones[e], self.buf_infos[e] = self.envs[e].step(action)
File "/home/rema/Thesis/baselines/baselines/bench/monitor.py", line 54, in step
ob, rew, done, info = self.env.step(action)
File "/home/rema/anaconda3/envs/housexpo/lib/python3.7/site-packages/gym/wrappers/time_limit.py", line 16, in step
observation, reward, done, info = self.env.step(action)
File "/home/rema/Thesis/HouseExpo/pseudoslam/envs/robot_exploration_v0.py", line 50, in step
crush_flag = self.sim.moveRobot(action)
File "/home/rema/Thesis/HouseExpo/pseudoslam/envs/simulator/pseudoSlam.py", line 418, in moveRobot
if self.robotCrashed(targetPose):
File "/home/rema/Thesis/HouseExpo/pseudoslam/envs/simulator/pseudoSlam.py", line 465, in robotCrashed
worldPatch= worldPatch*robotPatch
ValueError: operands could not be broadcast together with shapes (11,10) (11,11)

@RemaDaher
Copy link
Author

RemaDaher commented May 7, 2020

I solved this in pseudoSlam.py by replacing:
worldPatch= worldPatch * robotPatch
with:
rowWorld,colWorld=np.shape(self.world)
if (py-r)>=0 and (px-r)>=0 and (py+r+1)<=rowWorld and (px+r+1)<=colWorld:
worldPatch= worldPatch * robotPatch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant