Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

ROS1 bridge ROS2

**Hi,

I am trying to communicate ROS1 (Melodic) and ROS2 (Dashing), but I am not able after several attempts ... My ROS2 package is called new_msgs, the same name that in ROS1 workspace, with the same .msg:

YoloList.msg YoloObstacle.msg

I have modified my CMakeLists.txt and package.xml of this ros1_bridge as following:**

CMakeLists.txt:

cmake_minimum_required(VERSION 3.5)

project(ros1_bridge)

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) endif()

find_package(rmw REQUIRED)

find_package(ament_cmake REQUIRED) find_package(rclcpp REQUIRED) find_package(rmw_implementation_cmake REQUIRED) find_package(std_msgs REQUIRED) find_package(new_msgs REQUIRED)

find ROS 1 packages

set(cmake_extras_files cmake/find_ros1_package.cmake cmake/find_ros1_interface_packages.cmake) include(cmake/find_ros1_package.cmake)

find_package(PkgConfig) if(NOT PKG_CONFIG_FOUND) message(WARNING "Failed to find PkgConfig, skipping...") # call ament_package() to avoid ament_tools treating this as a plain CMake pkg ament_package() return() endif()

find_ros1_package(roscpp) if(NOT ros1_roscpp_FOUND) message(WARNING "Failed to find ROS 1 roscpp, skipping...") # call ament_package() to avoid ament_tools treating this as a plain CMake pkg ament_package( CONFIG_EXTRAS ${cmake_extras_files} ) return() endif()

find_ros1_package(std_msgs REQUIRED) find_ros1_package(new_msgs REQUIRED)

find ROS 1 packages with messages / services

include(cmake/find_ros1_interface_packages.cmake) find_ros1_interface_packages(ros1_message_packages)

set(prefixed_ros1_message_packages "") foreach(ros1_message_package ${ros1_message_packages}) # TODO(karsten1987): This is currently a workaround to work with ROS 2 classloader # rather than ROS 1 classloader. if(NOT "${ros1_message_package}" STREQUAL "nodelet") find_ros1_package(${ros1_message_package} REQUIRED) list(APPEND prefixed_ros1_message_packages "ros1_${ros1_message_package}") endif() endforeach()

set(TEST_ROS1_BRIDGE FALSE) if(BUILD_TESTING) find_package(ament_lint_auto REQUIRED) find_package(diagnostic_msgs REQUIRED) find_ros1_package(diagnostic_msgs) find_ros1_package(roslaunch) ament_lint_auto_find_test_dependencies() if(ros1_diagnostic_msgs_FOUND AND ros1_roslaunch_FOUND) # ensure that the ROS 2 diagnostic_msgs was found by find_package # and not the ROS 1 package set(_ros1_diagnostic_msgs_DIR "${ros1_diagnostic_msgs_PREFIX}/share/diagnostic_msgs/cmake") if("${diagnostic_msgs_DIR}" STREQUAL "${_ros1_diagnostic_msgs_DIR}") # invalidate the cached result to retry finding the package next time unset(diagnostic_msgs_DIR CACHE) message(FATAL_ERROR "Failed to find ROS 2 package 'diagnostic_msgs'") endif() set(TEST_ROS1_BRIDGE TRUE) endif() endif()

ament_export_include_directories(include) ament_export_libraries(${PROJECT_NAME})

ament_python_install_package(${PROJECT_NAME})

ament_package( CONFIG_EXTRAS ${cmake_extras_files} )

set(generated_path "${CMAKE_BINARY_DIR}/generated") set(generated_files "${generated_path}/get_factory.cpp") list(APPEND generated_files "${generated_path}/get_mappings.cpp")

generate per interface compilation units to keep the memory usage low

ament_index_get_resources(ros2_interface_packages "rosidl_interfaces") foreach(package_name ${ros2_interface_packages}) find_package(${package_name} QUIET REQUIRED) message(STATUS "Found ${package_name}: ${${package_name}_VERSION} (${${package_name}_DIR})") if(NOT "${package_name}" STREQUAL "builtin_interfaces") list(APPEND generated_files "${generated_path}/${package_name}_factories.cpp") list(APPEND generated_files "${generated_path}/${package_name}_factories.hpp") foreach(interface_file ${${package_name}_INTERFACE_FILES}) file(TO_CMAKE_PATH "${interface_file}" interface_name) get_filename_component(interface_basename "${interface_name}" NAME_WE) # skipping actions and request and response messages of services if(NOT "${interface_name}" MATCHES "^(msg|srv)/" OR "${interface_basename}" MATCHES "_(Request|Response)$") continue() endif() string(REPLACE "/" "__" interface_name "${interface_name}") get_filename_component(interface_name "${interface_name}" NAME_WE) list(APPEND generated_files "${generated_path}/${package_name}__${interface_name}__factories.cpp") endforeach() endif() endforeach()

set(target_dependencies "bin/ros1_bridge_generate_factories" "resource/get_factory.cpp.em" "resource/get_mappings.cpp.em" "resource/interface_factories.cpp.em" "resource/pkg_factories.cpp.em" "resource/pkg_factories.hpp.em" "ros1_bridge/__init__.py")

add_custom_command( OUTPUT ${generated_files} COMMAND ${PYTHON_EXECUTABLE} bin/ros1_bridge_generate_factories --output-path "${generated_path}" --template-dir resource DEPENDS ${target_dependencies} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMENT "Generating factories for interface types")

if(NOT WIN32) # ignore warning in ROS 1 message headers set_source_files_properties(${generated_files} PROPERTIES COMPILE_FLAGS "-Wno-unused-parameter") endif()

include_directories(include ${generated_path})

function(custom_executable target) cmake_parse_arguments( ARG "ROS1_DEPENDENCIES" "" "TARGET_DEPENDENCIES" ${ARGN})

add_executable(${target} ${ARG_UNPARSED_ARGUMENTS}) ament_target_dependencies(${target} "rclcpp" ${ARG_TARGET_DEPENDENCIES}) if(ARG_ROS1_DEPENDENCIES) ament_target_dependencies(${target} "ros1_roscpp" "ros1_std_msgs" "ros1_new_msgs") endif() if(ARG_DEPENDENCIES) add_dependencies(${target} ${ARG_DEPENDENCIES}) endif()

install(TARGETS ${target} DESTINATION lib/${PROJECT_NAME}) endfunction()

custom_executable(simple_bridge_1_to_2 "src/simple_bridge_1_to_2.cpp" ROS1_DEPENDENCIES TARGET_DEPENDENCIES "std_msgs" "new_msgs") custom_executable(simple_bridge_2_to_1 "src/simple_bridge_2_to_1.cpp" ROS1_DEPENDENCIES TARGET_DEPENDENCIES "std_msgs" "new_msgs")

custom_executable(simple_bridge "src/simple_bridge.cpp" ROS1_DEPENDENCIES TARGET_DEPENDENCIES "std_msgs" "new_msgs")

add_library(${PROJECT_NAME} SHARED "src/builtin_interfaces_factories.cpp" "src/convert_builtin_interfaces.cpp" "src/bridge.cpp" ${generated_files}) ament_target_dependencies(${PROJECT_NAME} ${prefixed_ros1_message_packages} ${ros2_interface_packages} "rclcpp" "ros1_roscpp" "ros1_std_msgs" "ros1_new_msgs")

install(TARGETS ${PROJECT_NAME} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib RUNTIME DESTINATION bin)

custom_executable(static_bridge "src/static_bridge.cpp" ROS1_DEPENDENCIES TARGET_DEPENDENCIES ${ros2_interface_packages}) target_link_libraries(static_bridge ${PROJECT_NAME})

custom_executable(parameter_bridge "src/parameter_bridge.cpp" ROS1_DEPENDENCIES TARGET_DEPENDENCIES ${message_packages}) target_link_libraries(parameter_bridge ${PROJECT_NAME})

custom_executable(dynamic_bridge "src/dynamic_bridge.cpp" ROS1_DEPENDENCIES TARGET_DEPENDENCIES ${ros2_interface_packages}) target_link_libraries(dynamic_bridge ${PROJECT_NAME})

if(TEST_ROS1_BRIDGE) custom_executable(test_ros2_client_cpp "test/test_ros2_client.cpp") ament_target_dependencies("test_ros2_client_cpp${target_suffix}" "ros1_roscpp" "diagnostic_msgs") custom_executable(test_ros2_server_cpp "test/test_ros2_server.cpp") ament_target_dependencies("test_ros2_server_cpp${target_suffix}" "ros1_roscpp" "diagnostic_msgs")

set(TEST_BRIDGE_DYNAMIC_BRIDGE "$<target_file:dynamic_bridge>") set(TEST_BRIDGE_ROS2_CLIENT "$<target_file:test_ros2_client_cpp>") set(TEST_BRIDGE_ROS2_SERVER "$<target_file:test_ros2_server_cpp>") endif()

macro(targets) set(TEST_BRIDGE_RMW ${rmw_implementation})

configure_file( test/test_topics_across_dynamic_bridge.py.in test_topics_across_dynamic_bridge${target_suffix}.py.genexp @ONLY ) file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test_topics_across_dynamic_bridge${target_suffix}_$<config>.py" INPUT "${CMAKE_CURRENT_BINARY_DIR}/test_topics_across_dynamic_bridge${target_suffix}.py.genexp" ) add_launch_test( "${CMAKE_CURRENT_BINARY_DIR}/test_topics_across_dynamic_bridge${target_suffix}_$<config>.py" TARGET test_topics_across_dynamic_bridge${target_suffix} ENV RMW_IMPLEMENTATION=${rmw_implementation} TIMEOUT 60)

configure_file( test/test_services_across_dynamic_bridge.py.in test_services_across_dynamic_bridge${target_suffix}.py.genexp @ONLY ) file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test_services_across_dynamic_bridge${target_suffix}_$<config>.py" INPUT "${CMAKE_CURRENT_BINARY_DIR}/test_services_across_dynamic_bridge${target_suffix}.py.genexp" ) add_launch_test( "${CMAKE_CURRENT_BINARY_DIR}/test_services_across_dynamic_bridge${target_suffix}_$<config>.py" TARGET test_services_across_dynamic_bridge${target_suffix} ENV RMW_IMPLEMENTATION=${rmw_implementation} TIMEOUT 60) endmacro()

if(TEST_ROS1_BRIDGE) find_package(launch_testing_ament_cmake REQUIRED)

add_executable(test_ros1_client "test/test_ros1_client.cpp") ament_target_dependencies(test_ros1_client "ros1_roscpp") add_executable(test_ros1_server "test/test_ros1_server.cpp") ament_target_dependencies(test_ros1_server "ros1_roscpp") set(TEST_BRIDGE_ROS1_ENV "${ros1_roslaunch_PREFIX}/env.sh") set(TEST_BRIDGE_ROSCORE "${ros1_roslaunch_PREFIX}/bin/roscore") set(TEST_BRIDGE_ROS1_CLIENT "$<target_file:test_ros1_client>") set(TEST_BRIDGE_ROS1_SERVER "$<target_file:test_ros1_server>")

