ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Why isn't my service available?

asked 2021-12-21 03:19:44 -0500

Py gravatar image

updated 2021-12-21 04:57:25 -0500

I have used some rospy service code to get a robot to follow points on a map in a previous project but can't get it working in another project. The problem is that my /start_following service is not shown when I run rosservice list even though the /follower node it belongs to is running and other services I have created are in this list. The only things that are relevant in the output are:


I believe that the source code is correct because I've used it successfully before so I think there must be something in the ROS-system setup that is causing my problems. Does anyone have ideas what could be wrong?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2021-12-21 07:14:19 -0500

jorosuser gravatar image

I am using ROS2 but maybe it helps.. I once had the problem, that i changed my service (.srv) definitions and only rebuilding didn't seem to solve all problems. After I deleted the /build /install /log dirs, and then rebuilt the interface, it worked.

edit flag offensive delete link more


Thanks for the comment. Maybe I should have mentioned..... I'm actually running all of this in a docker container which means that I've been frequently rebuilding the image and therefore the workspace from scratch but the issue still occurs. What do you think?

Py gravatar image Py  ( 2021-12-21 07:20:26 -0500 )edit

did you source the package which contains the service definition? and also modify the package.xml so the package depend on the interface-definition package?

jorosuser gravatar image jorosuser  ( 2021-12-21 08:04:32 -0500 )edit

The workspace is sourced that contains the package which defines the service. What do you mean by the interface-definition package? The only dependency in the package.xml are roscpp, rospy and std_msgs. This seemed fine to me because I have another service defined in the same package that works as expected.

Py gravatar image Py  ( 2021-12-21 08:26:15 -0500 )edit

with interface-definition package, I meant a package which contains your service definition. But that's only necessary if you defined the services in a seperate package.

If you define your services in the same packages in which you use them, then you should be fine, I guess. But if you define them in another package then you need to add these packages as dependencies.

jorosuser gravatar image jorosuser  ( 2021-12-21 09:13:12 -0500 )edit

Ok thanks for clearing that up. The service is not defined in a separate package so package.xml looks fine. Any other ideas where there could be a problem?

Py gravatar image Py  ( 2021-12-22 07:16:25 -0500 )edit

Question Tools



Asked: 2021-12-21 03:19:44 -0500

Seen: 575 times

Last updated: Dec 21 '21