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

Revision history [back]

std_msgs::String is not the same thing as std::string and cannot be treated as such; it is a message type that has a std::string member variable called data. Thus, the correct way to output the message string is

ROS_INFO("%s\n", s.data.c_str());