call_for_each_rmw_implementation(targets) endif()

install( PROGRAMS bin/ros1_bridge_generate_factories DESTINATION lib/${PROJECT_NAME}/generate_factories ) install( DIRECTORY cmake DESTINATION share/${PROJECT_NAME} ) install( DIRECTORY include/ DESTINATION include ) install( DIRECTORY resource DESTINATION share/${PROJECT_NAME}

On the other hand, package.xml:

<package format="3"> <name>ros1_bridge</name> <version>0.7.2</version> <description>A simple bridge between ROS 1 and ROS 2</description> <maintainer email="dthomas@osrfoundation.org">Dirk Thomas</maintainer> <license>Apache License 2.0</license>

<buildtool_depend>ament_cmake</buildtool_depend> <buildtool_depend>ament_index_python</buildtool_depend> <buildtool_depend>python3-catkin-pkg-modules</buildtool_depend> <buildtool_depend>rosidl_cmake</buildtool_depend> <buildtool_depend>rosidl_parser</buildtool_depend>

<build_depend>builtin_interfaces</build_depend> <build_depend>pkg-config</build_depend> <build_depend>python3-yaml</build_depend> <build_depend>rclcpp</build_depend> <build_depend>rcutils</build_depend> <build_depend>rmw_implementation_cmake</build_depend> <build_depend>std_msgs</build_depend> <build_depend>new_msgs</build_depend>

<buildtool_export_depend>pkg-config</buildtool_export_depend>

<exec_depend>builtin_interfaces</exec_depend> <exec_depend>python3-yaml</exec_depend> <exec_depend>rclcpp</exec_depend> <exec_depend>rcutils</exec_depend> <exec_depend>std_msgs</exec_depend> <exec_depend>new_msgs</exec_depend>

<test_depend>ament_lint_auto</test_depend> <test_depend>ament_lint_common</test_depend> <test_depend>demo_nodes_cpp</test_depend> <test_depend>diagnostic_msgs</test_depend> <test_depend>launch</test_depend> <test_depend>launch_testing</test_depend> <test_depend>launch_testing_ament_cmake</test_depend> <test_depend>launch_testing_ros</test_depend> <test_depend>ros2run</test_depend>

<group_depend>rosidl_interface_packages</group_depend>

<export> <build_type>ament_cmake</build_type> </export> </package>

**Then, when I try to compile by using:

colcon build --merge-install --symlink-install --packages-select ros1_bridge --cmake-force-configure

I get the following error:**

root@robesafe-GT62VR-7RE:~/ros1_bridge_ws# colcon build --merge-install --symlink-install --packages-select ros1_bridge --cmake-force-configure Starting >>> ros1_bridge --- stderr: ros1_bridge
libros1_bridge.so: undefined reference to ros1_bridge::get_factory_new_msgs__msg__YoloList(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' libros1_bridge.so: undefined reference toros1_bridge::get_factory_new_msgs__msg__Header(std::__cxx11::basic_string<char, std::char_traits<char="">, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char="">, std::allocator<char> > const&)' libros1_bridge.so: undefined reference to ros1_bridge::get_factory_new_msgs__msg__YoloObstacle(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' collect2: error: ld returned 1 exit status make[2]: *** [parameter_bridge] Error 1 make[1]: *** [CMakeFiles/parameter_bridge.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... libros1_bridge.so: undefined reference toros1_bridge::get_factory_new_msgs__msg__YoloList(std::__cxx11::basic_string<char, std::char_traits<char="">, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char="">, std::allocator<char> > const&)' libros1_bridge.so: undefined reference to ros1_bridge::get_factory_new_msgs__msg__Header(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' libros1_bridge.so: undefined reference toros1_bridge::get_factory_new_msgs__msg__YoloObstacle(std::__cxx11::basic_string<char, std::char_traits<char="">, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char="">, std::allocator<char> > const&)' collect2: error: ld returned 1 exit status make[2]: * [dynamic_bridge] Error 1 make[1]: [CMakeFiles/dynamic_bridge.dir/all] Error 2 libros1_bridge.so: undefined reference to ros1_bridge::get_factory_new_msgs__msg__YoloList(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' libros1_bridge.so: undefined reference toros1_bridge::get_factory_new_msgs__msg__Header(std::__cxx11::basic_string<char, std::char_traits<char="">, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char="">, std::allocator<char> > const&)' libros1_bridge.so: undefined reference to `ros1_bridge::get_factory_new_msgs__msg__YoloObstacle(std::__cxx11::basic_string<char, std::char_traits<char="">, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char="">, std::allocator<char> > const&)' collect2: error: ld returned 1 exit status make[2]: [static_bridge] Error 1 make[1]: * [CMakeFiles/static_bridge.dir/all] Error 2

Any idea :( ??

Carlos

ROS1 bridge ROS2

**Hi,Hi,

I am trying to communicate ROS1 (Melodic) and ROS2 (Dashing), but I am not able after several attempts ... My ROS2 package is called new_msgs, the same name that in ROS1 workspace, with the same .msg:

YoloList.msg
YoloObstacle.msg

YoloObstacle.msg

I have modified my CMakeLists.txt and package.xml of this ros1_bridge as following:**following:

CMakeLists.txt:

cmake_minimum_required(VERSION 3.5)

project(ros1_bridge)

3.5) project(ros1_bridge) # Default to C++14

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) endif()

endif() find_package(rmw REQUIRED)

REQUIRED) find_package(ament_cmake REQUIRED) find_package(rclcpp REQUIRED) find_package(rmw_implementation_cmake REQUIRED) find_package(std_msgs REQUIRED) find_package(new_msgs REQUIRED)

REQUIRED) # find ROS 1 packages

packages set(cmake_extras_files cmake/find_ros1_package.cmake cmake/find_ros1_interface_packages.cmake) include(cmake/find_ros1_package.cmake)

include(cmake/find_ros1_package.cmake) find_package(PkgConfig) if(NOT PKG_CONFIG_FOUND) message(WARNING "Failed to find PkgConfig, skipping...") # call ament_package() to avoid ament_tools treating this as a plain CMake pkg ament_package() return() endif()

endif() find_ros1_package(roscpp) if(NOT ros1_roscpp_FOUND) message(WARNING "Failed to find ROS 1 roscpp, skipping...") # call ament_package() to avoid ament_tools treating this as a plain CMake pkg ament_package( CONFIG_EXTRAS ${cmake_extras_files} ) return() endif()

endif() find_ros1_package(std_msgs REQUIRED) find_ros1_package(new_msgs REQUIRED)

REQUIRED) # find ROS 1 packages with messages / services

services include(cmake/find_ros1_interface_packages.cmake) find_ros1_interface_packages(ros1_message_packages)

find_ros1_interface_packages(ros1_message_packages) set(prefixed_ros1_message_packages "") foreach(ros1_message_package ${ros1_message_packages}) # TODO(karsten1987): This is currently a workaround to work with ROS 2 classloader # rather than ROS 1 classloader. if(NOT "${ros1_message_package}" STREQUAL "nodelet") find_ros1_package(${ros1_message_package} REQUIRED) list(APPEND prefixed_ros1_message_packages "ros1_${ros1_message_package}") endif() endforeach()

endforeach() set(TEST_ROS1_BRIDGE FALSE) if(BUILD_TESTING) find_package(ament_lint_auto REQUIRED) find_package(diagnostic_msgs REQUIRED) find_ros1_package(diagnostic_msgs) find_ros1_package(roslaunch) ament_lint_auto_find_test_dependencies() if(ros1_diagnostic_msgs_FOUND AND ros1_roslaunch_FOUND) # ensure that the ROS 2 diagnostic_msgs was found by find_package # and not the ROS 1 package set(_ros1_diagnostic_msgs_DIR "${ros1_diagnostic_msgs_PREFIX}/share/diagnostic_msgs/cmake") if("${diagnostic_msgs_DIR}" STREQUAL "${_ros1_diagnostic_msgs_DIR}") # invalidate the cached result to retry finding the package next time unset(diagnostic_msgs_DIR CACHE) message(FATAL_ERROR "Failed to find ROS 2 package 'diagnostic_msgs'") endif() set(TEST_ROS1_BRIDGE TRUE) endif() endif()

endif() ament_export_include_directories(include) ament_export_libraries(${PROJECT_NAME})

ament_python_install_package(${PROJECT_NAME})

ament_export_libraries(${PROJECT_NAME}) ament_python_install_package(${PROJECT_NAME}) ament_package( CONFIG_EXTRAS ${cmake_extras_files} )

) set(generated_path "${CMAKE_BINARY_DIR}/generated") set(generated_files "${generated_path}/get_factory.cpp") list(APPEND generated_files "${generated_path}/get_mappings.cpp")

"${generated_path}/get_mappings.cpp") # generate per interface compilation units to keep the memory usage low

low ament_index_get_resources(ros2_interface_packages "rosidl_interfaces") foreach(package_name ${ros2_interface_packages}) find_package(${package_name} QUIET REQUIRED) message(STATUS "Found ${package_name}: ${${package_name}_VERSION} (${${package_name}_DIR})") if(NOT "${package_name}" STREQUAL "builtin_interfaces") list(APPEND generated_files "${generated_path}/${package_name}_factories.cpp") list(APPEND generated_files "${generated_path}/${package_name}_factories.hpp") foreach(interface_file ${${package_name}_INTERFACE_FILES}) file(TO_CMAKE_PATH "${interface_file}" interface_name) get_filename_component(interface_basename "${interface_name}" NAME_WE) # skipping actions and request and response messages of services if(NOT "${interface_name}" MATCHES "^(msg|srv)/" OR "${interface_basename}" MATCHES "_(Request|Response)$") continue() endif() string(REPLACE "/" "__" interface_name "${interface_name}") get_filename_component(interface_name "${interface_name}" NAME_WE) list(APPEND generated_files "${generated_path}/${package_name}__${interface_name}__factories.cpp") endforeach() endif() endforeach()

endforeach() set(target_dependencies "bin/ros1_bridge_generate_factories" "resource/get_factory.cpp.em" "resource/get_mappings.cpp.em" "resource/interface_factories.cpp.em" "resource/pkg_factories.cpp.em" "resource/pkg_factories.hpp.em" "ros1_bridge/__init__.py")

"ros1_bridge/__init__.py") add_custom_command( OUTPUT ${generated_files} COMMAND ${PYTHON_EXECUTABLE} bin/ros1_bridge_generate_factories --output-path "${generated_path}" --template-dir resource DEPENDS ${target_dependencies} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMENT "Generating factories for interface types")

types") if(NOT WIN32) # ignore warning in ROS 1 message headers set_source_files_properties(${generated_files} PROPERTIES COMPILE_FLAGS "-Wno-unused-parameter") endif()

endif() include_directories(include ${generated_path})

${generated_path}) function(custom_executable target) cmake_parse_arguments( ARG "ROS1_DEPENDENCIES" "" "TARGET_DEPENDENCIES" ${ARGN})

${ARGN}) add_executable(${target} ${ARG_UNPARSED_ARGUMENTS}) ament_target_dependencies(${target} "rclcpp" ${ARG_TARGET_DEPENDENCIES}) if(ARG_ROS1_DEPENDENCIES) ament_target_dependencies(${target} "ros1_roscpp" "ros1_std_msgs" "ros1_new_msgs") endif() if(ARG_DEPENDENCIES) add_dependencies(${target} ${ARG_DEPENDENCIES}) endif()

endif() install(TARGETS ${target} DESTINATION lib/${PROJECT_NAME}) endfunction()

endfunction() custom_executable(simple_bridge_1_to_2 "src/simple_bridge_1_to_2.cpp" ROS1_DEPENDENCIES TARGET_DEPENDENCIES "std_msgs" "new_msgs") custom_executable(simple_bridge_2_to_1 "src/simple_bridge_2_to_1.cpp" ROS1_DEPENDENCIES TARGET_DEPENDENCIES "std_msgs" "new_msgs")

"new_msgs") custom_executable(simple_bridge "src/simple_bridge.cpp" ROS1_DEPENDENCIES TARGET_DEPENDENCIES "std_msgs" "new_msgs")

"new_msgs") add_library(${PROJECT_NAME} SHARED "src/builtin_interfaces_factories.cpp" "src/convert_builtin_interfaces.cpp" "src/bridge.cpp" ${generated_files}) ament_target_dependencies(${PROJECT_NAME} ${prefixed_ros1_message_packages} ${ros2_interface_packages} "rclcpp" "ros1_roscpp" "ros1_std_msgs" "ros1_new_msgs")

"ros1_new_msgs") install(TARGETS ${PROJECT_NAME} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib RUNTIME DESTINATION bin)

bin) custom_executable(static_bridge "src/static_bridge.cpp" ROS1_DEPENDENCIES TARGET_DEPENDENCIES ${ros2_interface_packages}) target_link_libraries(static_bridge ${PROJECT_NAME})

${PROJECT_NAME}) custom_executable(parameter_bridge "src/parameter_bridge.cpp" ROS1_DEPENDENCIES TARGET_DEPENDENCIES ${message_packages}) target_link_libraries(parameter_bridge ${PROJECT_NAME})

${PROJECT_NAME}) custom_executable(dynamic_bridge "src/dynamic_bridge.cpp" ROS1_DEPENDENCIES TARGET_DEPENDENCIES ${ros2_interface_packages}) target_link_libraries(dynamic_bridge ${PROJECT_NAME})

${PROJECT_NAME}) if(TEST_ROS1_BRIDGE) custom_executable(test_ros2_client_cpp "test/test_ros2_client.cpp") ament_target_dependencies("test_ros2_client_cpp${target_suffix}" "ros1_roscpp" "diagnostic_msgs") custom_executable(test_ros2_server_cpp "test/test_ros2_server.cpp") ament_target_dependencies("test_ros2_server_cpp${target_suffix}" "ros1_roscpp" "diagnostic_msgs")

"diagnostic_msgs") set(TEST_BRIDGE_DYNAMIC_BRIDGE "$<target_file:dynamic_bridge>") "$<TARGET_FILE:dynamic_bridge>") set(TEST_BRIDGE_ROS2_CLIENT "$<target_file:test_ros2_client_cpp>") "$<TARGET_FILE:test_ros2_client_cpp>") set(TEST_BRIDGE_ROS2_SERVER "$<target_file:test_ros2_server_cpp>") endif()

"$<TARGET_FILE:test_ros2_server_cpp>") endif() macro(targets) set(TEST_BRIDGE_RMW ${rmw_implementation})

${rmw_implementation}) configure_file( test/test_topics_across_dynamic_bridge.py.in test_topics_across_dynamic_bridge${target_suffix}.py.genexp @ONLY ) file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test_topics_across_dynamic_bridge${target_suffix}_$<config>.py" "${CMAKE_CURRENT_BINARY_DIR}/test_topics_across_dynamic_bridge${target_suffix}_$<CONFIG>.py" INPUT "${CMAKE_CURRENT_BINARY_DIR}/test_topics_across_dynamic_bridge${target_suffix}.py.genexp" ) add_launch_test( "${CMAKE_CURRENT_BINARY_DIR}/test_topics_across_dynamic_bridge${target_suffix}_$<config>.py" "${CMAKE_CURRENT_BINARY_DIR}/test_topics_across_dynamic_bridge${target_suffix}_$<CONFIG>.py" TARGET test_topics_across_dynamic_bridge${target_suffix} ENV RMW_IMPLEMENTATION=${rmw_implementation} TIMEOUT 60)

60) configure_file( test/test_services_across_dynamic_bridge.py.in test_services_across_dynamic_bridge${target_suffix}.py.genexp @ONLY ) file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test_services_across_dynamic_bridge${target_suffix}_$<config>.py" "${CMAKE_CURRENT_BINARY_DIR}/test_services_across_dynamic_bridge${target_suffix}_$<CONFIG>.py" INPUT "${CMAKE_CURRENT_BINARY_DIR}/test_services_across_dynamic_bridge${target_suffix}.py.genexp" ) add_launch_test( "${CMAKE_CURRENT_BINARY_DIR}/test_services_across_dynamic_bridge${target_suffix}_$<config>.py" "${CMAKE_CURRENT_BINARY_DIR}/test_services_across_dynamic_bridge${target_suffix}_$<CONFIG>.py" TARGET test_services_across_dynamic_bridge${target_suffix} ENV RMW_IMPLEMENTATION=${rmw_implementation} TIMEOUT 60) endmacro()

endmacro() if(TEST_ROS1_BRIDGE) find_package(launch_testing_ament_cmake REQUIRED)

REQUIRED) add_executable(test_ros1_client "test/test_ros1_client.cpp") ament_target_dependencies(test_ros1_client "ros1_roscpp") add_executable(test_ros1_server "test/test_ros1_server.cpp") ament_target_dependencies(test_ros1_server "ros1_roscpp") set(TEST_BRIDGE_ROS1_ENV "${ros1_roslaunch_PREFIX}/env.sh") set(TEST_BRIDGE_ROSCORE "${ros1_roslaunch_PREFIX}/bin/roscore") set(TEST_BRIDGE_ROS1_CLIENT "$<target_file:test_ros1_client>") "$<TARGET_FILE:test_ros1_client>") set(TEST_BRIDGE_ROS1_SERVER "$<target_file:test_ros1_server>")

"$<TARGET_FILE:test_ros1_server>") call_for_each_rmw_implementation(targets) endif()

endif() install( PROGRAMS bin/ros1_bridge_generate_factories DESTINATION lib/${PROJECT_NAME}/generate_factories ) install( DIRECTORY cmake DESTINATION share/${PROJECT_NAME} ) install( DIRECTORY include/ DESTINATION include ) install( DIRECTORY resource DESTINATION share/${PROJECT_NAME}

share/${PROJECT_NAME}

On the other hand, package.xml:

<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
  <name>ros1_bridge</name>
  <version>0.7.2</version>
  <description>A simple bridge between ROS 1 and ROS 2</description>
  <maintainer email="dthomas@osrfoundation.org">Dirk Thomas</maintainer>
  <license>Apache License 2.0</license>

2.0</license> <buildtool_depend>ament_cmake</buildtool_depend> <buildtool_depend>ament_index_python</buildtool_depend> <buildtool_depend>python3-catkin-pkg-modules</buildtool_depend> <buildtool_depend>rosidl_cmake</buildtool_depend> <buildtool_depend>rosidl_parser</buildtool_depend> <build_depend>builtin_interfaces</build_depend> <build_depend>pkg-config</build_depend> <build_depend>python3-yaml</build_depend> <build_depend>rclcpp</build_depend> <build_depend>rcutils</build_depend> <build_depend>rmw_implementation_cmake</build_depend> <build_depend>std_msgs</build_depend> <build_depend>new_msgs</build_depend> <buildtool_export_depend>pkg-config</buildtool_export_depend> <exec_depend>builtin_interfaces</exec_depend> <exec_depend>python3-yaml</exec_depend> <exec_depend>rclcpp</exec_depend> <exec_depend>rcutils</exec_depend> <exec_depend>std_msgs</exec_depend> <exec_depend>new_msgs</exec_depend> <test_depend>ament_lint_auto</test_depend> <test_depend>ament_lint_common</test_depend> <test_depend>demo_nodes_cpp</test_depend> <test_depend>diagnostic_msgs</test_depend> <test_depend>launch</test_depend> <test_depend>launch_testing</test_depend> <test_depend>launch_testing_ament_cmake</test_depend> <test_depend>launch_testing_ros</test_depend> <test_depend>ros2run</test_depend> <group_depend>rosidl_interface_packages</group_depend> <export> <build_type>ament_cmake</build_type> </export> </package>

<buildtool_depend>ament_cmake</buildtool_depend> <buildtool_depend>ament_index_python</buildtool_depend> <buildtool_depend>python3-catkin-pkg-modules</buildtool_depend> <buildtool_depend>rosidl_cmake</buildtool_depend> <buildtool_depend>rosidl_parser</buildtool_depend>

<build_depend>builtin_interfaces</build_depend> <build_depend>pkg-config</build_depend> <build_depend>python3-yaml</build_depend> <build_depend>rclcpp</build_depend> <build_depend>rcutils</build_depend> <build_depend>rmw_implementation_cmake</build_depend> <build_depend>std_msgs</build_depend> <build_depend>new_msgs</build_depend>

<buildtool_export_depend>pkg-config</buildtool_export_depend>

<exec_depend>builtin_interfaces</exec_depend> <exec_depend>python3-yaml</exec_depend> <exec_depend>rclcpp</exec_depend> <exec_depend>rcutils</exec_depend> <exec_depend>std_msgs</exec_depend> <exec_depend>new_msgs</exec_depend>

<test_depend>ament_lint_auto</test_depend> <test_depend>ament_lint_common</test_depend> <test_depend>demo_nodes_cpp</test_depend> <test_depend>diagnostic_msgs</test_depend> <test_depend>launch</test_depend> <test_depend>launch_testing</test_depend> <test_depend>launch_testing_ament_cmake</test_depend> <test_depend>launch_testing_ros</test_depend> <test_depend>ros2run</test_depend>

<group_depend>rosidl_interface_packages</group_depend>

<export> <build_type>ament_cmake</build_type> </export> </package>

**Then, Then, when I try to compile by using:

colcon build --merge-install --symlink-install --packages-select ros1_bridge --cmake-force-configure

--cmake-force-configure

I get the following error:**error:

root@robesafe-GT62VR-7RE:~/ros1_bridge_ws# colcon build --merge-install --symlink-install --packages-select ros1_bridge --cmake-force-configure
Starting >>> ros1_bridge
--- stderr: ros1_bridge 
libros1_bridge.so: undefined reference to ros1_bridge::get_factory_new_msgs__msg__YoloList(std::__cxx11::basic_string<char, `ros1_bridge::get_factory_new_msgs__msg__YoloList(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' libros1_bridge.so: undefined reference toros1_bridge::get_factory_new_msgs__msg__Header(std::__cxx11::basic_string<char, std::char_traits<char="">, to `ros1_bridge::get_factory_new_msgs__msg__Header(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char="">, std::char_traits<char>, std::allocator<char> > const&)' libros1_bridge.so: undefined reference to ros1_bridge::get_factory_new_msgs__msg__YoloObstacle(std::__cxx11::basic_string<char, `ros1_bridge::get_factory_new_msgs__msg__YoloObstacle(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' collect2: error: ld returned 1 exit status make[2]: *** [parameter_bridge] Error 1 make[1]: *** [CMakeFiles/parameter_bridge.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... libros1_bridge.so: undefined reference toros1_bridge::get_factory_new_msgs__msg__YoloList(std::__cxx11::basic_string<char, std::char_traits<char="">, to `ros1_bridge::get_factory_new_msgs__msg__YoloList(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char="">, std::char_traits<char>, std::allocator<char> > const&)' libros1_bridge.so: undefined reference to ros1_bridge::get_factory_new_msgs__msg__Header(std::__cxx11::basic_string<char, `ros1_bridge::get_factory_new_msgs__msg__Header(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' libros1_bridge.so: undefined reference toros1_bridge::get_factory_new_msgs__msg__YoloObstacle(std::__cxx11::basic_string<char, std::char_traits<char="">, to `ros1_bridge::get_factory_new_msgs__msg__YoloObstacle(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char="">, std::char_traits<char>, std::allocator<char> > const&)' collect2: error: ld returned 1 exit status make[2]: * *** [dynamic_bridge] Error 1 make[1]: *** [CMakeFiles/dynamic_bridge.dir/all] Error 2 libros1_bridge.so: undefined reference to ros1_bridge::get_factory_new_msgs__msg__YoloList(std::__cxx11::basic_string<char, `ros1_bridge::get_factory_new_msgs__msg__YoloList(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' libros1_bridge.so: undefined reference toros1_bridge::get_factory_new_msgs__msg__Header(std::__cxx11::basic_string<char, std::char_traits<char="">, to `ros1_bridge::get_factory_new_msgs__msg__Header(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char="">, std::char_traits<char>, std::allocator<char> > const&)' libros1_bridge.so: undefined reference to `ros1_bridge::get_factory_new_msgs__msg__YoloObstacle(std::__cxx11::basic_string<char, std::char_traits<char="">, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char="">, std::char_traits<char>, std::allocator<char> > const&)' collect2: error: ld returned 1 exit status make[2]: *** [static_bridge] Error 1 make[1]: * *** [CMakeFiles/static_bridge.dir/all] Error 2

2

Any idea :( ??

Carlos

ROS1 bridge ROS2

Hi,

I am trying to communicate ROS1 (Melodic) and ROS2 (Dashing), but I am not able after several attempts ... My ROS2 package is called new_msgs, the same name that in ROS1 workspace, with the same .msg:

YoloList.msg
YoloObstacle.msg

Now I have modified my describe the package.xml and CMakeLists.txt and package.xml of this ros1_bridge as following:

CMakeLists.txt:

ROS2 workspace:

package.xml:

<package format="3"> <name>new_msgs</name> <version>0.0.1</version> <description>New message defined for ROS2</description> <maintainer email="cram3r95@gmail.com">root</maintainer> <license>Apache License 2.0</license>

<author>CGH</author>

<buildtool_depend>ament_cmake</buildtool_depend>

<build_depend>rosidl_default_generators</build_depend> <exec_depend>rosidl_default_runtime</exec_depend>

<member_of_group>rosidl_interface_packages</member_of_group>

<export> <build_type>ament_cmake</build_type> </export> </package>

CMakeLists.txt

cmake_minimum_required(VERSION 3.5) project(ros1_bridge) # project(new_msgs)

Default to C++14 C++14

if(NOT CMAKE_CXX_STANDARD) set(CMAKE_CXX_STANDARD 14) endif() endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_compile_options(-Wall -Wextra) endif() find_package(rmw REQUIRED) -Wextra -Wpedantic) endif()

find dependencies

find_package(ament_cmake REQUIRED) find_package(rclcpp REQUIRED) find_package(rmw_implementation_cmake find_package(rosidl_default_generators REQUIRED) find_package(std_msgs REQUIRED) find_package(new_msgs REQUIRED) # find ROS 1 packages set(cmake_extras_files cmake/find_ros1_package.cmake cmake/find_ros1_interface_packages.cmake) include(cmake/find_ros1_package.cmake) find_package(PkgConfig) if(NOT PKG_CONFIG_FOUND) message(WARNING "Failed REQUIRED)

uncomment the following section in order to find PkgConfig, skipping...") # call ament_package() to avoid ament_tools treating this fill in

further dependencies manually.

find_package(<dependency> REQUIRED)

rosidl_generate_interfaces(new_msgs "msg/YoloObstacle.msg" "msg/YoloList.msg" "msg/Header.msg" DEPENDENCIES builtin_interfaces std_msgs )

ament_package()

Now I describe the package.xml and CMakeLists.txt of ROS1 workspace:

<package format="2"> <name>new_msgs</name> <version>0.0.0</version> <description>The new_msgs package</description>

<maintainer email="root@todo.todo">root</maintainer>

<license>TODO</license>

<buildtool_depend>catkin</buildtool_depend> <build_depend>roscpp</build_depend> <build_depend>rospy</build_depend> <build_depend>sensor_msgs</build_depend> <build_depend>std_msgs</build_depend> <build_export_depend>roscpp</build_export_depend> <build_export_depend>rospy</build_export_depend> <build_export_depend>sensor_msgs</build_export_depend> <build_export_depend>std_msgs</build_export_depend> <exec_depend>roscpp</exec_depend> <exec_depend>rospy</exec_depend> <exec_depend>sensor_msgs</exec_depend> <exec_depend>std_msgs</exec_depend>

<export>

</export> </package>

CMakeLists.txt

cmake_minimum_required(VERSION 2.8.3) project(new_msgs)

Compile as a plain CMake pkg ament_package() return() endif() find_ros1_package(roscpp) if(NOT ros1_roscpp_FOUND) message(WARNING "Failed to find ROS 1 roscpp, skipping...") # call ament_package() to avoid ament_tools treating this as a plain CMake pkg ament_package( CONFIG_EXTRAS ${cmake_extras_files} ) return() endif() find_ros1_package(std_msgs REQUIRED) find_ros1_package(new_msgs REQUIRED) # find ROS 1 packages with messages / services include(cmake/find_ros1_interface_packages.cmake) find_ros1_interface_packages(ros1_message_packages) set(prefixed_ros1_message_packages "") foreach(ros1_message_package ${ros1_message_packages}) # TODO(karsten1987): This is currently a workaround to work with ROS 2 classloader # rather than ROS 1 classloader. if(NOT "${ros1_message_package}" STREQUAL "nodelet") find_ros1_package(${ros1_message_package} REQUIRED) list(APPEND prefixed_ros1_message_packages "ros1_${ros1_message_package}") endif() endforeach() set(TEST_ROS1_BRIDGE FALSE) if(BUILD_TESTING) find_package(ament_lint_auto REQUIRED) find_package(diagnostic_msgs REQUIRED) find_ros1_package(diagnostic_msgs) find_ros1_package(roslaunch) ament_lint_auto_find_test_dependencies() if(ros1_diagnostic_msgs_FOUND AND ros1_roslaunch_FOUND) # ensure that the ROS 2 diagnostic_msgs was found by find_package # and not the ROS 1 package set(_ros1_diagnostic_msgs_DIR "${ros1_diagnostic_msgs_PREFIX}/share/diagnostic_msgs/cmake") if("${diagnostic_msgs_DIR}" STREQUAL "${_ros1_diagnostic_msgs_DIR}") # invalidate the cached result to retry finding the package next time unset(diagnostic_msgs_DIR CACHE) message(FATAL_ERROR "Failed to find ROS 2 package 'diagnostic_msgs'") endif() set(TEST_ROS1_BRIDGE TRUE) endif() endif() ament_export_include_directories(include) ament_export_libraries(${PROJECT_NAME}) ament_python_install_package(${PROJECT_NAME}) ament_package( CONFIG_EXTRAS ${cmake_extras_files} ) set(generated_path "${CMAKE_BINARY_DIR}/generated") set(generated_files "${generated_path}/get_factory.cpp") list(APPEND generated_files "${generated_path}/get_mappings.cpp") # generate per interface compilation units to keep the memory usage low ament_index_get_resources(ros2_interface_packages "rosidl_interfaces") foreach(package_name ${ros2_interface_packages}) find_package(${package_name} QUIET REQUIRED) message(STATUS "Found ${package_name}: ${${package_name}_VERSION} (${${package_name}_DIR})") if(NOT "${package_name}" STREQUAL "builtin_interfaces") list(APPEND generated_files "${generated_path}/${package_name}_factories.cpp") list(APPEND generated_files "${generated_path}/${package_name}_factories.hpp") foreach(interface_file ${${package_name}_INTERFACE_FILES}) file(TO_CMAKE_PATH "${interface_file}" interface_name) get_filename_component(interface_basename "${interface_name}" NAME_WE) # skipping actions and request and response messages of services if(NOT "${interface_name}" MATCHES "^(msg|srv)/" OR "${interface_basename}" MATCHES "_(Request|Response)$") continue() endif() string(REPLACE "/" "__" interface_name "${interface_name}") get_filename_component(interface_name "${interface_name}" NAME_WE) list(APPEND generated_files "${generated_path}/${package_name}__${interface_name}__factories.cpp") endforeach() endif() endforeach() set(target_dependencies "bin/ros1_bridge_generate_factories" "resource/get_factory.cpp.em" "resource/get_mappings.cpp.em" "resource/interface_factories.cpp.em" "resource/pkg_factories.cpp.em" "resource/pkg_factories.hpp.em" "ros1_bridge/__init__.py") add_custom_command( OUTPUT ${generated_files} COMMAND ${PYTHON_EXECUTABLE} bin/ros1_bridge_generate_factories --output-path "${generated_path}" --template-dir resource DEPENDS ${target_dependencies} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMENT "Generating factories for interface types") if(NOT WIN32) # ignore warning C++11, supported in ROS 1 Kinetic and newer

add_compile_options(-std=c++11)

Find catkin macros and libraries

if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)

is used, also find other catkin packages

find_package(catkin REQUIRED COMPONENTS roscpp rospy sensor_msgs std_msgs message_generation )

System dependencies are found with CMake's conventions

find_package(Boost REQUIRED COMPONENTS system)

Uncomment this if the package has a setup.py. This macro ensures

modules and global scripts declared therein get installed

See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html

catkin_python_setup()

#

Declare ROS messages, services and actions

#

To declare and build messages, services or actions from within this

package, follow these steps:

* Let MSG_DEP_SET be the set of packages whose message headers set_source_files_properties(${generated_files} types you use in

your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...).

* In the file package.xml:

* add a build_depend tag for "message_generation"

* add a build_depend and a exec_depend tag for each package in MSG_DEP_SET

* If MSG_DEP_SET isn't empty the following dependency has been pulled in

but can be declared for certainty nonetheless:

* add a exec_depend tag for "message_runtime"

* In this file (CMakeLists.txt):

* add "message_generation" and every package in MSG_DEP_SET to

find_package(catkin REQUIRED COMPONENTS ...)

* add "message_runtime" and every package in MSG_DEP_SET to

catkin_package(CATKIN_DEPENDS ...)

* uncomment the add_*_files sections below as needed

and list every .msg/.srv/.action file to be processed

* uncomment the generate_messages entry below

* add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...)

Generate messages in the 'msg' folder

add_message_files( FILES Header.msg YoloList.msg YoloObstacle.msg )

Generate services in the 'srv' folder

add_service_files(

FILES

Service1.srv

Service2.srv

)

Generate actions in the 'action' folder

add_action_files(

FILES

Action1.action

Action2.action

)

Generate added messages and services with any dependencies listed here

generate_messages( DEPENDENCIES sensor_msgs std_msgs )

#

Declare ROS dynamic reconfigure parameters

#

To declare and build dynamic reconfigure parameters within this

package, follow these steps:

* In the file package.xml:

* add a build_depend and a exec_depend tag for "dynamic_reconfigure"

* In this file (CMakeLists.txt):

* add "dynamic_reconfigure" to

find_package(catkin REQUIRED COMPONENTS ...)

* uncomment the "generate_dynamic_reconfigure_options" section below

and list every .cfg file to be processed

Generate dynamic reconfigure parameters in the 'cfg' folder

generate_dynamic_reconfigure_options(

cfg/DynReconf1.cfg

cfg/DynReconf2.cfg

)

#

catkin specific configuration

#

The catkin_package macro generates cmake config files for your package

Declare things to be passed to dependent projects

INCLUDE_DIRS: uncomment this if your package contains header files

LIBRARIES: libraries you create in this project that dependent projects also need

CATKIN_DEPENDS: catkin_packages dependent projects also need

DEPENDS: system dependencies of this project that dependent projects also need

catkin_package(

INCLUDE_DIRS include

LIBRARIES new_msgs

CATKIN_DEPENDS roscpp rospy sensor_msgs std_msgs

CATKIN DEPENDS message_runtime

DEPENDS system_lib

)

#

Build

#

Specify additional locations of header files

Your package locations should be listed before other locations

include_directories(

include

${catkin_INCLUDE_DIRS} )

Declare a C++ library

add_library(${PROJECT_NAME}

src/${PROJECT_NAME}/new_msgs.cpp

)

Add cmake target dependencies of the library

as an example, code may need to be generated before libraries

either from message generation or dynamic reconfigure

add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})

Declare a C++ executable

With catkin_make all packages are built within a single CMake context

The recommended prefix ensures that target names across packages don't collide

add_executable(${PROJECT_NAME}_node src/new_msgs_node.cpp)

Rename C++ executable without prefix

The above recommended prefix causes long target names, the following renames the

target back to the shorter version for ease of user use

e.g. "rosrun someones_pkg node" instead of "rosrun someones_pkg someones_pkg_node"

set_target_properties(${PROJECT_NAME}_node PROPERTIES COMPILE_FLAGS "-Wno-unused-parameter") endif() include_directories(include ${generated_path}) function(custom_executable target) cmake_parse_arguments( ARG "ROS1_DEPENDENCIES" "" "TARGET_DEPENDENCIES" ${ARGN}) add_executable(${target} ${ARG_UNPARSED_ARGUMENTS}) ament_target_dependencies(${target} "rclcpp" ${ARG_TARGET_DEPENDENCIES}) if(ARG_ROS1_DEPENDENCIES) ament_target_dependencies(${target} "ros1_roscpp" "ros1_std_msgs" "ros1_new_msgs") endif() if(ARG_DEPENDENCIES) add_dependencies(${target} ${ARG_DEPENDENCIES}) endif() OUTPUT_NAME node PREFIX "")

Add cmake target dependencies of the executable

same as for the library above

add_dependencies(${PROJECT_NAME}_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})

Specify libraries to link a library or executable target against

target_link_libraries(${PROJECT_NAME}_node

${catkin_LIBRARIES}

)

#

Install

#

all install targets should use catkin DESTINATION variables

See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html

Mark executable scripts (Python etc.) for installation

in contrast to setup.py, you can choose the destination

install(PROGRAMS

scripts/my_python_script

DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}

)

Mark executables for installation

See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_executables.html

install(TARGETS ${target} ${PROJECT_NAME}_node

RUNTIME DESTINATION lib/${PROJECT_NAME}) endfunction() custom_executable(simple_bridge_1_to_2 "src/simple_bridge_1_to_2.cpp" ROS1_DEPENDENCIES TARGET_DEPENDENCIES "std_msgs" "new_msgs") custom_executable(simple_bridge_2_to_1 "src/simple_bridge_2_to_1.cpp" ROS1_DEPENDENCIES TARGET_DEPENDENCIES "std_msgs" "new_msgs") custom_executable(simple_bridge "src/simple_bridge.cpp" ROS1_DEPENDENCIES TARGET_DEPENDENCIES "std_msgs" "new_msgs") add_library(${PROJECT_NAME} SHARED "src/builtin_interfaces_factories.cpp" "src/convert_builtin_interfaces.cpp" "src/bridge.cpp" ${generated_files}) ament_target_dependencies(${PROJECT_NAME} ${prefixed_ros1_message_packages} ${ros2_interface_packages} "rclcpp" "ros1_roscpp" "ros1_std_msgs" "ros1_new_msgs") ${CATKIN_PACKAGE_BIN_DESTINATION}

)

Mark libraries for installation

See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html

install(TARGETS ${PROJECT_NAME} ${PROJECT_NAME}

ARCHIVE DESTINATION lib ${CATKIN_PACKAGE_LIB_DESTINATION}

LIBRARY DESTINATION lib ${CATKIN_PACKAGE_LIB_DESTINATION}

RUNTIME DESTINATION bin) custom_executable(static_bridge "src/static_bridge.cpp" ROS1_DEPENDENCIES TARGET_DEPENDENCIES ${ros2_interface_packages}) target_link_libraries(static_bridge ${PROJECT_NAME}) custom_executable(parameter_bridge "src/parameter_bridge.cpp" ROS1_DEPENDENCIES TARGET_DEPENDENCIES ${message_packages}) target_link_libraries(parameter_bridge ${PROJECT_NAME}) custom_executable(dynamic_bridge "src/dynamic_bridge.cpp" ROS1_DEPENDENCIES TARGET_DEPENDENCIES ${ros2_interface_packages}) target_link_libraries(dynamic_bridge ${PROJECT_NAME}) if(TEST_ROS1_BRIDGE) custom_executable(test_ros2_client_cpp "test/test_ros2_client.cpp") ament_target_dependencies("test_ros2_client_cpp${target_suffix}" "ros1_roscpp" "diagnostic_msgs") custom_executable(test_ros2_server_cpp "test/test_ros2_server.cpp") ament_target_dependencies("test_ros2_server_cpp${target_suffix}" "ros1_roscpp" "diagnostic_msgs") set(TEST_BRIDGE_DYNAMIC_BRIDGE "$<TARGET_FILE:dynamic_bridge>") set(TEST_BRIDGE_ROS2_CLIENT "$<TARGET_FILE:test_ros2_client_cpp>") set(TEST_BRIDGE_ROS2_SERVER "$<TARGET_FILE:test_ros2_server_cpp>") endif() macro(targets) set(TEST_BRIDGE_RMW ${rmw_implementation}) configure_file( test/test_topics_across_dynamic_bridge.py.in test_topics_across_dynamic_bridge${target_suffix}.py.genexp @ONLY ) file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test_topics_across_dynamic_bridge${target_suffix}_$<CONFIG>.py" INPUT "${CMAKE_CURRENT_BINARY_DIR}/test_topics_across_dynamic_bridge${target_suffix}.py.genexp" ) add_launch_test( "${CMAKE_CURRENT_BINARY_DIR}/test_topics_across_dynamic_bridge${target_suffix}_$<CONFIG>.py" TARGET test_topics_across_dynamic_bridge${target_suffix} ENV RMW_IMPLEMENTATION=${rmw_implementation} TIMEOUT 60) configure_file( test/test_services_across_dynamic_bridge.py.in test_services_across_dynamic_bridge${target_suffix}.py.genexp @ONLY ) file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test_services_across_dynamic_bridge${target_suffix}_$<CONFIG>.py" INPUT "${CMAKE_CURRENT_BINARY_DIR}/test_services_across_dynamic_bridge${target_suffix}.py.genexp" ) add_launch_test( "${CMAKE_CURRENT_BINARY_DIR}/test_services_across_dynamic_bridge${target_suffix}_$<CONFIG>.py" TARGET test_services_across_dynamic_bridge${target_suffix} ENV RMW_IMPLEMENTATION=${rmw_implementation} TIMEOUT 60) endmacro() if(TEST_ROS1_BRIDGE) find_package(launch_testing_ament_cmake REQUIRED) add_executable(test_ros1_client "test/test_ros1_client.cpp") ament_target_dependencies(test_ros1_client "ros1_roscpp") add_executable(test_ros1_server "test/test_ros1_server.cpp") ament_target_dependencies(test_ros1_server "ros1_roscpp") set(TEST_BRIDGE_ROS1_ENV "${ros1_roslaunch_PREFIX}/env.sh") set(TEST_BRIDGE_ROSCORE "${ros1_roslaunch_PREFIX}/bin/roscore") set(TEST_BRIDGE_ROS1_CLIENT "$<TARGET_FILE:test_ros1_client>") set(TEST_BRIDGE_ROS1_SERVER "$<TARGET_FILE:test_ros1_server>") call_for_each_rmw_implementation(targets) endif() install( PROGRAMS bin/ros1_bridge_generate_factories ${CATKIN_GLOBAL_BIN_DESTINATION}

)

Mark cpp header files for installation

install(DIRECTORY include/${PROJECT_NAME}/

DESTINATION lib/${PROJECT_NAME}/generate_factories ) install( DIRECTORY cmake ${CATKIN_PACKAGE_INCLUDE_DESTINATION}

FILES_MATCHING PATTERN "*.h"

PATTERN ".svn" EXCLUDE

)

Mark other files for installation (e.g. launch and bag files, etc.)

install(FILES

# myfile1

# myfile2

DESTINATION share/${PROJECT_NAME} ) install( DIRECTORY include/ DESTINATION include ) install( DIRECTORY resource DESTINATION share/${PROJECT_NAME}

On the other hand, package.xml:

<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
  <name>ros1_bridge</name>
  <version>0.7.2</version>
  <description>A simple bridge between ROS 1 ${CATKIN_PACKAGE_SHARE_DESTINATION} 

)

#

Testing

#

Add gtest based cpp test target and ROS 2</description> <maintainer email="dthomas@osrfoundation.org">Dirk Thomas</maintainer> <license>Apache License 2.0</license> <buildtool_depend>ament_cmake</buildtool_depend> <buildtool_depend>ament_index_python</buildtool_depend> <buildtool_depend>python3-catkin-pkg-modules</buildtool_depend> <buildtool_depend>rosidl_cmake</buildtool_depend> <buildtool_depend>rosidl_parser</buildtool_depend> <build_depend>builtin_interfaces</build_depend> <build_depend>pkg-config</build_depend> <build_depend>python3-yaml</build_depend> <build_depend>rclcpp</build_depend> <build_depend>rcutils</build_depend> <build_depend>rmw_implementation_cmake</build_depend> <build_depend>std_msgs</build_depend> <build_depend>new_msgs</build_depend> <buildtool_export_depend>pkg-config</buildtool_export_depend> <exec_depend>builtin_interfaces</exec_depend> <exec_depend>python3-yaml</exec_depend> <exec_depend>rclcpp</exec_depend> <exec_depend>rcutils</exec_depend> <exec_depend>std_msgs</exec_depend> <exec_depend>new_msgs</exec_depend> <test_depend>ament_lint_auto</test_depend> <test_depend>ament_lint_common</test_depend> <test_depend>demo_nodes_cpp</test_depend> <test_depend>diagnostic_msgs</test_depend> <test_depend>launch</test_depend> <test_depend>launch_testing</test_depend> <test_depend>launch_testing_ament_cmake</test_depend> <test_depend>launch_testing_ros</test_depend> <test_depend>ros2run</test_depend> <group_depend>rosidl_interface_packages</group_depend> <export> <build_type>ament_cmake</build_type> </export> </package>

link libraries

catkin_add_gtest(${PROJECT_NAME}-test test/test_new_msgs.cpp)

if(TARGET ${PROJECT_NAME}-test)

target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})

endif()

Add folders to be run by python nosetests

catkin_add_nosetests(test)

In both cases the content of the messages is exactly the same:

Header.msg

Common Header for ROS2-ROS1 communication

uint32 seq int32 sec uint32 nanosec string frame_id

YoloObstacle.msg

string type float64 probability float64 x1 float64 y1 float64 x2 float64 y2 float64 h float64 w float64 l float64 tx float64 ty float64 tz int8 object_id

YoloList.msg

new_msgs/Header header YoloObstacle[] yololist # Cannot write the name file with the same msg name (YoloList in this case)

Then, when I try to compile by using:

colcon build --merge-install --symlink-install --packages-select ros1_bridge --cmake-force-configure

I get the following error:

root@robesafe-GT62VR-7RE:~/ros1_bridge_ws# colcon build --merge-install --symlink-install --packages-select ros1_bridge --cmake-force-configure
Starting >>> ros1_bridge
--- stderr: ros1_bridge                               
libros1_bridge.so: undefined reference to `ros1_bridge::get_factory_new_msgs__msg__YoloList(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
libros1_bridge.so: undefined reference to `ros1_bridge::get_factory_new_msgs__msg__Header(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
libros1_bridge.so: undefined reference to `ros1_bridge::get_factory_new_msgs__msg__YoloObstacle(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
collect2: error: ld returned 1 exit status
make[2]: *** [parameter_bridge] Error 1
make[1]: *** [CMakeFiles/parameter_bridge.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
libros1_bridge.so: undefined reference to `ros1_bridge::get_factory_new_msgs__msg__YoloList(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
libros1_bridge.so: undefined reference to `ros1_bridge::get_factory_new_msgs__msg__Header(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
libros1_bridge.so: undefined reference to `ros1_bridge::get_factory_new_msgs__msg__YoloObstacle(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
collect2: error: ld returned 1 exit status
make[2]: *** [dynamic_bridge] Error 1
make[1]: *** [CMakeFiles/dynamic_bridge.dir/all] Error 2
libros1_bridge.so: undefined reference to `ros1_bridge::get_factory_new_msgs__msg__YoloList(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
libros1_bridge.so: undefined reference to `ros1_bridge::get_factory_new_msgs__msg__Header(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
libros1_bridge.so: undefined reference to `ros1_bridge::get_factory_new_msgs__msg__YoloObstacle(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
collect2: error: ld returned 1 exit status
make[2]: *** [static_bridge] Error 1
make[1]: *** [CMakeFiles/static_bridge.dir/all] Error 2

Any idea :( ??

Carlos

click to hide/show revision 4
None

ROS1 bridge ROS2

Hi,

I am trying to communicate ROS1 (Melodic) and ROS2 (Dashing), but I am not able after several attempts ... My ROS2 package is called new_msgs, the same name that in ROS1 workspace, with the same .msg:

YoloList.msg
YoloObstacle.msg

Now I describe the package.xml and CMakeLists.txt of ROS2 workspace:

package.xml:

<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
  <name>new_msgs</name>
  <version>0.0.1</version>
  <description>New message defined for ROS2</description>
  <maintainer email="cram3r95@gmail.com">root</maintainer>
  <license>Apache License 2.0</license>

<author>CGH</author>

<buildtool_depend>ament_cmake</buildtool_depend>

2.0</license> <author>CGH</author> <buildtool_depend>ament_cmake</buildtool_depend> <build_depend>rosidl_default_generators</build_depend> <exec_depend>rosidl_default_runtime</exec_depend>

<member_of_group>rosidl_interface_packages</member_of_group>

<exec_depend>rosidl_default_runtime</exec_depend> <member_of_group>rosidl_interface_packages</member_of_group> <export> <build_type>ament_cmake</build_type> </export> </package>

</package>

CMakeLists.txt

cmake_minimum_required(VERSION 3.5)
project(new_msgs)

project(new_msgs) # Default to C++14

C++14 if(NOT CMAKE_CXX_STANDARD) set(CMAKE_CXX_STANDARD 14) endif()

endif() if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_compile_options(-Wall -Wextra -Wpedantic) endif()

endif() # find dependencies

dependencies find_package(ament_cmake REQUIRED) find_package(rosidl_default_generators REQUIRED) find_package(std_msgs REQUIRED)

REQUIRED) # uncomment the following section in order to fill in

in # further dependencies manually.

manually. # find_package(<dependency> REQUIRED)

REQUIRED) rosidl_generate_interfaces(new_msgs "msg/YoloObstacle.msg" "msg/YoloList.msg" "msg/Header.msg" DEPENDENCIES builtin_interfaces std_msgs )

ament_package()

) ament_package()

Now I describe the package.xml and CMakeLists.txt of ROS1 workspace:

<?xml version="1.0"?>
<package format="2">
  <name>new_msgs</name>
  <version>0.0.0</version>
  <description>The new_msgs package</description>

package</description> <!-- One maintainer tag required, multiple allowed, one person per tag --> <!-- Example: --> <!-- <maintainer email="root@todo.todo">root</maintainer>

<license>TODO</license>

email="jane.doe@example.com">Jane Doe</maintainer> --> <maintainer email="root@todo.todo">root</maintainer> <!-- One license tag required, multiple allowed, one license per tag --> <!-- Commonly used license strings: --> <!-- BSD, MIT, Boost Software License, GPLv2, GPLv3, LGPLv2.1, LGPLv3 --> <license>TODO</license> <!-- Url tags are optional, but multiple are allowed, one per tag --> <!-- Optional attribute type can be: website, bugtracker, or repository --> <!-- Example: --> <!-- <url type="website">http://wiki.ros.org/new_msgs</url> --> <!-- Author tags are optional, multiple are allowed, one per tag --> <!-- Authors do not have to be maintainers, but could be --> <!-- Example: --> <!-- <author email="jane.doe@example.com">Jane Doe</author> --> <!-- The *depend tags are used to specify dependencies --> <!-- Dependencies can be catkin packages or system dependencies --> <!-- Examples: --> <!-- Use depend as a shortcut for packages that are both build and exec dependencies --> <!-- <depend>roscpp</depend> --> <!-- Note that this is equivalent to the following: --> <!-- <build_depend>roscpp</build_depend> --> <!-- <exec_depend>roscpp</exec_depend> --> <!-- Use build_depend for packages you need at compile time: --> <!-- <build_depend>message_generation</build_depend> --> <!-- Use build_export_depend for packages you need in order to build against this package: --> <!-- <build_export_depend>message_generation</build_export_depend> --> <!-- Use buildtool_depend for build tool packages: --> <!-- <buildtool_depend>catkin</buildtool_depend> --> <!-- Use exec_depend for packages you need at runtime: --> <!-- <exec_depend>message_runtime</exec_depend> --> <!-- Use test_depend for packages you need only for testing: --> <!-- <test_depend>gtest</test_depend> --> <!-- Use doc_depend for packages you need only for building documentation: --> <!-- <doc_depend>doxygen</doc_depend> --> <buildtool_depend>catkin</buildtool_depend> <build_depend>roscpp</build_depend> <build_depend>rospy</build_depend> <build_depend>sensor_msgs</build_depend> <build_depend>std_msgs</build_depend> <build_export_depend>roscpp</build_export_depend> <build_export_depend>rospy</build_export_depend> <build_export_depend>sensor_msgs</build_export_depend> <build_export_depend>std_msgs</build_export_depend> <exec_depend>roscpp</exec_depend> <exec_depend>rospy</exec_depend> <exec_depend>sensor_msgs</exec_depend> <exec_depend>std_msgs</exec_depend>

<!-- <exec_depend>message_runtime</exec_depend> --> <!-- The export tag contains other, unspecified, tags --> <export>

<!-- Other tools can request additional information be placed here --> </export> </package>

</package>

CMakeLists.txt

cmake_minimum_required(VERSION 2.8.3)
project(new_msgs)

project(new_msgs) ## Compile as C++11, supported in ROS Kinetic and newer

add_compile_options(-std=c++11)

newer # add_compile_options(-std=c++11) ## Find catkin macros and libraries

libraries ## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)

xyz) ## is used, also find other catkin packages

packages find_package(catkin REQUIRED COMPONENTS roscpp rospy sensor_msgs std_msgs message_generation )

) ## System dependencies are found with CMake's conventions

conventions # find_package(Boost REQUIRED COMPONENTS system)

system) ## Uncomment this if the package has a setup.py. This macro ensures

ensures ## modules and global scripts declared therein get installed

installed ## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html

catkin_python_setup()

#

http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html # catkin_python_setup() ################################################ ## Declare ROS messages, services and actions

#

actions ## ################################################ ## To declare and build messages, services or actions from within this

this ## package, follow these steps:

steps: ## * Let MSG_DEP_SET be the set of packages whose message types you use in

in ## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...).

...). ## * In the file package.xml:

package.xml: ## * add a build_depend tag for "message_generation"

"message_generation" ## * add a build_depend and a exec_depend tag for each package in MSG_DEP_SET

MSG_DEP_SET ## * If MSG_DEP_SET isn't empty the following dependency has been pulled in

in ## but can be declared for certainty nonetheless:

nonetheless: ## * add a exec_depend tag for "message_runtime"

"message_runtime" ## * In this file (CMakeLists.txt):

(CMakeLists.txt): ## * add "message_generation" and every package in MSG_DEP_SET to

to ## find_package(catkin REQUIRED COMPONENTS ...)

...) ## * add "message_runtime" and every package in MSG_DEP_SET to

to ## catkin_package(CATKIN_DEPENDS ...)

...) ## * uncomment the add_*_files sections below as needed

needed ## and list every .msg/.srv/.action file to be processed

processed ## * uncomment the generate_messages entry below

below ## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...)

...) ## Generate messages in the 'msg' folder

folder add_message_files( FILES Header.msg YoloList.msg YoloObstacle.msg )

) ## Generate services in the 'srv' folder

add_service_files(

FILES

Service1.srv

Service2.srv

)

folder # add_service_files( # FILES # Service1.srv # Service2.srv # ) ## Generate actions in the 'action' folder

add_action_files(

FILES

Action1.action

Action2.action

)

folder # add_action_files( # FILES # Action1.action # Action2.action # ) ## Generate added messages and services with any dependencies listed here

here generate_messages( DEPENDENCIES sensor_msgs std_msgs )

#

) ################################################ ## Declare ROS dynamic reconfigure parameters

#

parameters ## ################################################ ## To declare and build dynamic reconfigure parameters within this

this ## package, follow these steps:

steps: ## * In the file package.xml:

package.xml: ## * add a build_depend and a exec_depend tag for "dynamic_reconfigure"

"dynamic_reconfigure" ## * In this file (CMakeLists.txt):

(CMakeLists.txt): ## * add "dynamic_reconfigure" to

to ## find_package(catkin REQUIRED COMPONENTS ...)

...) ## * uncomment the "generate_dynamic_reconfigure_options" section below

below ## and list every .cfg file to be processed

processed ## Generate dynamic reconfigure parameters in the 'cfg' folder

generate_dynamic_reconfigure_options(

cfg/DynReconf1.cfg

cfg/DynReconf2.cfg

)

#

folder # generate_dynamic_reconfigure_options( # cfg/DynReconf1.cfg # cfg/DynReconf2.cfg # ) ################################### ## catkin specific configuration

#

configuration ## ################################### ## The catkin_package macro generates cmake config files for your package

package ## Declare things to be passed to dependent projects

projects ## INCLUDE_DIRS: uncomment this if your package contains header files

files ## LIBRARIES: libraries you create in this project that dependent projects also need

need ## CATKIN_DEPENDS: catkin_packages dependent projects also need

need ## DEPENDS: system dependencies of this project that dependent projects also need

catkin_package(

need catkin_package( # INCLUDE_DIRS include

include # LIBRARIES new_msgs

new_msgs CATKIN_DEPENDS roscpp rospy sensor_msgs std_msgs

CATKIN std_msgs #CATKIN DEPENDS message_runtime

message_runtime # DEPENDS system_lib

)

#

Build

#

system_lib ) ########### ## Build ## ########### ## Specify additional locations of header files

files ## Your package locations should be listed before other locations

include_directories(

include

locations include_directories( # include ${catkin_INCLUDE_DIRS} )

) ## Declare a C++ library

add_library(${PROJECT_NAME}

src/${PROJECT_NAME}/new_msgs.cpp

)

library # add_library(${PROJECT_NAME} # src/${PROJECT_NAME}/new_msgs.cpp # ) ## Add cmake target dependencies of the library

library ## as an example, code may need to be generated before libraries

libraries ## either from message generation or dynamic reconfigure

reconfigure # add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})

${catkin_EXPORTED_TARGETS}) ## Declare a C++ executable

executable ## With catkin_make all packages are built within a single CMake context

context ## The recommended prefix ensures that target names across packages don't collide

collide # add_executable(${PROJECT_NAME}_node src/new_msgs_node.cpp)

src/new_msgs_node.cpp) ## Rename C++ executable without prefix

prefix ## The above recommended prefix causes long target names, the following renames the

the ## target back to the shorter version for ease of user use

use ## e.g. "rosrun someones_pkg node" instead of "rosrun someones_pkg someones_pkg_node"

someones_pkg_node" # set_target_properties(${PROJECT_NAME}_node PROPERTIES OUTPUT_NAME node PREFIX "")

"") ## Add cmake target dependencies of the executable

executable ## same as for the library above

above # add_dependencies(${PROJECT_NAME}_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})

${catkin_EXPORTED_TARGETS}) ## Specify libraries to link a library or executable target against

