ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
I will take the liberty to guess that your ROS1 and ROS2 new_msgs packages are used only for message generation (do not contain any headers and src files). In that case you can try the following:
ROS2 package.xml:
<?xml version="1.0"?>
<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>
<depend>std_msgs</depend>
<depend>builtin_interfaces</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>
ROS2 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")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic")
endif()
# find dependencies
find_package(ament_cmake REQUIRED)
find_package(rosidl_default_generators REQUIRED)
find_package(std_msgs REQUIRED)
find_package(builtin_interfaces REQUIRED)
rosidl_generate_interfaces(new_msgs
"msg/YoloObstacle.msg"
"msg/YoloList.msg"
"msg/Header.msg"
DEPENDENCIES std_msgs builtin_interfaces
)
ament_export_dependencies(rosidl_default_runtime)
ament_package()
ROS1 package.xml:
<?xml version="1.0"?>
<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>
<buildtool_depend>catkin</buildtool_depend>
<depend>std_msgs</depend>
<depend>sensor_msgs</depend>
<build_depend>message_generation</build_depend>
<exec_depend>message_runtime</exec_depend>
</package>
ROS1 CMakeLists.txt: cmake_minimum_required(VERSION 2.8.3) project(new_msgs)
find_package(catkin REQUIRED COMPONENTS
sensor_msgs
std_msgs
message_generation
)
add_message_files(
FILES
Header.msg
YoloList.msg
YoloObstacle.msg
)
generate_messages(
DEPENDENCIES
sensor_msgs
std_msgs
)
catkin_package(
CATKIN_DEPENDS message_runtime sensor_msgs std_msgs
)
include_directories(
${catkin_INCLUDE_DIRS}
)
Building the ros1_bridge from source is the more tricky part. Refer to the package documentation for that.