linZHank / turtlebot_rl

working on a turtlebot reinforcement learning in Gazebo and with help with a simplified openai_ros package
MIT License
7 stars 2 forks source link

Cannot start q learning or qnet learning #3

Open ChenhuaYang opened 5 years ago

ChenhuaYang commented 5 years ago

I followed all your steps of q learning and qnet learning, but both of them have errors.

Q-learning error: [ERROR] [1546789100.001231, 0.000000]: WORLD RESET [ERROR] [1546789100.015060, 0.000000]: NOT Initialising Simulation Physics Parameters [INFO] [1546789100.587977, 21929.458000]: Gazebo gym environment set [INFO] [1546789100.588508, 21929.458000]: ----- using Q Learning ----- [ERROR] [1546789100.597523, 21929.458000]: WORLD RESET Traceback (most recent call last): File "crib_nav_qtable.py", line 46, in state = utils.obs2state(obs, low) File "/home/ych/catkin_ws_turtlebot_rl/src/turtlebot_rl/scripts/utils.py", line 32, in obs2state ind_x = int(x - low[0]) # index of x TypeError: only size-1 arrays can be converted to Python scalars

Qnet-learning error: [ERROR] [1546789080.957477, 0.000000]: WORLD RESET [ERROR] [1546789080.972135, 0.000000]: NOT Initialising Simulation Physics Parameters [INFO] [1546789081.583159, 21928.951000]: Gazebo gym environment set [ERROR] [1546789082.018112, 21928.951000]: WORLD RESET Traceback (most recent call last): File "crib_nav_qnet.py", line 192, in num_steps=num_steps File "crib_nav_qnet.py", line 104, in run self._replay() File "crib_nav_qnet.py", line 133, in _replay q_s_a = self._model.predict_batch(states, self._sess) File "crib_nav_qnet.py", line 59, in predict_batch return sess.run(self._logits, feed_dict={self._states: states}) File "/home/ych/venv/local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 929, in run run_metadata_ptr) File "/home/ych/venv/local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1121, in _run np_val = np.asarray(subfeed_val, dtype=subfeed_dtype) File "/home/ych/venv/local/lib/python2.7/site-packages/numpy/core/numeric.py", line 501, in asarray return array(a, dtype, copy=False, order=order) ValueError: setting an array element with a sequence.

Seems that both of them are about world reset. So how to fix them. Thanks。

ChenhuaYang commented 5 years ago

For q learning : obs= (array([-0.70458226, 0.24417944, -0.21915934, 0.09444134, -0.97639746,0.21598149, -0.4237495 ]), {'goal_position': array([ 2.2679324 , -2.55783589]), 'init_position': array([-0.7032925 , 0.24362166]), 'previous_position': array([-0.7032925 , 0.24362166]), 'current_position': array([-0.70458226, 0.24417944])}) and low= array([-5. , -5. , -2. , -2. , -1. , -1. , -3.1415927], dtype=float32)

ChenhuaYang commented 5 years ago

I ran crib_nav_qtable.py in this project :deePurrobotics/gazebo_rl, and all things right...so what's wrong ....