Problem in running Turtlebot project

I have followed the steps as mentioned in the project and have completed all the steps. I have a launch file which launches the three nodes: service_server node, action_server node and the main program called my_node. Everything works perfectly but when the turtlebot reaches the ending of the maze, I get the error:


Traceback (most recent call last):
File “/home/user/catkin_ws/src/my_turtlebot_main/src/turtlebot_main.py”, line 37, in
my_object=controller()
File “/home/user/catkin_ws/src/my_turtlebot_main/src/turtlebot_main.py”, line 15, in init
self.imp_part()
File “/home/user/catkin_ws/src/my_turtlebot_main/src/turtlebot_main.py”, line 24, in imp_part
result=self.my_connector()server starts!
File “/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py”, line 435, in call
return self.call(*args, *kwds)
File “/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py”, line 505, in call
raise ServiceException(“unable to connect to service: %s”%e)
rospy.service.ServiceException: unable to connect to service: [Errno -2] Name or service not known
[my_node-3] process has died [pid 27099, exit code 1, cmd /home/user/catkin_ws/src/my_turtlebot_main/src/turtlebot_main.py __name:=my_node __log:=/home/user/.ros/log/2029e6ba-3760-11ea-a6ab-06f0b4bd1fec/my_node-3.log].
log file: /home/user/.ros/log/2029e6ba-3760-11ea-a6ab-06f0b4bd1fec/my_node-3
.log

I see that my service client connector: result=self.my_connector() is failing. But I don’t understand why. Any help would be appreciated.

Hi @hrushikesh.kyathari,

The error indicates that your service server is not running, and it could be that:

  • The service server is not running actually. Maybe it ran and then stopped for some reason. Maybe you didn’t start it?
  • The service is running but not yet ready. Did you use the “rospy wait for service” function in your service client? Example:
# Wait for the service /trajectory_by_name to be running
rospy.wait_for_service('/trajectory_by_name')

That was very silly of me to forget this. Thank you Sir.

1 Like