This program is porting rosserial_arduino for mbed http://www.ros.org/wiki/rosserial_arduino This program supported the revision of 169 of rosserial.
Dependents: rosserial_mbed robot_S2
tests/time_test.cpp@3:1cf99502f396, 2011-11-12 (annotated)
- Committer:
- nucho
- Date:
- Sat Nov 12 23:54:45 2011 +0000
- Revision:
- 3:1cf99502f396
This program supported the revision of 167 of rosserial.
Who changed what in which revision?
User | Revision | Line number | New 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 |