target_link_libraries(${PROJECT_NAME}_node

${catkin_LIBRARIES}

)

#

Install

#

against # target_link_libraries(${PROJECT_NAME}_node # ${catkin_LIBRARIES} # ) ############# ## Install ## ############# # all install targets should use catkin DESTINATION variables

variables # See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html

http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html ## Mark executable scripts (Python etc.) for installation

installation ## in contrast to setup.py, you can choose the destination

install(PROGRAMS

scripts/my_python_script

destination # install(PROGRAMS # scripts/my_python_script # DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}

)

${CATKIN_PACKAGE_BIN_DESTINATION} # ) ## Mark executables for installation

installation ## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_executables.html

http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_executables.html # install(TARGETS ${PROJECT_NAME}_node

${PROJECT_NAME}_node # RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}

)

${CATKIN_PACKAGE_BIN_DESTINATION} # ) ## Mark libraries for installation

installation ## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html

http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html # install(TARGETS ${PROJECT_NAME}

${PROJECT_NAME} # ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}

${CATKIN_PACKAGE_LIB_DESTINATION} # LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}

${CATKIN_PACKAGE_LIB_DESTINATION} # RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}

)

${CATKIN_GLOBAL_BIN_DESTINATION} # ) ## Mark cpp header files for installation

installation # install(DIRECTORY include/${PROJECT_NAME}/

