Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Ros subscriber

Hi, Can somebody explain me the following line of code line by line ? The code has been taken from ros tutorials.

87 std_msgs::String msg; 88 89 std::stringstream ss; 90 ss << "hello world " << count; 91 msg.data = ss.str(); 92 93 ROS_INFO("%s", msg.data.c_str());

Here is the link to the code http://wiki.ros.org/ROS/Tutorials/WritingPublisherSubscriber%28c%2B%2B%29

Ros subscriber

Hi, Can somebody explain me the following line of code line by line ? The code has been taken from ros tutorials.

87

  std_msgs::String msg;
  88 
  89     std::stringstream ss;
  90     ss << "hello world " << count;
  91     msg.data = ss.str();
  92 
  93     ROS_INFO("%s", msg.data.c_str());

msg.data.c_str());

Here is the link to the code http://wiki.ros.org/ROS/Tutorials/WritingPublisherSubscriber%28c%2B%2B%29