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

Revision history [back]

click to hide/show revision 1
initial version

I believe this is the same issue as reported in here: https://github.com/ros2/rclcpp/issues/273

std::bind with additional arguments is not getting resolved correctly. However, I believe if you extract your std::bind to a std::function and then pass the function instance to the callback it will work.

std::function<void(std::shared_ptr<sensor_msgs::msg::Imu>)> fnc = std::bind(
   &input_surface_indices_callback, this, std::placeholders::_1, <argument1>, <argument2>);
sub_input_ = node->create_subscription<sensor_msgs::msg::Imu>("input", fnc);

I am assuming here that your callback has a signature like:

void input_surface_indices_callback(std::shared_ptr<sensor_msgs::msg::Imu>, Argument1T arg1, Argument2T arg2);

Could you try that out and see if it works for you?