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

error: no matching function for call to create_subscription

asked 2022-10-17 03:52:55 -0600

damiano gravatar image

updated 2022-10-17 04:36:43 -0600

Hello,

I'm trying to run orbslam2 on a tello drone using ros 2 (foxy distro, ubuntu 20.04). For the purpose, I am trying to use this repository:

https://github.com/tentone/tello-ros2

What I managed to do successfully so far is:

  • Install all dependencies, running scripts/install.sh
  • Build the 3 packages of the repository (tello/tello_control/tello_msg) running scripts/build.sh, which is basically running colcon build on the 3 packages:

    colcon build --symlink-install --packages-select tello tello_control tello_msg

  • Build the ORBSLAM-2 package, through the instructions in the scripts/orbslam.sh script

Now I am trying to compile the nodes in the slam/src/orbslam2 folder. However when I run colcon build in that folder, I get the following error:

    /home/huangpan1/tello_1410/tello-ros2/slam/src/orbslam2/src/monocular/monocular-slam-node.cpp: In constructor ‘MonocularSlamNode::MonocularSlamNode(ORB_SLAM2::System*, const string&, const string&)’:
/home/huangpan1/tello_1410/tello-ros2/slam/src/orbslam2/src/monocular/monocular-slam-node.cpp:20:141: error: no matching function for call to ‘MonocularSlamNode::create_subscription<ImageMsg>(const char [7], std::_Bind_helper<false, void (MonocularSlamNode::*)(std::shared_ptr<sensor_msgs::msg::Image_<std::allocator<void> > >), MonocularSlamNode*, const std::_Placeholder<1>&>::type)’
   20 |     m_image_subscriber = this->create_subscription<ImageMsg>("camera", std::bind(&MonocularSlamNode::GrabImage, this, std::placeholders::_1));
      |                                                                                                                                             ^
In file included from /opt/ros/foxy/include/rclcpp/executors/single_threaded_executor.hpp:28,
                 from /opt/ros/foxy/include/rclcpp/executors.hpp:22,
                 from /opt/ros/foxy/include/rclcpp/rclcpp.hpp:146,
                 from /home/huangpan1/tello_1410/tello-ros2/slam/src/orbslam2/src/monocular/monocular-slam-node.hpp:10,
                 from /home/huangpan1/tello_1410/tello-ros2/slam/src/orbslam2/src/monocular/monocular-slam-node.cpp:1:
/opt/ros/foxy/include/rclcpp/node.hpp:213:3: note: candidate: ‘template<class MessageT, class CallbackT, class AllocatorT, class CallbackMessageT, class SubscriptionT, class MessageMemoryStrategyT> std::shared_ptr<SubscriptionT> rclcpp::Node::create_subscription(const string&, const rclcpp::QoS&, CallbackT&&, const rclcpp::SubscriptionOptionsWithAllocator<AllocatorT>&, typename MessageMemoryStrategyT::SharedPtr)’
  213 |   create_subscription(
      |   ^~~~~~~~~~~~~~~~~~~
/opt/ros/foxy/include/rclcpp/node.hpp:213:3: note:   template argument deduction/substitution failed:
/home/huangpan1/tello_1410/tello-ros2/slam/src/orbslam2/src/monocular/monocular-slam-node.cpp:20:141: note:   candidate expects 5 arguments, 2 provided
   20 |     m_image_subscriber = this->create_subscription<ImageMsg>("camera", std::bind(&MonocularSlamNode::GrabImage, this, std::placeholders::_1));
      |                                                                                                                                             ^
/home/huangpan1/tello_1410/tello-ros2/slam/src/orbslam2/src/monocular/monocular-slam-node.cpp:22:85: error: no matching function for call to ‘MonocularSlamNode::create_publisher<ImageMsg>(const char [16])’
   22 |     m_annotated_image_publisher = this->create_publisher<ImageMsg>("annotated_frame");
      |                                                                                     ^
In file included from /opt/ros/foxy/include/rclcpp/executors/single_threaded_executor.hpp:28,
                 from /opt/ros/foxy/include/rclcpp/executors.hpp:22,
                 from /opt/ros/foxy/include/rclcpp/rclcpp.hpp:146,
                 from /home/huangpan1/tello_1410/tello-ros2/slam/src/orbslam2/src/monocular/monocular-slam-node.hpp:10,
                 from /home/huangpan1/tello_1410/tello-ros2/slam/src/orbslam2/src/monocular/monocular-slam-node.cpp:1:
/opt/ros/foxy/include/rclcpp/node.hpp:184:3: note: candidate: ‘template<class MessageT, class AllocatorT, class PublisherT> std::shared_ptr<PublisherT> rclcpp::Node::create_publisher(const string&, const rclcpp::QoS&, const rclcpp::PublisherOptionsWithAllocator<AllocatorT>&)’
  184 |   create_publisher(
      |   ^~~~~~~~~~~~~~~~
/opt/ros/foxy/include/rclcpp/node.hpp:184:3: note:   template argument deduction/substitution failed:
/home/huangpan1/tello_1410/tello-ros2/slam/src/orbslam2/src/monocular/monocular-slam-node.cpp:22:85: note:   candidate expects 3 arguments, 1 provided
   22 |     m_annotated_image_publisher = this->create_publisher<ImageMsg>("annotated_frame");
      |                                                                                     ^
/home ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2022-10-17 05:38:01 -0600

ravijoshi gravatar image

updated 2022-10-17 05:38:58 -0600

I looked at the source code and found something strange. A subscription must be defined with a QoS, which is surprisingly not mentioned in the code. Therefore, please edit the source code (tello-ros2/slam/src/orbslam2/src/monocular/monocular-slam-node.cpp) by adding appropriate QoS. An example is shown below:

m_image_subscriber = this->create_subscription<ImageMsg>("camera", 10, std::bind(&MonocularSlamNode::GrabImage, this, std::placeholders::_1));

Please inform us if the problem persists.

edit flag offensive delete link more

Comments

Thanks, indeed I arrived to the same solution after googling and I found some similar question posted on another github repository. Similarly, I fixed the error on the create_publisher function as well. Thank you!

damiano gravatar image damiano  ( 2022-10-17 06:01:32 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2022-10-17 03:52:55 -0600

Seen: 1,325 times

Last updated: Oct 17 '22