HelloROS.cpp
Go to the documentation of this file.
1 /*
2  * rosserial Publisher Example
3  * Prints "hello ROS!"
4  */
5 
6 #include <ros.h>
7 #include <std_msgs/String.h>
8 #include <stdio.h>
9 
11 
12 std_msgs::String str_msg;
13 ros::Publisher chatter("chatter", &str_msg);
14 
15 char *rosSrvrIp = "192.168.15.121";
16 char hello[13] = "Hello ROS!";
17 
18 int main()
19 {
20  //nh.initNode();
21  nh.initNode(rosSrvrIp);
22  nh.advertise(chatter);
23  while(1) {
24  str_msg.data = hello;
26  nh.spinOnce();
27  printf("chattered\n");
28  sleep(1);
29  }
30 }
31 
int main()
Definition: HelloROS.cpp:18
void publish(const boost::shared_ptr< M > &message) const
std_msgs::String str_msg
Definition: HelloROS.cpp:12
ros::Publisher chatter("chatter",&str_msg)
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
char hello[13]
Definition: HelloROS.cpp:16
ros::NodeHandle nh
Definition: HelloROS.cpp:10
char * rosSrvrIp
Definition: HelloROS.cpp:15


rosserial_embeddedlinux
Author(s): Paul Bouchier
autogenerated on Mon Jun 10 2019 14:53:23