lukovicaleksa / autonomous-driving-turtlebot-with-reinforcement-learning

Implementation of Q-learning algorithm and Feedback control for the mobile robot (turtlebot3_burger) in ROS.
109 stars 30 forks source link

AttributeError: 'NoneType' object has no attribute 'close' #6

Closed adidaus closed 2 years ago

adidaus commented 2 years ago

Hello, I get this error when running learning_node.py the error message appear (occasionally) in between the episode output can anyone help, please (i'm using ubuntu 20.04.3, python 3.8.10, and ros noetic 1.15.13)


Episode 8 ==> CRASH {-0.20,-0.17,34.12} 30/12/2021 16:45:18 episode time: 4.94 s (avg step: 0.21 s) episode steps: 23 episode reward: -103.50 episode max | avg | min reward: 0.10 | -4.70 | -100.00 T = 17.458432

Exception in thread /scan: Traceback (most recent call last): File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner self.run() File "/usr/lib/python3.8/threading.py", line 870, in run self._target(*self._args, **self._kwargs) File "/opt/ros/noetic/lib/python3/dist-packages/rospy/impl/tcpros_pubsub.py", line 185, in robust_connect_subscriber conn.receive_loop(receive_cb)
File "/opt/ros/noetic/lib/python3/dist-packages/rospy/impl/tcpros_base.py", line 846, in receive_loop self.close() File "/opt/ros/noetic/lib/python3/dist-packages/rospy/impl/tcpros_base.py", line 858, in close self.socket.close() AttributeError: 'NoneType' object has no attribute 'close'

Episode 9 ==> CRASH {-0.11,-0.23,19.62} 30/12/2021 16:45:24 episode time: 5.97 s (avg step: 0.21 s) episode steps: 28 episode reward: -106.90 episode max | avg | min reward: 0.00 | -3.96 | -100.00 T = 16.585511

lukovicaleksa commented 2 years ago

Looks like the scan node crashed. Similar thing happened to me when I tried to speed up the simulation, I guess it depends on the machine you use. Did you speed up the simulation? Does this same error occurr always or just sometimes?

adidaus commented 2 years ago

thank you for your reply. no, i didn't speed up the simulation. I just run it on a fresh installed gazebo 11.9.0, not changing anything. yes, the error occur everytime i run learning_node.py, but the simulation still goes on. I just wonder if it affect the result

lukovicaleksa commented 2 years ago

Then this is not the situation that happened to me, when scan node crashed the simulation could not continue. If the simulation continues for you then I guess there is no problem, you will see at the end.