include/${PROJECT_NAME}/ # DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}

${CATKIN_PACKAGE_INCLUDE_DESTINATION} # FILES_MATCHING PATTERN "*.h"

"*.h" # PATTERN ".svn" EXCLUDE

)

EXCLUDE # ) ## Mark other files for installation (e.g. launch and bag files, etc.)

install(FILES

# myfile1

# myfile2

etc.) # install(FILES # # myfile1 # # myfile2 # DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}

)

#

Testing

#

${CATKIN_PACKAGE_SHARE_DESTINATION} # ) ############# ## Testing ## ############# ## Add gtest based cpp test target and link libraries

libraries # catkin_add_gtest(${PROJECT_NAME}-test test/test_new_msgs.cpp)

test/test_new_msgs.cpp) # if(TARGET ${PROJECT_NAME}-test)

${PROJECT_NAME}-test) # target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})

endif()

${PROJECT_NAME}) # endif() ## Add folders to be run by python nosetests

catkin_add_nosetests(test)

nosetests # catkin_add_nosetests(test)

In both cases the content of the messages is exactly the same:

Header.msg

Common
#Common Header for ROS2-ROS1 communication

communication uint32 seq int32 sec uint32 nanosec string frame_id

YoloObstacle.msg

frame_id YoloObstacle.msg string type float64 probability float64 x1 float64 y1 float64 x2 float64 y2 float64 h float64 w float64 l float64 tx float64 ty float64 tz int8 object_id

