Statistics
| Branch: | Revision:

root / quad2 / arduino / src / ros_lib / examples / Logging / Logging.pde @ c1426757

History | View | Annotate | Download (717 Bytes)

1
/*
2
 * rosserial PubSub Example
3
 * Prints "hello world!" and toggles led
4
 */
5

    
6
#include <ros.h>
7
#include <std_msgs/String.h>
8
#include <std_msgs/Empty.h>
9

    
10
ros::NodeHandle  nh;
11

    
12

    
13
std_msgs::String str_msg;
14
ros::Publisher chatter("chatter", &str_msg);
15

    
16
char hello[13] = "hello world!";
17

    
18

    
19
char debug[]= "debug statements";
20
char info[] = "infos";
21
char warn[] = "warnings";
22
char error[] = "errors";
23
char fatal[] = "fatalities";
24

    
25
void setup()
26
{
27
  pinMode(13, OUTPUT);
28
  nh.initNode();
29
  nh.advertise(chatter);
30
}
31

    
32
void loop()
33
{
34
  str_msg.data = hello;
35
  chatter.publish( &str_msg );
36
  
37
  nh.logdebug(debug);
38
  nh.loginfo(info);
39
  nh.logwarn(warn);
40
  nh.logerror(error);
41
  nh.logfatal(fatal);
42
  
43
  nh.spinOnce();
44
  delay(500);
45
}