rosserial library for mbed Inspired by nucho's rosserial library This library is still under development
Dependents: mbed_roshydro_test
Library still under development!
tests/time_test.cpp@0:30537dec6e0b, 2015-02-15 (annotated)
- Committer:
- akashvibhute
- Date:
- Sun Feb 15 10:53:43 2015 +0000
- Revision:
- 0:30537dec6e0b
First commit; Library still need to be debugged, compilation issues with new mbed and modserial updates.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
akashvibhute | 0:30537dec6e0b | 1 | //#define COMPILE_TIME_CODE_ROSSERIAL |
akashvibhute | 0:30537dec6e0b | 2 | #ifdef COMPILE_TIME_CODE_ROSSERIAL |
akashvibhute | 0:30537dec6e0b | 3 | |
akashvibhute | 0:30537dec6e0b | 4 | /* |
akashvibhute | 0:30537dec6e0b | 5 | * rosserial::std_msgs::Time Test |
akashvibhute | 0:30537dec6e0b | 6 | * Publishes current time |
akashvibhute | 0:30537dec6e0b | 7 | */ |
akashvibhute | 0:30537dec6e0b | 8 | |
akashvibhute | 0:30537dec6e0b | 9 | #include "mbed.h" |
akashvibhute | 0:30537dec6e0b | 10 | #include <ros.h> |
akashvibhute | 0:30537dec6e0b | 11 | #include <ros/time.h> |
akashvibhute | 0:30537dec6e0b | 12 | #include <std_msgs/Time.h> |
akashvibhute | 0:30537dec6e0b | 13 | |
akashvibhute | 0:30537dec6e0b | 14 | |
akashvibhute | 0:30537dec6e0b | 15 | ros::NodeHandle nh; |
akashvibhute | 0:30537dec6e0b | 16 | |
akashvibhute | 0:30537dec6e0b | 17 | std_msgs::Time test; |
akashvibhute | 0:30537dec6e0b | 18 | ros::Publisher p("my_topic", &test); |
akashvibhute | 0:30537dec6e0b | 19 | |
akashvibhute | 0:30537dec6e0b | 20 | int main() { |
akashvibhute | 0:30537dec6e0b | 21 | nh.initNode(); |
akashvibhute | 0:30537dec6e0b | 22 | nh.advertise(p); |
akashvibhute | 0:30537dec6e0b | 23 | |
akashvibhute | 0:30537dec6e0b | 24 | while (1) { |
akashvibhute | 0:30537dec6e0b | 25 | test.data = nh.now(); |
akashvibhute | 0:30537dec6e0b | 26 | p.publish( &test ); |
akashvibhute | 0:30537dec6e0b | 27 | nh.spinOnce(); |
akashvibhute | 0:30537dec6e0b | 28 | wait_ms(10); |
akashvibhute | 0:30537dec6e0b | 29 | } |
akashvibhute | 0:30537dec6e0b | 30 | } |
akashvibhute | 0:30537dec6e0b | 31 | #endif |