Created
August 16, 2017 06:37
-
-
Save sipah00/0a0a4742f0cf9959017545304edaa760 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "ros/ros.h" | |
#include "std_msgs/String.h" | |
#include <sstream> | |
int main(int argc, char **argv){ | |
ros::init(argc, argv, “talker”); | |
ros::NodeHandle n; | |
ros::Publisher chatter_pub = n.advertise<std_msgs::String>(“chatter”, 1000); | |
ros::Rate loop_rate(10); | |
int count = 0; | |
while (ros::ok()){ | |
std_msgs::String msg; | |
std::stringstream ss; | |
ss << “hello world “ << count; | |
msg.data = ss.str(); | |
ROS_INFO(“%s”, msg.data.c_str()); | |
chatter_pub.publish(msg); | |
ros::spinOnce(); | |
loop_rate.sleep(); | |
++count; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment