HelloROS.cpp
Go to the documentation of this file.
00001 /*
00002  * rosserial Publisher Example
00003  * Prints "hello ROS!"
00004  */
00005 
00006 #include <ros.h>
00007 #include <std_msgs/String.h>
00008 #include <stdio.h>
00009 
00010 ros::NodeHandle  nh;
00011 
00012 std_msgs::String str_msg;
00013 ros::Publisher chatter("chatter", &str_msg);
00014 
00015 char *rosSrvrIp = "192.168.15.121";
00016 char hello[13] = "Hello ROS!";
00017 
00018 int main()
00019 {
00020         //nh.initNode();
00021         nh.initNode(rosSrvrIp);
00022         nh.advertise(chatter);
00023         while(1) {
00024                   str_msg.data = hello;
00025                   chatter.publish( &str_msg );
00026                   nh.spinOnce();
00027                   printf("chattered\n");
00028                   sleep(1);
00029         }
00030 }
00031 


rosserial_embeddedlinux
Author(s): Paul Bouchier
autogenerated on Fri Aug 28 2015 12:44:53