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

Committer:
nucho
Date:
Wed Feb 29 23:00:21 2012 +0000
Revision:
4:684f39d0c346
Parent:
3:1cf99502f396

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nucho 3:1cf99502f396 1 //#define COMPILE_TIME_CODE_ROSSERIAL
nucho 3:1cf99502f396 2 #ifdef COMPILE_TIME_CODE_ROSSERIAL
nucho 3:1cf99502f396 3
nucho 3:1cf99502f396 4 /*
nucho 3:1cf99502f396 5 * rosserial::std_msgs::Time Test
nucho 3:1cf99502f396 6 * Publishes current time
nucho 3:1cf99502f396 7 */
nucho 3:1cf99502f396 8
nucho 3:1cf99502f396 9 #include "mbed.h"
nucho 3:1cf99502f396 10 #include <ros.h>
nucho 3:1cf99502f396 11 #include <ros/time.h>
nucho 3:1cf99502f396 12 #include <std_msgs/Time.h>
nucho 3:1cf99502f396 13
nucho 3:1cf99502f396 14
nucho 3:1cf99502f396 15 ros::NodeHandle nh;
nucho 3:1cf99502f396 16
nucho 3:1cf99502f396 17 std_msgs::Time test;
nucho 3:1cf99502f396 18 ros::Publisher p("my_topic", &test);
nucho 3:1cf99502f396 19
nucho 3:1cf99502f396 20 int main() {
nucho 3:1cf99502f396 21 nh.initNode();
nucho 3:1cf99502f396 22 nh.advertise(p);
nucho 3:1cf99502f396 23
nucho 3:1cf99502f396 24 while (1) {
nucho 3:1cf99502f396 25 test.data = nh.now();
nucho 3:1cf99502f396 26 p.publish( &test );
nucho 3:1cf99502f396 27 nh.spinOnce();
nucho 3:1cf99502f396 28 wait_ms(10);
nucho 3:1cf99502f396 29 }
nucho 3:1cf99502f396 30 }
nucho 3:1cf99502f396 31 #endif