create own string msg

asked 2016-03-27 13:51:01 -0500

Knowledge gravatar image

Hello, I have created my own ros msg file and am using it in my code. When i use the following code, std_msgs::String msg;

std::stringstream ss;
ss << "hello world " << count;
msg.data = ss.str();

it says ss wasn't declared in this scope. I have used data as a member of the string i created in the msg file. Please tell me what am i missing?

edit retag flag offensive close merge delete

Comments

3

Why stringstream? According to http://wiki.ros.org/msg#Fields you should use std::string . Please post answers with full code and with the .msg section too. Moreover, this seems to me a C++ issue, not a ROS related one...

Augusto Luis Ballardini gravatar image Augusto Luis Ballardini  ( 2016-03-27 14:15:26 -0500 )edit