ros1_bridge fails to generate service when custom message from the same package is used
I am trying to compile the ros1_bridge package with several custom interface packages. It works fine for messages and services, but as soon as I try it on a service that includes a custom message defined in the same interface package it won't convert the service. I have recreated the issue with this workspace structure and source:
├── ros1_bridge_ws
│ └── src
│ └── ros1_bridge
│ │
│ ...
├── ros1_ws
│ └── src
│ └── ros1_test
│ ├── CMakeLists.txt
│ ├── msg
│ │ ├── CustomMessage.msg
│ │ └── CustomMessage2.msg
│ ├── package.xml
│ └── srv
│ └── Test.srv
└── ros2_ws
└── src
└── ros2_test
├── CMakeLists.txt
├── include
│ └── ros2_test
├── msg
│ ├── CustomMessage.msg
│ └── CustomMessage2.msg
├── package.xml
├── ros1_mapping_rules.yaml
├── src
└── srv
└── Test.srv
CustomMessage.msg
string text
uint8 value
CustomMessage2.msg
string text
uint8 value
CustomMessage custom_message
Test.srv
uint8 test1
CustomMessage test3
---
uint16 test2
ros1_mapping_rules.yaml
-
ros1_package_name: 'ros1_test'
ros2_package_name: 'ros2_test'
ROS1 CMakeLists.txt
cmake_minimum_required(VERSION 2.8.3)
project(ros1_test)
find_package(catkin REQUIRED COMPONENTS
message_generation
std_msgs
)
add_message_files(
FILES
CustomMessage.msg
CustomMessage2.msg
)
add_service_files(
FILES
Test.srv
)
generate_messages(
DEPENDENCIES
std_msgs
)
catkin_package(
)
include_directories(
${catkin_INCLUDE_DIRS}
)
ROS2 CMakeList.txt
cmake_minimum_required(VERSION 3.5)
project(ros2_test)
# Default to C99
if(NOT CMAKE_C_STANDARD)
set(CMAKE_C_STANDARD 99)
endif()
# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
# find dependencies
find_package(ament_cmake REQUIRED)
find_package(builtin_interfaces REQUIRED)
find_package(rosidl_default_generators REQUIRED)
find_package(std_msgs REQUIRED)
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()
endif()
rosidl_generate_interfaces(ros2_test
"msg/CustomMessage.msg"
"msg/CustomMessage2.msg"
"srv/Test.srv"
DEPENDENCIES std_msgs builtin_interfaces
)
install(
FILES ros1_mapping_rules.yaml
DESTINATION share/${PROJECT_NAME}
)
ament_package()
Output from "ros2 run ros1_bridge dynamic_bridge --print-pairs"
Supported ROS 2 <=> ROS 1 message type conversion pairs:
- 'actionlib_msgs/msg/GoalID' (ROS 2) <=> 'actionlib_msgs/GoalID' (ROS 1)
- 'actionlib_msgs/msg/GoalStatus' (ROS 2) <=> 'actionlib_msgs/GoalStatus' (ROS 1)
- 'actionlib_msgs/msg/GoalStatusArray' (ROS 2) <=> 'actionlib_msgs/GoalStatusArray' (ROS 1)
- 'builtin_interfaces/msg/Duration' (ROS 2) <=> 'std_msgs/Duration' (ROS 1)
- 'builtin_interfaces/msg/Time' (ROS 2) <=> 'std_msgs/Time' (ROS 1)
- 'diagnostic_msgs/msg/DiagnosticArray' (ROS 2) <=> 'diagnostic_msgs/DiagnosticArray' (ROS 1)
- 'diagnostic_msgs/msg/DiagnosticStatus' (ROS 2) <=> 'diagnostic_msgs/DiagnosticStatus' (ROS 1)
- 'diagnostic_msgs/msg/KeyValue' (ROS 2) <=> 'diagnostic_msgs/KeyValue' (ROS 1)
- 'gazebo_msgs/msg/ContactState' (ROS 2) <=> 'gazebo_msgs/ContactState' (ROS 1)
- 'gazebo_msgs/msg/ContactsState' (ROS 2) <=> 'gazebo_msgs/ContactsState' (ROS 1)
- 'gazebo_msgs/msg/LinkState' (ROS 2) <=> 'gazebo_msgs/LinkState' (ROS 1)
- 'gazebo_msgs/msg/LinkStates' (ROS 2) <=> 'gazebo_msgs/LinkStates' (ROS 1)
- 'gazebo_msgs/msg/ModelState' (ROS 2) <=> 'gazebo_msgs/ModelState' (ROS 1)
- 'gazebo_msgs/msg/ModelStates' (ROS 2) <=> 'gazebo_msgs/ModelStates' (ROS 1)
- 'gazebo_msgs/msg/ODEJointProperties' (ROS 2) <=> 'gazebo_msgs/ODEJointProperties' (ROS 1)
- 'gazebo_msgs/msg/ODEPhysics' (ROS 2) <=> 'gazebo_msgs/ODEPhysics' (ROS 1)
- 'gazebo_msgs/msg/WorldState' (ROS 2) <=> 'gazebo_msgs/WorldState' (ROS 1)
- 'geometry_msgs/msg/Accel' (ROS 2) <=> 'geometry_msgs/Accel' (ROS 1)
- 'geometry_msgs/msg/AccelStamped' (ROS 2) <=> 'geometry_msgs/AccelStamped' (ROS 1)
- 'geometry_msgs/msg/AccelWithCovariance' (ROS 2) <=> 'geometry_msgs/AccelWithCovariance' (ROS 1)
- 'geometry_msgs/msg/AccelWithCovarianceStamped' (ROS 2) <=> 'geometry_msgs/AccelWithCovarianceStamped' (ROS 1)
- 'geometry_msgs/msg/Inertia' (ROS 2) <=> 'geometry_msgs/Inertia' (ROS 1 ...
Please consider sharing your ready-to-be-build code if you want others to give it a try. What does the
dynamic_bridge
output with the option--print-pairs
?Thanks for the reply. I have edited the post to contain the output of --print-pairs, but I should have been more clear, when I say that the Test service doesn't show up I was talking about the output of --print-pairs. As soon as I remove the reference to the custom message from the service, the service is converted properly. I have also attached the source that I am using in this example.
Your source snippets are not complete (e.g. no package manifests). I am willing to clone and build the packages but no creating all these files by copy-n-pasting their content and imagining the missing pieces.
Please see the edited message, I updated it to include a zip folder of the ready to be built code as I have been testing it. Here is the link again for convenience https://drive.google.com/open?id=1K1V...