0
$\begingroup$

Rosanswers logo

I want publish a message reporting an actuator state change, but I also want to provide a service to allow setting that state. When I tried to create a msg called MyState and srv called MyState, catkin_make gives me a name conflict error. Why can't msg and srv files use the same name? Do they share the same namespace?


Originally posted by Cerin on ROS Answers with karma: 940 on 2016-04-15

Post score: 2

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

No you cannot have a Msg and Srv of the same name in the same package. Messages and Services are identified by both the package they are in and the name. For example, std_msgs/String is different from your_package/String. You cannot, however, have std_msgs/Empty.msg and std_msgs/Empty.srv. That's why, for example, we have std_msgs/Empty (http://docs.ros.org/jade/api/std_msgs/html/msg/Empty.html) which is a message and a separate package for std_srvs/Empty (http://docs.ros.org/jade/api/std_srvs/html/srv/Empty.html) which is a service.

ROS 2 isn't ready yet, but this ambiguity doesn't exist in ROS 2 anymore. Messages and Services will not share a flat namespace.


Originally posted by William with karma: 17335 on 2016-04-16

This answer was ACCEPTED on the original site

Post score: 3

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.