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

Majed's profile - activity

2023-05-23 10:13:47 -0500 received badge  Famous Question (source)
2023-02-03 18:34:03 -0500 received badge  Nice Answer (source)
2022-10-20 12:01:08 -0500 received badge  Popular Question (source)
2022-10-20 12:01:08 -0500 received badge  Notable Question (source)
2022-08-04 14:01:59 -0500 edited question [ROS2] Issues with OptionsWithAllocator in humble

[ROS2] Issues with OptionsWithAllocator in humble Hi developers, I am having an issue with a package that works perfect

2022-07-14 12:16:41 -0500 answered a question [ROS2] Issues with OptionsWithAllocator in humble

I am driving up the posting hoping someone might have a hint.

2022-06-28 11:45:50 -0500 edited question [ROS2] Issues with OptionsWithAllocator in humble

[ROS2] Issues with OptionsWithAllocator in humble Hi developers, I am having an issue with a package that works perfect

2022-06-28 08:25:28 -0500 asked a question [ROS2] Issues with OptionsWithAllocator in humble

[ROS2] Issues with OptionsWithAllocator in humble Hi developers, I am having an issue with package that works perfectly

2021-07-22 17:23:15 -0500 marked best answer [ROS2] symbol lookup error and undefined symbol while using image transport cpp

Hi fellow developers,

I am a beginner at ROS2. After building the package and trying to run it I get the following error.

/home/jetson/ros2_ws/install/camera_pkg/lib/camera_pkg/camera_node: symbol lookup error: /home/jetson/ros2_ws/install/camera_pkg/lib/camera_pkg/camera_node: undefined symbol: _ZN15image_transport16create_publisherEPN6rclcpp4NodeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE17rmw_qos_profile_t

Honestly, do not know where to begin to tackle this issue. It seems to me an error with image_transport.h

2021-07-22 17:22:58 -0500 marked best answer [ROS2] Opencv 4 conflicted with cv_bridge causing an error.

Hi fellow developers,

I am having an issue with ROS2 cv_bridge and opencv 4. The warning below shows that I have a conflict between opencv3 and opencv4. I can not downgrade the opencv in the device because other programs require it.

 /usr/bin/ld: warning: libopencv_core.so.3.2, needed by //opt/ros/dashing/lib/libcv_bridge.so, may conflict with libopencv_core.so.4.1
/usr/bin/ld: warning: libopencv_core.so.3.2, needed by //opt/ros/dashing/lib/libcv_bridge.so, may conflict with libopencv_core.so.4.1

This is the Error it causes when I run the software.

/home/jetson/ros2_ws/install/camera_pkg/lib/camera_pkg/camera_display_node: symbol lookup error: /usr/local/lib/libopencv_imgproc.so.4.1: undefined symbol: _ZN2cv3ocl17isOpenCLActivatedEv

I believe the error occurs when the line below is executed:

cv::imshow("view", cv_bridge::toCvShare(msg, "bgr8")->image);

What is the best way to deal with this error?

Edit: due to the comments where they seem to be working I am adding the CMakelist, hpp and cpp

cmake_minimum_required(VERSION 3.5) project(library_pkg)

