Skip to content

Allow generating messages and services in the namespace action #301

@sloretz

Description

@sloretz

Feature request

It should be possible to generate code for services in a different namespace than srv, like action.

Feature description

rosidl_generator_c and rosidl_generator_cpp need to be able to generate code for messages and services in the namespace action instead of msg or srv.

Implementation considerations

subfolder variable

Messages can already be generated in the srv namespace. This is done for the Request and Response messages used for services to avoid conflicting with other messages. In the templates the variable subfolder is used to switch between msg and srv.

@# - subfolder (string)
@# The subfolder / subnamespace of the message
@# Either 'msg' or 'srv'

subfolder is populated by the location of the .msg file.

subfolder = os.path.basename(os.path.dirname(ros_interface_file))

I think this means a .msg that lived in a folder action would get the right namespace. Services don't use subfolder currently, so that will need to be changed.

CMake output file awareness

rosidl_cmake needs to know the files a generator will output ahead of time so it can create a cmake target that is invalidated when the generated files change. For services this is hardcoded to add *Request.srv and Response.srv in an srv folder. This will need to be changed to allow the service file to be in a different folder.

set(_request_file "${CMAKE_CURRENT_BINARY_DIR}/srv/${_name}_Request.msg")
set(_response_file "${CMAKE_CURRENT_BINARY_DIR}/srv/${_name}_Response.msg")

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions