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

Revision history [back]

The non-stream versions take c-style strings, so they work with something like this:

ROS_INFO("a c-style string");

If you want to print a std::string you can do it one of two ways:

ROS_INFO(s.c_str());  // this prints a C-style string
ROS_INFO_STREAM(s);

For your message, this should work:

ROS_INFO_STREAM(msg);

The non-stream versions take c-style strings, C-style strings (a null terminated character array), so they work with something like this:

ROS_INFO("a c-style string");

If you want to print a std::string you can do it one of two ways:

ROS_INFO(s.c_str());  // this prints a C-style string
ROS_INFO_STREAM(s);

For your message, this should work:

ROS_INFO_STREAM(msg);