Hi
I tried to create a new node (move_controller) to subscribe the detections topic from DetectNet node.
auto det_sub = ROS_CREATE_SUBSCRIBER(vision_msgs::Detection2DArray, “detections”, 25, det_callback);
However, I’m wondering what kind of the arguments that I should design in the callback function (det_callback).
In the image reletaed topic, it uses the following design in the callback, the sensor_msgs::ImageConstPtr is included.
void img_callback( const sensor_msgs::ImageConstPtr input )
However, in namespace vision_msgs , I don’t see any pointers could be used for callback function.
When I design the callback as follows:
void det_callback( const vision_msgs::Detection2DArray input)
I got the following error from compiler:
/home/jetbot/ros_workspace/src/ros_deep_learning_project/src/node_move_controller.cpp:25:17: required from here
/opt/ros/eloquent/include/rclcpp/subscription_factory.hpp:87:3: error: no matching function for call to ‘rclcpp::AnySubscriptionCallback<vision_msgs::msg::Detection2DArray_<std::allocator<void> >, std::allocator<void> >::set(void (&)(vision_msgs::msg::Detection2DArray_<std::allocator<void> >))’
any_subscription_callback.set(std::forward<CallbackT>(callback));
In file included from /opt/ros/eloquent/include/rclcpp/subscription_base.hpp:26:0,
from /opt/ros/eloquent/include/rclcpp/callback_group.hpp:26,
from /opt/ros/eloquent/include/rclcpp/any_executable.hpp:20,
from /opt/ros/eloquent/include/rclcpp/memory_strategy.hpp:24,
from /opt/ros/eloquent/include/rclcpp/memory_strategies.hpp:18,
from /opt/ros/eloquent/include/rclcpp/executor.hpp:33,
from /opt/ros/eloquent/include/rclcpp/executors/multi_threaded_executor.hpp:25,
from /opt/ros/eloquent/include/rclcpp/executors.hpp:21,
from /opt/ros/eloquent/include/rclcpp/rclcpp.hpp:145,
from /home/jetbot/ros_workspace/src/ros_deep_learning_project/src/ros_compat.h:71,
from /home/jetbot/ros_workspace/src/ros_deep_learning_project/src/node_move_controller.cpp:1:
Does anyone know how to implement the callback in the right way with C++?