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

Name conflict between msg and srv

asked 2016-04-15 23:31:18 -0500

Cerin gravatar image

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?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2016-04-16 00:06:15 -0500

William gravatar image

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... ) which is a message and a separate package for std_srvs/Empty ( http://docs.ros.org/jade/api/std_srvs... ) 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.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-04-15 23:31:18 -0500

Seen: 584 times

Last updated: Apr 16 '16