Segmentation fault when launching ros_controllers.launch
Hi I am having an error when launching the ros_controllers.launch file that causes gazebo to crash in ROS Melodic, Ubuntu 18.04. The behaviour is the following:
- gazebo.launch of the moveit_config pkg is launched (urdf is spawned correctly)
- The ros_controllers.launch file is launched afterwards in a new terminal (this file is not inside gazebo.launch anymore)
Then the controller spawner node dies showing this warning :
[WARN] [1600602932.213752, 16.517000]: Controller Spawner error while taking down controllers: unable to connect to service: [Errno 111] Connection refused
- After this gazebo crashes
Specifically it is showing this traceback:
Traceback (most recent call last):
File "/opt/ros/melodic/lib/controller_manager/spawner", line 212, in <module>
if __name__ == '__main__': main()
File "/opt/ros/melodic/lib/controller_manager/spawner", line 204, in main
resp = switch_controller(loaded, [], 2, False, 0.0)
File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py", line 442, in __call__
return self.call(*args, **kwds)
File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py", line 532, in call
raise ServiceException("transport error completing service call: %s"%(str(e)))
rospy.service.ServiceException: transport error completing service call: unable to receive data from sender, check sender's logs for details
[INFO] [1600602932.203508, 16.517000]: Shutting down spawner. Stopping and unloading controllers...
The log file shows this:
[rosout][INFO] 2020-09-20 12:22:39,391: Controller Spawner: Loaded controllers: joint_state_controller, printer_arm1_controller, printer_arm2_controller, printer_arm3_controller, printer_arm4_controller, printer_hand1_controller, printer_hand2_controller, printer_hand3_controller, printer_hand4_controller
[rospy.core][INFO] 2020-09-20 12:22:39,682: signal_shutdown [atexit]
[rosout][INFO] 2020-09-20 12:22:39,683: Shutting down spawner. Stopping and unloading controllers...
[rospy.internal][WARNING] 2020-09-20 12:22:39,686: Unknown error initiating TCP/IP socket to carlos-Lenovo-ideapad-320-15ISK:47803 (http://carlos-Lenovo-ideapad-320-15ISK:40505/): Traceback (most recent call last):
File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/impl/tcpros_base.py", line 562, in connect
self.read_header()
File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/impl/tcpros_base.py", line 657, in read_header
self._validate_header(read_ros_handshake_header(sock, self.read_buff, self.protocol.buff_size))
File "/opt/ros/melodic/lib/python2.7/dist-packages/rosgraph/network.py", line 357, in read_ros_handshake_header
d = sock.recv(buff_size)
error: [Errno 104] Connection reset by peer
[rospy.internal][INFO] 2020-09-20 12:22:39,687: topic[/clock] removing connection to http://carlos-Lenovo-ideapad-320-15ISK:40505/
[rosout][INFO] 2020-09-20 12:22:39,684: Stopping all controllers...
[rospy.internal][WARNING] 2020-09-20 12:22:39,692: Unknown error initiating TCP/IP socket to carlos-Lenovo-ideapad-320-15ISK:47803 (rosrpc://carlos-Lenovo-ideapad-320-15ISK:47803): Traceback (most recent call last):
File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/impl/tcpros_base.py", line 560, in connect
self.socket.connect((dest_addr, dest_port))
File "/usr/lib/python2.7/socket.py", line 228, in meth
return getattr(self._sock,name)(*args)
error: [Errno 111] Connection refused
[rosout][WARNING] 2020-09-20 12:22:39,692: Controller Spawner error while taking down controllers: unable to connect to service: [Errno 111] Connection refused
Loading the joint_state_controller by launching the controller spawner works, just my custom controllers do not. It already worked before so I am not sure ...
have you rebuilt your workspace after updating packages?
If you haven't, this may be a simple case of ABI incompatibility.
Yes I have used catkin build on my workspace. It took me just a few seconds as I just have a couple of packages. Hoped that would fix it too.
But have you cleaned your workspace first? The linker may not pick up on the fact that there are updates installed to libraries it has already linked.
If you're using
catkin_tools
, acatkin clean -y && catkin build
should be an easy test.I wasn't aware of that, just tried it out and it looked better in the beginning. However I was unable to connect to the move_group action, after this error the segmentation fault appeared again. Launching a second time resulted in the same behaviour as before cleaning and building.
Not sure why but after setting pid values for the controllers, the segmentation error disappeared. However now rviz loads the robot in collision state despite of having set the start state to a previously defined one.