ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Cram3r95's profile - activity

2022-06-23 09:54:49 -0500 marked best answer 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>
  <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>
  <!-- <exec_depend>message_runtime</exec_depend> -->

</package>

CMakeLists.txt

cmake_minimum_required(VERSION 2.8.3)
project(new_msgs)

find_package(catkin REQUIRED COMPONENTS
  roscpp
  rospy
  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(
#  INCLUDE_DIRS include
#  LIBRARIES new_msgs
CATKIN_DEPENDS roscpp rospy sensor_msgs std_msgs
#CATKIN DEPENDS message_runtime
#  DEPENDS system_lib
)

include_directories(
# include
  ${catkin_INCLUDE_DIRS}
)

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> > ...
(more)
2020-12-03 00:57:15 -0500 received badge  Student (source)
2019-12-13 02:10:51 -0500 received badge  Famous Question (source)
2019-10-02 04:21:51 -0500 received badge  Famous Question (source)
2019-09-24 05:20:55 -0500 received badge  Famous Question (source)
2019-08-27 05:37:22 -0500 received badge  Notable Question (source)
2019-08-26 12:35:38 -0500 received badge  Notable Question (source)
2019-08-25 07:08:41 -0500 commented answer ROS1 bridge ROS2

Dirk, how can I do this? I have seen the logs but the content is huge (for the latest build). Is there any way to share

2019-08-25 06:29:03 -0500 received badge  Popular Question (source)
2019-08-24 17:53:22 -0500 commented answer ROS1 bridge ROS2

My exact steps are: When trying to recompile the bridge from source: source /opt/ros/melodic/setup.bash source /root

2019-08-24 17:42:58 -0500 edited question Buffer too small ROS1_bridge

Buffer to small ROS1_bridge Hi, Im trying to use the ros1_bridge sending a topic called /yolov3_tracking_list. When it

2019-08-24 17:42:58 -0500 received badge  Editor (source)
2019-08-24 14:26:22 -0500 commented answer ROS1 bridge ROS2

It is almost working, I have no errors now, but the bridge does not recognize the ROS1 package, since it does not find t

2019-08-24 14:24:38 -0500 commented answer ROS1 bridge ROS2

It is almost working, I have no errors now, but the bridge does not recognize the ROS1 package, since it does not find t

2019-08-23 17:38:09 -0500 received badge  Notable Question (source)
2019-08-23 11:43:25 -0500 received badge  Popular Question (source)
2019-08-23 10:29:28 -0500 asked a question Buffer too small ROS1_bridge

Buffer to small ROS1_bridge Hi, Im trying to use the ros1_bridge sending a topic called /yolov3_tracking_list. When it

2019-08-23 06:53:51 -0500 received badge  Enthusiast
2019-08-22 13:36:15 -0500 received badge  Popular Question (source)
2019-08-22 11:57:08 -0500 commented question ROS1 bridge ROS2

Ok, it is already done. I have shared the content of both packages and the fields of their messages.

2019-08-22 11:56:19 -0500 edited question ROS1 bridge ROS2

ROS1 bridge ROS2 Hi, I am trying to communicate ROS1 (Melodic) and ROS2 (Dashing), but I am not able after several atte

2019-08-22 11:17:47 -0500 commented question ROS1 bridge ROS2

Yeah sure: ros2_ws: src: new_msgs: CMakeLists.txt package.xml msg include (not used) src (not used)

2019-08-22 07:21:58 -0500 asked a question ROS1 bridge ROS2

ROS1 bridge ROS2 **Hi, I am trying to communicate ROS1 (Melodic) and ROS2 (Dashing), but I am not able after several at

2019-08-19 03:04:04 -0500 asked a question Create a new message ROS2 Dashing

Create a new message ROS2 Dashing I am not able to create a ROS2 Dashing new message, in spite of the fact that I have f