object_id

YoloList.msg

new_msgs/Header header
YoloObstacle[] yololist # Cannot write the name file with the same msg name (YoloList in this case)

case)

Then, when I try to compile by using:

colcon build --merge-install --symlink-install --packages-select ros1_bridge --cmake-force-configure

I get the following error:

root@robesafe-GT62VR-7RE:~/ros1_bridge_ws# colcon build --merge-install --symlink-install --packages-select ros1_bridge --cmake-force-configure
Starting >>> ros1_bridge
--- stderr: ros1_bridge                               
libros1_bridge.so: undefined reference to `ros1_bridge::get_factory_new_msgs__msg__YoloList(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
libros1_bridge.so: undefined reference to `ros1_bridge::get_factory_new_msgs__msg__Header(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
libros1_bridge.so: undefined reference to `ros1_bridge::get_factory_new_msgs__msg__YoloObstacle(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
collect2: error: ld returned 1 exit status
make[2]: *** [parameter_bridge] Error 1
make[1]: *** [CMakeFiles/parameter_bridge.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
libros1_bridge.so: undefined reference to `ros1_bridge::get_factory_new_msgs__msg__YoloList(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
libros1_bridge.so: undefined reference to `ros1_bridge::get_factory_new_msgs__msg__Header(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
libros1_bridge.so: undefined reference to `ros1_bridge::get_factory_new_msgs__msg__YoloObstacle(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
collect2: error: ld returned 1 exit status
make[2]: *** [dynamic_bridge] Error 1
make[1]: *** [CMakeFiles/dynamic_bridge.dir/all] Error 2
libros1_bridge.so: undefined reference to `ros1_bridge::get_factory_new_msgs__msg__YoloList(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
libros1_bridge.so: undefined reference to `ros1_bridge::get_factory_new_msgs__msg__Header(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
libros1_bridge.so: undefined reference to `ros1_bridge::get_factory_new_msgs__msg__YoloObstacle(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
collect2: error: ld returned 1 exit status
make[2]: *** [static_bridge] Error 1
make[1]: *** [CMakeFiles/static_bridge.dir/all] Error 2

Any idea :( ??

Carlos

click to hide/show revision 5
None

ROS1 bridge ROS2

Hi,

I am trying to communicate ROS1 (Melodic) and ROS2 (Dashing), but I am not able after several attempts ... My ROS2 package is called new_msgs, the same name that in ROS1 workspace, with the same .msg:

YoloList.msg
YoloObstacle.msg

Now I describe the package.xml and CMakeLists.txt of ROS2 workspace:

package.xml:

<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
  <name>new_msgs</name>
  <version>0.0.1</version>
  <description>New message defined for ROS2</description>
  <maintainer email="cram3r95@gmail.com">root</maintainer>
  <license>Apache License 2.0</license>

  <author>CGH</author>

  <buildtool_depend>ament_cmake</buildtool_depend>

  <build_depend>rosidl_default_generators</build_depend>
  <exec_depend>rosidl_default_runtime</exec_depend>

  <member_of_group>rosidl_interface_packages</member_of_group>

  <export>
    <build_type>ament_cmake</build_type>
  </export>
</package>

CMakeLists.txt

cmake_minimum_required(VERSION 3.5)
project(new_msgs)

# 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(rosidl_default_generators REQUIRED)
find_package(std_msgs REQUIRED)
# uncomment the following section in order to fill in
# further dependencies manually.
# find_package(<dependency> REQUIRED)

rosidl_generate_interfaces(new_msgs
  "msg/YoloObstacle.msg"
  "msg/YoloList.msg"
  "msg/Header.msg"
  DEPENDENCIES builtin_interfaces std_msgs
)

ament_package()

Now I describe the package.xml and CMakeLists.txt of ROS1 workspace:

<?xml version="1.0"?>
<package format="2">
  <name>new_msgs</name>
  <version>0.0.0</version>
  <description>The new_msgs package</description>

  <!-- One maintainer tag required, multiple allowed, one person per tag -->
  <!-- Example:  -->
  <!-- <maintainer email="jane.doe@example.com">Jane Doe</maintainer> -->
  <maintainer email="root@todo.todo">root</maintainer>


  <!-- One license tag required, multiple allowed, one license per tag -->
  <!-- Commonly used license strings: -->
  <!--   BSD, MIT, Boost Software License, GPLv2, GPLv3, LGPLv2.1, LGPLv3 -->
  <license>TODO</license>


  <!-- Url tags are optional, but multiple are allowed, one per tag -->
  <!-- Optional attribute type can be: website, bugtracker, or repository -->
  <!-- Example: -->
  <!-- <url type="website">http://wiki.ros.org/new_msgs</url> -->


  <!-- Author tags are optional, multiple are allowed, one per tag -->
  <!-- Authors do not have to be maintainers, but could be -->
  <!-- Example: -->
  <!-- <author email="jane.doe@example.com">Jane Doe</author> -->


  <!-- The *depend tags are used to specify dependencies -->
  <!-- Dependencies can be catkin packages or system dependencies -->
  <!-- Examples: -->
  <!-- Use depend as a shortcut for packages that are both build and exec dependencies -->
  <!--   <depend>roscpp</depend> -->
  <!--   Note that this is equivalent to the following: -->
  <!--   <build_depend>roscpp</build_depend> -->
  <!--   <exec_depend>roscpp</exec_depend> -->
  <!-- Use build_depend for packages you need at compile time: -->
  <!--   <build_depend>message_generation</build_depend> -->
  <!-- Use build_export_depend for packages you need in order to build against this package: -->
  <!--   <build_export_depend>message_generation</build_export_depend> -->
  <!-- Use buildtool_depend for build tool packages: -->
  <!--   <buildtool_depend>catkin</buildtool_depend> -->
  <!-- Use exec_depend for packages you need at runtime: -->
  <!--   <exec_depend>message_runtime</exec_depend> -->
  <!-- Use test_depend for packages you need only for testing: -->
  <!--   <test_depend>gtest</test_depend> -->
  <!-- Use doc_depend for packages you need only for building documentation: -->
  <!--   <doc_depend>doxygen</doc_depend> -->
  <buildtool_depend>catkin</buildtool_depend>
  <build_depend>roscpp</build_depend>
  <build_depend>rospy</build_depend>
  <build_depend>sensor_msgs</build_depend>
  <build_depend>std_msgs</build_depend>
  <build_export_depend>roscpp</build_export_depend>
  <build_export_depend>rospy</build_export_depend>
  <build_export_depend>sensor_msgs</build_export_depend>
  <build_export_depend>std_msgs</build_export_depend>
  <exec_depend>roscpp</exec_depend>
  <exec_depend>rospy</exec_depend>
  <exec_depend>sensor_msgs</exec_depend>
  <exec_depend>std_msgs</exec_depend>
  <!-- <exec_depend>message_runtime</exec_depend> -->


  <!-- The export tag contains other, unspecified, tags -->
  <export>
    <!-- Other tools can request additional information be placed here -->

  </export>
</package>

CMakeLists.txt

cmake_minimum_required(VERSION 2.8.3)
project(new_msgs)

## Compile as C++11, supported in ROS Kinetic and newer
# add_compile_options(-std=c++11)

## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
  roscpp
  rospy
  sensor_msgs
  std_msgs
  message_generation
)

## System dependencies are found with CMake's conventions
# find_package(Boost REQUIRED COMPONENTS system)


## Uncomment this if the package has a setup.py. This macro ensures
## modules and global scripts declared therein get installed
## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html
# catkin_python_setup()

################################################
## Declare ROS messages, services and actions ##
################################################

## To declare and build messages, services or actions from within this
## package, follow these steps:
## * Let MSG_DEP_SET be the set of packages whose message types you use in
##   your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...).
## * In the file package.xml:
##   * add a build_depend tag for "message_generation"
##   * add a build_depend and a exec_depend tag for each package in MSG_DEP_SET
##   * If MSG_DEP_SET isn't empty the following dependency has been pulled in
##     but can be declared for certainty nonetheless:
##     * add a exec_depend tag for "message_runtime"
## * In this file (CMakeLists.txt):
##   * add "message_generation" and every package in MSG_DEP_SET to
##     find_package(catkin REQUIRED COMPONENTS ...)
##   * add "message_runtime" and every package in MSG_DEP_SET to
##     catkin_package(CATKIN_DEPENDS ...)
##   * uncomment the add_*_files sections below as needed
##     and list every .msg/.srv/.action file to be processed
##   * uncomment the generate_messages entry below
##   * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...)

## Generate messages in the 'msg' folder
add_message_files(
   FILES
   Header.msg
   YoloList.msg
   YoloObstacle.msg
 )

## Generate services in the 'srv' folder
# add_service_files(
#   FILES
#   Service1.srv
#   Service2.srv
# generate_messages(
   DEPENDENCIES
   sensor_msgs
   std_msgs
 )

## Generate actions in the 'action' folder
# add_action_files(
#   FILES
#   Action1.action
#   Action2.action
# )

## Generate added messages and services with any dependencies listed here
generate_messages(
   DEPENDENCIES
   sensor_msgs
   std_msgs
 )

################################################
## Declare ROS dynamic reconfigure parameters ##
################################################

## To declare and build dynamic reconfigure parameters within this
## package, follow these steps:
## * In the file package.xml:
##   * add a build_depend and a exec_depend tag for "dynamic_reconfigure"
## * In this file (CMakeLists.txt):
##   * add "dynamic_reconfigure" to
##     find_package(catkin REQUIRED COMPONENTS ...)
##   * uncomment the "generate_dynamic_reconfigure_options" section below
##     and list every .cfg file to be processed

## Generate dynamic reconfigure parameters in the 'cfg' folder
# generate_dynamic_reconfigure_options(
#   cfg/DynReconf1.cfg
#   cfg/DynReconf2.cfg
# )

###################################
## catkin specific configuration ##
###################################
## The catkin_package macro generates cmake config files for your package
## Declare things to be passed to dependent projects
## INCLUDE_DIRS: uncomment this if your package contains header files
## LIBRARIES: libraries you create in this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(
#  INCLUDE_DIRS include
#  LIBRARIES new_msgs
CATKIN_DEPENDS roscpp rospy sensor_msgs std_msgs
#CATKIN DEPENDS message_runtime
#  DEPENDS system_lib
)

###########
## Build ##
###########

## Specify additional locations of header files
## Your package locations should be listed before other locations
include_directories(
# include
  ${catkin_INCLUDE_DIRS}
)

## Declare a C++ library
# add_library(${PROJECT_NAME}
#   src/${PROJECT_NAME}/new_msgs.cpp
# )

## Add cmake target dependencies of the library
## as an example, code may need to be generated before libraries
## either from message generation or dynamic reconfigure
# add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})

## Declare a C++ executable
## With catkin_make all packages are built within a single CMake context
## The recommended prefix ensures that target names across packages don't collide
# add_executable(${PROJECT_NAME}_node src/new_msgs_node.cpp)

## Rename C++ executable without prefix
## The above recommended prefix causes long target names, the following renames the
## target back to the shorter version for ease of user use
## e.g. "rosrun someones_pkg node" instead of "rosrun someones_pkg someones_pkg_node"
# set_target_properties(${PROJECT_NAME}_node PROPERTIES OUTPUT_NAME node PREFIX "")

## Add cmake target dependencies of the executable
## same as for the library above
# add_dependencies(${PROJECT_NAME}_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})

## Specify libraries to link a library or executable target against
# target_link_libraries(${PROJECT_NAME}_node
#   ${catkin_LIBRARIES}
# )

#############
## Install ##
#############

# all install targets should use catkin DESTINATION variables
# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html

## Mark executable scripts (Python etc.) for installation
## in contrast to setup.py, you can choose the destination
# install(PROGRAMS
#   scripts/my_python_script
#   DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# )

## Mark executables for installation
## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_executables.html
# install(TARGETS ${PROJECT_NAME}_node
#   RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# )

## Mark libraries for installation
## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html
# install(TARGETS ${PROJECT_NAME}
#   ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
#   LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
#   RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}
# )

## Mark cpp header files for installation
# install(DIRECTORY include/${PROJECT_NAME}/
#   DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
#   FILES_MATCHING PATTERN "*.h"
#   PATTERN ".svn" EXCLUDE
# )

## Mark other files for installation (e.g. launch and bag files, etc.)
# install(FILES
#   # myfile1
#   # myfile2
#   DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
# )

#############
## Testing ##
#############

## Add gtest based cpp test target and link libraries
# catkin_add_gtest(${PROJECT_NAME}-test test/test_new_msgs.cpp)
# if(TARGET ${PROJECT_NAME}-test)
#   target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
# endif()

## Add folders to be run by python nosetests
# catkin_add_nosetests(test)

In both cases the content of the messages is exactly the same:

Header.msg

#Common Header for ROS2-ROS1 communication

uint32 seq
int32 sec
uint32 nanosec
string frame_id

YoloObstacle.msg

YoloObstacle.msg

string type
float64 probability
float64 x1
float64 y1
float64 x2
float64 y2
float64 h
float64 w
float64 l
float64 tx
float64 ty
float64 tz
int8 object_id

YoloList.msg

new_msgs/Header header
YoloObstacle[] yololist # Cannot write the name file with the same msg name (YoloList in this case)

Then, when I try to compile by using:

colcon build --merge-install --symlink-install --packages-select ros1_bridge --cmake-force-configure

I get the following error:

root@robesafe-GT62VR-7RE:~/ros1_bridge_ws# colcon build --merge-install --symlink-install --packages-select ros1_bridge --cmake-force-configure
Starting >>> ros1_bridge
--- stderr: ros1_bridge                               
libros1_bridge.so: undefined reference to `ros1_bridge::get_factory_new_msgs__msg__YoloList(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
libros1_bridge.so: undefined reference to `ros1_bridge::get_factory_new_msgs__msg__Header(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
libros1_bridge.so: undefined reference to `ros1_bridge::get_factory_new_msgs__msg__YoloObstacle(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
collect2: error: ld returned 1 exit status
make[2]: *** [parameter_bridge] Error 1
make[1]: *** [CMakeFiles/parameter_bridge.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
libros1_bridge.so: undefined reference to `ros1_bridge::get_factory_new_msgs__msg__YoloList(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
libros1_bridge.so: undefined reference to `ros1_bridge::get_factory_new_msgs__msg__Header(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
libros1_bridge.so: undefined reference to `ros1_bridge::get_factory_new_msgs__msg__YoloObstacle(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
collect2: error: ld returned 1 exit status
make[2]: *** [dynamic_bridge] Error 1
make[1]: *** [CMakeFiles/dynamic_bridge.dir/all] Error 2
libros1_bridge.so: undefined reference to `ros1_bridge::get_factory_new_msgs__msg__YoloList(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
libros1_bridge.so: undefined reference to `ros1_bridge::get_factory_new_msgs__msg__Header(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
libros1_bridge.so: undefined reference to `ros1_bridge::get_factory_new_msgs__msg__YoloObstacle(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
collect2: error: ld returned 1 exit status
make[2]: *** [static_bridge] Error 1
make[1]: *** [CMakeFiles/static_bridge.dir/all] Error 2

Any idea :( ??

Carlos