Why isn't my service available?
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:
/follower/get_loggers
/follower/set_logger_level
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?
Asked by Py on 2021-12-21 04:19:44 UTC
Answers
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.
Asked by jorosuser on 2021-12-21 08:14:19 UTC
Comments
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?
Asked by Py on 2021-12-21 08:20:26 UTC
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?
Asked by jorosuser on 2021-12-21 09:04:32 UTC
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.
Asked by Py on 2021-12-21 09:26:15 UTC
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.
Asked by jorosuser on 2021-12-21 10:13:12 UTC
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?
Asked by Py on 2021-12-22 08:16:25 UTC
Comments