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

Revision history [back]

click to hide/show revision 1
initial version

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.