Robotics StackExchange | Archived questions

create own string msg

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?

Asked by Knowledge on 2016-03-27 13:51:01 UTC

Comments

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...

Asked by Augusto Luis Ballardini on 2016-03-27 14:15:26 UTC

Answers