src
tests
time_test
time_test.cpp
Go to the documentation of this file.
1
//#define COMPILE_TIME_CODE_ROSSERIAL
2
#ifdef COMPILE_TIME_CODE_ROSSERIAL
3
4
/*
5
* rosserial::std_msgs::Time Test
6
* Publishes current time
7
*/
8
9
#include "mbed.h"
10
#include <ros.h>
11
#include <ros/time.h>
12
#include <std_msgs/Time.h>
13
14
15
ros::NodeHandle
nh
;
16
17
std_msgs::Time
test
;
18
ros::Publisher
p
(
"my_topic"
, &
test
);
19
20
int
main
() {
21
nh
.initNode();
22
nh
.
advertise
(
p
);
23
24
while
(1) {
25
test
.data =
nh
.now();
26
p
.
publish
( &
test
);
27
nh
.spinOnce();
28
wait_ms(10);
29
}
30
}
31
#endif
main
int main()
Definition:
ADC.cpp:46
ros::Publisher
ros::Publisher::publish
void publish(const boost::shared_ptr< M > &message) const
ros::NodeHandle::advertise
Publisher advertise(AdvertiseOptions &ops)
test
nh
ros::NodeHandle nh
Definition:
ADC.cpp:31
p
ros::Publisher p("adc", &adc_msg)
ros::NodeHandle
rosserial_mbed
Author(s): Gary Servin
autogenerated on Wed Mar 2 2022 00:58:08