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 
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
void publish(const boost::shared_ptr< M > &message) const
ros::NodeHandle nh
Definition: ADC.cpp:31
ros::Publisher p("adc",&adc_msg)
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
int main()
Definition: ADC.cpp:46


rosserial_mbed
Author(s): Gary Servin
autogenerated on Fri Jun 7 2019 22:02:48