# Default to C++17
if(NOT CMAKE_CXX_STANDARD)
  set(CMAKE_CXX_STANDARD 17)
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(rclcpp REQUIRED)
find_package(cv_bridge REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(image_transport REQUIRED)
find_package(std_msgs REQUIRED)
find_package(OpenCV 4 QUIET)
if (NOT OpenCV_FOUND)
  find_package(OpenCV REQUIRED)
endif ()
message(STATUS "Found OpenCV version ${OpenCV_VERSION}")

include_directories(
  include
  ${OpenCV_INCLUDE_DIRS}
)

add_library(
    ${PROJECT_NAME} SHARED
    src/MJPEGWriter.cpp
    src/CameraMainNode.cpp
    src/CameraDisplayNode.cpp
    src/CameraSaveNode.cpp
    src/CameraStreamNode.cpp
)

target_include_directories(${PROJECT_NAME} PUBLIC
  "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
  "$<INSTALL_INTERFACE:include>")

ament_target_dependencies(
  ${PROJECT_NAME}
  image_transport
  OpenCV
  rclcpp
  sensor_msgs
  std_msgs
  cv_bridge
)

ament_export_include_directories(include)
ament_export_libraries(${PROJECT_NAME})
ament_export_interfaces(export_${PROJECT_NAME} HAS_LIBRARY_TARGET)

#=============
# Install
#=============

install(
  DIRECTORY include/
  DESTINATION include
)

install(
  TARGETS ${PROJECT_NAME}
  EXPORT export_${PROJECT_NAME}
  LIBRARY DESTINATION lib
  ARCHIVE DESTINATION lib
  RUNTIME DESTINATION bin
  INCLUDES DESTINATION include
)


ament_package()

hpp code:

#ifndef _CAMERADISPLAYNODE_H_
#define _CAMERADISPLAYNODE_H_
#endif

#include <iostream>
#include "rclcpp/rclcpp.hpp"
#include <image_transport/image_transport.h>
#include <sensor_msgs/image_encodings.hpp>
#include <opencv2/opencv.hpp>
#include "cv_bridge/cv_bridge.h"
#include <sensor_msgs/image_encodings.hpp>


class CameraDisplayNode : public rclcpp::Node{
public:
    //--------------------------
    CameraDisplayNode() : Node("camera_display"){
        //--------------------------
        RCLCPP_INFO(this->get_logger(), "Hit ESC to exit");
        //--------------------------
        //cv::namedWindow("view", cv::WINDOW_AUTOSIZE);
        //cv::startWindowThread();
        //--------------------------
        subscriber_ = this->create_subscription<sensor_msgs::msg::Image>(
            "camera_image", 1,
            std::bind(&CameraDisplayNode::display_image_callback, this, std::placeholders::_1));

    } // end CameraDisplayNode() : Node("camera_display")

private:
    void display_image_callback(const sensor_msgs::msg::Image::SharedPtr msg);
    //--------------------------
    rclcpp::Subscription<sensor_msgs::msg::Image>::SharedPtr subscriber_;
    //--------------------------
};

cpp code:

#include "library_pkg/CameraDisplayNode.hpp"

//--------------------------------------------------------------
void CameraDisplayNode::display_image_callback(const sensor_msgs::msg::Image::SharedPtr msg){
    try{
        cv::imshow("view", cv_bridge::toCvShare(msg, "bgr8")->image);
        int keycode = cv::waitKey(30) & 0xff;
        if(keycode == 27){
            RCLCPP_INFO(this->get_logger(),"Exit Display");
        }// end if(keycode == 27)
    }// end try
    catch (cv_bridge::Exception& e){
        RCLCPP_ERROR(this->get_logger(),"Could not convert from '%s' to 'bgr8'.", msg->encoding.c_str());
    }// end catch
}// end display_image_callback
//--------------------------------------------------------------

Only the display code doesn't work with me and it does give me the error mentioned before. Any help is highly appricated.

2021-07-22 17:22:15 -0500 marked best answer [ROS2] Including a cpp header from another package

Dear fellow developers:

I am a beginner in ROS2. I have designed a library that I want all packages in ROS2 to have access.

This is the warning I get when I try to build. This is causing an error.

CMake Warning at /home/jetson/ros2_ws/install/library_pkg/share/library_pkg/cmake/ament_cmake_export_libraries-extras.cmake:116 (message):
  Package 'library_pkg' exports library 'export_library_pkg' which couldn't
  be found
Call Stack (most recent call first):
  /home/jetson/ros2_ws/install/library_pkg/share/library_pkg/cmake/library_pkgConfig.cmake:38 (include)
  CMakeLists.txt:21 (find_package)

This is my CMakelist

cmake_minimum_required(VERSION 3.5)
project(library_pkg)


# 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(rclcpp REQUIRED)
find_package(cv_bridge REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(image_transport REQUIRED)
find_package(std_msgs REQUIRED)
# Try for OpenCV 4.X, but settle for whatever is installed
find_package(OpenCV 4 QUIET)
if (NOT OpenCV_FOUND)
  find_package(OpenCV REQUIRED)
endif ()
message(STATUS "Found OpenCV version ${OpenCV_VERSION}")

# Package includes not needed for CMake >= 2.8.11
include_directories(
  include
  ${colcon_INCLUDE_DIRS}
  ${OpenCV_INCLUDE_DIRS}
)


add_library(
        ${PROJECT_NAME} SHARED
        src/CameraCapture.cpp
        src/MJPEGWriter.cpp
        src/CameraMainNode.cpp
)

target_include_directories(${PROJECT_NAME} PUBLIC
  "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
  "$<INSTALL_INTERFACE:include>")

ament_target_dependencies(
  ${PROJECT_NAME}
  image_transport
  OpenCV
  rclcpp
  sensor_msgs
  std_msgs
)

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

#=============
# Install
#=============

install(
  DIRECTORY include/
  DESTINATION include
)

install(
  TARGETS ${PROJECT_NAME}
  EXPORT export_${PROJECT_NAME}
  LIBRARY DESTINATION lib
  ARCHIVE DESTINATION lib
  RUNTIME DESTINATION bin
  INCLUDES DESTINATION include
)

ament_package()

The error that it is causing

undefined reference

The full error

CMakeFiles/camera_capture.dir/src/CameraMain.cpp.o: In function `main':
CameraMain.cpp:(.text+0x224): undefined reference to `CameraCapture::CameraCapture()'
CameraMain.cpp:(.text+0x2bc): undefined reference to `void CameraCapture::Capture<std::shared_ptr<CameraNode> >(std::shared_ptr<CameraNode>, image_transport::Publisher, int, int, int, int, int, int)'
CameraMain.cpp:(.text+0x378): undefined reference to `CameraCapture::~CameraCapture()'
CameraMain.cpp:(.text+0x47c): undefined reference to `CameraCapture::~CameraCapture()'
collect2: error: ld returned 1 exit status
make[2]: *** [camera_capture] Error 1
make[1]: *** [CMakeFiles/camera_capture.dir/all] Error 2
make: *** [all] Error 2

This is the CMakelist on the package that include the library

project(camera_pkg)


# 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(rclcpp REQUIRED)
find_package(image_transport REQUIRED)
find_package(OpenCV REQUIRED)
find_package(std_msgs REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(library_pkg REQUIRED)
# Try for OpenCV 4.X, but settle for whatever is installed
find_package(OpenCV 4 QUIET)
if (NOT OpenCV_FOUND)
  find_package(OpenCV REQUIRED)
endif ()
message(STATUS "Found OpenCV version ${OpenCV_VERSION}")

add_executable(camera_capture src/CameraMain.cpp)
ament_target_dependencies(camera_capture rclcpp image_transport OpenCV std_msgs sensor_msgs library_pkg)

ament_export_dependencies(rclcpp image_transport OpenCV std_msgs sensor_msgs library_pkg)

install(TARGETS
        DESTINATION lib/${PROJECT_NAME}
        )
ament_package()

I am not sure what I am doing wrong. I would appricate any help or guidance.

2021-07-22 17:09:10 -0500 commented answer [ROS2] integrating with Unreal Engine

I am still looking for a good solution. One point you might want to look into is sockets.

2021-05-27 10:13:13 -0500 commented answer [ROS2] symbol lookup error and undefined symbol while using image transport cpp

Post your CMakeList I will try my best to see what is the issue.

2021-05-27 07:42:33 -0500 edited answer [ROS2] symbol lookup error and undefined symbol while using image transport cpp

@atas has given me a hint into how to solve the problem. As I was preparing to post the CMakelist, I noticed I had an ex

2021-05-27 07:39:12 -0500 commented answer [ROS2] symbol lookup error and undefined symbol while using image transport cpp

post your CMakeList I will try my best to see what is the issue.

2021-05-27 07:39:12 -0500 received badge  Commentator
2021-05-17 14:00:58 -0500 received badge  Student (source)
2021-04-19 07:15:16 -0500 received badge  Self-Learner (source)
2021-04-17 07:17:49 -0500 received badge  Famous Question (source)
2021-03-29 09:03:17 -0500 received badge  Notable Question (source)
2021-03-29 09:03:17 -0500 received badge  Popular Question (source)
2021-03-16 11:15:53 -0500 commented question [ROS2] integrating with Unreal Engine

Hi @130s. I have seen that post. The issue is that post is about ROS1 plugin. I am actually looking for a ROS2. Even if

2021-03-16 10:35:57 -0500 asked a question [ROS2] integrating with Unreal Engine

[ROS2] integrating with Unreal Engine Hi fellow developers, I am fairly new to the Unreal Engine. What is the best way

2020-12-07 12:08:25 -0500 received badge  Famous Question (source)
2020-12-02 11:25:27 -0500 received badge  Famous Question (source)
2020-10-24 00:49:18 -0500 asked a question [ROS2] service error any_service_callback

[ROS2] service error any_service_callback Hello developers: I have an error while developing service: The custom servi

2020-10-22 07:33:34 -0500 received badge  Famous Question (source)
2020-10-09 03:22:23 -0500 received badge  Notable Question (source)
2020-10-08 15:51:25 -0500 asked a question [ROS2] PyExc_IOError and PyErr_SetFromErrnoWithFilename

[ROS2] PyExc_IOError and PyErr_SetFromErrnoWithFilename Dear fellow developers, While building using colcon build I got

2020-10-03 10:22:18 -0500 received badge  Notable Question (source)
2020-10-03 10:22:17 -0500 received badge  Famous Question (source)
2020-10-01 23:53:52 -0500 received badge  Teacher (source)
2020-10-01 02:29:14 -0500 received badge  Notable Question (source)
2020-09-30 12:10:47 -0500 answered a question [ROS2] Opencv 4 conflicted with cv_bridge causing an error.

The answer seems to add the following in the callback. Although, this seems wrong to me, but it does work cv::named

2020-09-30 12:10:47 -0500 received badge  Rapid Responder (source)
2020-09-30 07:20:06 -0500 commented question [ROS2] Opencv 4 conflicted with cv_bridge causing an error.

@rrrand Amazing, thank you for doing the test. I have added the post to include my Cmakelist, hpp and cpp. If you have

2020-09-30 07:18:43 -0500 edited question [ROS2] Opencv 4 conflicted with cv_bridge causing an error.

[ROS2] Opencv 4 conflicted with cv_bridge causing an error. Hi fellow developers, I am having an issue with ROS2 cv_bri

2020-09-30 07:18:43 -0500 received badge  Editor (source)
2020-09-30 04:33:35 -0500 received badge  Popular Question (source)
2020-09-29 12:45:38 -0500 commented question Buffer too small ROS1_bridge

@Cram3r95 did you find a solution for this

2020-09-29 08:48:47 -0500 answered a question what is the simpliest way to publish and subscribe an image

I found these two examples to be very good they are in C++ http://wiki.ros.org/image_transport/Tutorials/PublishingImag

2020-09-29 08:48:47 -0500 received badge  Rapid Responder (source)
2020-09-29 08:26:18 -0500 asked a question [ROS2] Opencv 4 conflicted with cv_bridge causing an error.

[ROS2] Opencv 4 conflicted with cv_bridge causing an error. Hi fellow developers, I am having an issue with ROS2 cv_bri

2020-09-29 07:54:01 -0500 received badge  Enthusiast
2020-09-28 13:26:33 -0500 received badge  Popular Question (source)
2020-09-28 09:10:15 -0500 edited answer [ROS2] symbol lookup error and undefined symbol while using image transport cpp

@atas has given me a hint into how to solve the problem. As I was preparing to post the CMakelist, I noticed I had an ex

2020-09-28 09:09:11 -0500 commented question [ROS2] symbol lookup error and undefined symbol while using image transport cpp

@atas thank you for willingness to help.

2020-09-28 09:08:56 -0500 received badge  Rapid Responder (source)
2020-09-28 09:08:56 -0500 answered a question [ROS2] symbol lookup error and undefined symbol while using image transport cpp

@atas has given me a hint into how to solve the problem. As I was trying to post the CMakelist, I noticed I had an extra