Ask Your Question

Name conflict between msg and srv

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

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

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

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 ( ) which is a message and a separate package for std_srvs/Empty ( ) 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

Your Answer

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

Add Answer

Question Tools

1 follower


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

Seen: 209 times

Last updated: Apr 16 '16