root / quad2 / arduino / src / ros_lib / tests / time_test / time_test.pde @ c1426757
History | View | Annotate | Download (390 Bytes)
1 | c1426757 | Tom Mullins | /* |
---|---|---|---|
2 | * rosserial::std_msgs::Time Test |
||
3 | * Publishes current time |
||
4 | */ |
||
5 | |||
6 | #include <ros.h> |
||
7 | #include <ros/time.h> |
||
8 | #include <std_msgs/Time.h> |
||
9 | |||
10 | |||
11 | ros::NodeHandle nh; |
||
12 | |||
13 | std_msgs::Time test; |
||
14 | ros::Publisher p("my_topic", &test); |
||
15 | |||
16 | void setup() |
||
17 | { |
||
18 | pinMode(13, OUTPUT); |
||
19 | nh.initNode(); |
||
20 | nh.advertise(p); |
||
21 | } |
||
22 | |||
23 | void loop() |
||
24 | { |
||
25 | test.data = nh.now(); |
||
26 | p.publish( &test ); |
||
27 | nh.spinOnce(); |
||
28 | delay(10); |
||
29 | } |