Rosbag and python script fail due to GetPlan service

asked 2020-11-25 08:00:08 -0500

Dimi gravatar image

updated 2020-11-25 09:50:22 -0500

gvdhoorn gravatar image

Hello guys,

I have recorded a rosbag during my last experiment and I want to replay it. At the same time I want to run an implemented algorithm in python in order to compare the results with the results of the previous algorithm have already been computed based on the rosbag mentioned above.

However, when I run both rosbag play my_rosbag.bag and rosrun I get the following error :

 resp = get_plan(srv.start, srv.goal, srv.tolerance)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/impl/", line 435, in __call__
    return*args, **kwds)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/impl/", line 495, in call
    service_uri = self._get_service_uri(request)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/impl/", line 463, in _get_service_uri
    raise ServiceException("service [%s] unavailable"%self.resolved_name)
rospy.service.ServiceException: service [/move_base/GlobalPlanner/plan] unavailable

Inside the python script there is a path calculation using GetPlan service. If I remove it, the algorithm runs effectively. But I want to take it into account without failing.

Has anyone ever experienced a similar situation to that ?

edit retag flag offensive close merge delete


rosbag does not (re)create service servers. If you don't start move_base, the plan service will not be available, hence the error.

gvdhoorn gravatar image gvdhoorn  ( 2020-11-25 09:50:56 -0500 )edit

Thanks for the answer. It does make sense, but I think I am missing something. Do I have to run an existing launch file related to move_base (such as move_base.launch) in an extra terminal alongside rosbag and or create a new specific launch file ?

Dimi gravatar image Dimi  ( 2020-11-25 15:11:11 -0500 )edit