Ask Your Question
0

Why we need to source package in order to use rosservice

asked 2021-04-13 19:35:45 -0500

CroCo gravatar image

I've implemented very simple node that contains service to reset a counter. When I open up a new terminal and perform the following

rosservice call /request 'reset'

I get this error:

ERROR: Unable to load type [srv_counter/CounterServiceMsg]. 
Have you typed 'make' in [srv_counter]?

Even though the node that contains this service is running and rosservice list indeed shows the service in the list. Sourcing my package source ./devel/setup.bash solves the problem. I'm wondering why this occurs. Why rosservice is able to see the service but fails to call it.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-04-13 20:51:26 -0500

130s gravatar image

updated 2021-04-14 08:41:59 -0500

Glad you got it working!

Have you typed 'make' in [srv_counter]?

This seems to be FAQ on this forum. You may find other threds that explain this well e.g. #q254699.

ROS Service is server-client system, which consists of Service server and Service client. What rosservice list returns is a list of currently running Service server nodes. On the other hand, rosservice call creates a Service client node. As #q254699 explains, the environment for both nodes needs to know about the same Service definition, which in your case source ./devel/setup.bash resolves.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2021-04-13 19:35:45 -0500

Seen: 33 times

Last updated: Apr 14