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 need to pass boost::shared_ptr in node->create_subscription.

The ROS 2 API is designed with modern C++ in mind and doesn't use boost for features which are part of the C++ standard. So you won't be able to pass a boost::shared_ptr as is.

The following might be options for you:

  • Update your library to use std::shared_ptr instead of boost::shared_ptr.
  • If that is not an option consider to introduce a typedef in your library to either use boost or std and then use the later when interfacing with ROS 2.
  • If neither of the above is an option you will need to fall back to convert to/from raw pointers instead.