-
Notifications
You must be signed in to change notification settings - Fork 153
Description
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.
rosidl/rosidl_generator_c/resource/msg.h.em
Lines 10 to 12 in 206dd2b
| @# - 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.
rosidl/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake
Lines 97 to 98 in 206dd2b
| set(_request_file "${CMAKE_CURRENT_BINARY_DIR}/srv/${_name}_Request.msg") | |
| set(_response_file "${CMAKE_CURRENT_BINARY_DIR}/srv/${_name}_Response.msg") |