Go to the documentation of this file.00001 #include <ros/ros.h>
00002 #include <std_msgs/String.h>
00003 #include <sstream>
00004 #include <iostream>
00005 #include <string>
00006 using std::string;
00007 using std::cin;
00008 using std::cout;
00009 using std::endl;
00010 int main(int argc, char** argv)
00011 {
00012 ros::init(argc, argv, "command_generator_node");
00013 ros::NodeHandle n;
00014 ros::Publisher chatter_pub = n.advertise<std_msgs::String>("command_generator_PR2_topic", 1);
00015 string str1;
00016 cout<<"-------COMMANDS---------"<<endl;
00017
00018
00019 cout<<"------------------------"<<endl;
00020 while (ros::ok())
00021 {
00022 std_msgs::String msg;
00023 cin>>str1;
00024 msg.data=str1;
00025 chatter_pub.publish(msg);
00026 ros::spinOnce();
00027
00028 if(str1.compare("q")==0)
00029 {
00030 sleep(1);
00031 return EXIT_SUCCESS;
00032 }
00033
00034 }
00035 }
00036