hello, I’m trying to do the exercise 6.1 but i got this error
Logging to /tmp/openai-2020-07-09-06-37-08-133635
Traceback (most recent call last):
File "train_cartpole.py", line 7, in <module>
env = gym.make("CartPoleStayUp-v0")
File "/home/user/.catkin_ws_python3/openai_venv/lib/python3.5/site-packages/gym/envs/registration.py", line 156, in make
return registry.make(id, **kwargs)
File "/home/user/.catkin_ws_python3/openai_venv/lib/python3.5/site-packages/gym/envs/registration.py", line 101, in make
env = spec.make(**kwargs)
File "/home/user/.catkin_ws_python3/openai_venv/lib/python3.5/site-packages/gym/envs/registration.py", line 73, in make
env = cls(**_kwargs)
File "/home/simulations/public_sim_ws/src/all/openai_ros/openai_ros/src/openai_ros/task_envs/cartpole_stay_up/stay_up.py", line 19, in __init__
self.get_params()
File "/home/simulations/public_sim_ws/src/all/openai_ros/openai_ros/src/openai_ros/task_envs/cartpole_stay_up/stay_up.py", line 35, in get_params
self.n_actions = rospy.get_param('/cartpole_v0/n_actions')
File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/client.py", line 465, in get_param
return _param_server[param_name] #MasterProxy does all the magic for us
File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/msproxy.py", line 123, in __getitem__
raise KeyError(key)
KeyError: '/cartpole_v0/n_actions'
Exception in thread Thread-5:
Traceback (most recent call last):
File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
self.run()
File "/usr/lib/python3.5/threading.py", line 862, in run
self._target(*self._args, **self._kwargs)
File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/impl/tcpros_base.py", line 153, in run
(client_sock, client_addr) = self.server_sock.accept()
File "/usr/lib/python3.5/socket.py", line 195, in accept
fd, addr = self._accept()
OSError: [Errno 9] Bad file descriptor
this is my train_cartpole.py
import gym
import rospy
from openai_ros.task_envs.cartpole_stay_up import stay_up
from baselines import deepq
rospy.init_node('cartpole_training', anonymous=True, log_level=rospy.WARN)
env = gym.make("CartPoleStayUp-v0")
def callback(lcl, _glb):
# stop training if reward exceeds 199
is_solved = lcl['t'] > 100 and sum(lcl['episode_rewards'][-101:-1]) / 100 >= 199
return is_solved
def main():
# env = gym.make("CartPole-v0")
act = deepq.learn(
env,
network='mlp',
lr=1e-3,
total_timesteps=100000,
buffer_size=50000,
exploration_fraction=0.1,
exploration_final_eps=0.02,
print_freq=10,
callback=callback
)
print("Saving model to cartpole_model.pkl")
act.save("cartpole_model.pkl")
if __name__ == '__main__':
main()
thank you for the help