This program is porting rosserial_arduino for mbed http://www.ros.org/wiki/rosserial_arduino This program supported the revision of 169 of rosserial.

Dependencies:  

Dependents:   rosserial_mbed robot_S2

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers time_test.cpp Source File

time_test.cpp

00001 //#define COMPILE_TIME_CODE_ROSSERIAL
00002 #ifdef COMPILE_TIME_CODE_ROSSERIAL
00003 
00004 /*
00005  * rosserial::std_msgs::Time Test
00006  * Publishes current time
00007  */
00008 
00009 #include "mbed.h"
00010 #include <ros.h>
00011 #include <ros/time.h>
00012 #include <std_msgs/Time.h>
00013 
00014 
00015 ros::NodeHandle  nh;
00016 
00017 std_msgs::Time test;
00018 ros::Publisher p("my_topic", &test);
00019 
00020 int main() {
00021     nh.initNode();
00022     nh.advertise(p);
00023 
00024     while (1) {
00025         test.data = nh.now();
00026         p.publish( &test );
00027         nh.spinOnce();
00028         wait_ms(10);
00029     }
00030 }
00031 #endif