modify for Hydro version
Fork of rosserial_mbed_lib by
main.cpp@1:ff0ec969dad1, 2011-10-16 (annotated)
- Committer:
- nucho
- Date:
- Sun Oct 16 07:19:36 2011 +0000
- Revision:
- 1:ff0ec969dad1
This program supported the revision of 143 of rosserial.
And the bug fix of receive of array data.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
nucho | 1:ff0ec969dad1 | 1 | /* |
nucho | 1:ff0ec969dad1 | 2 | * rosserial Publisher Example |
nucho | 1:ff0ec969dad1 | 3 | * Prints "hello world!" |
nucho | 1:ff0ec969dad1 | 4 | */ |
nucho | 1:ff0ec969dad1 | 5 | |
nucho | 1:ff0ec969dad1 | 6 | #include"mbed.h" |
nucho | 1:ff0ec969dad1 | 7 | #include <ros.h> |
nucho | 1:ff0ec969dad1 | 8 | #include <std_msgs/String.h> |
nucho | 1:ff0ec969dad1 | 9 | |
nucho | 1:ff0ec969dad1 | 10 | ros::NodeHandle nh; |
nucho | 1:ff0ec969dad1 | 11 | |
nucho | 1:ff0ec969dad1 | 12 | std_msgs::String str_msg; |
nucho | 1:ff0ec969dad1 | 13 | ros::Publisher chatter("chatter", &str_msg); |
nucho | 1:ff0ec969dad1 | 14 | |
nucho | 1:ff0ec969dad1 | 15 | char hello[13] = "hello world!"; |
nucho | 1:ff0ec969dad1 | 16 | |
nucho | 1:ff0ec969dad1 | 17 | int main() { |
nucho | 1:ff0ec969dad1 | 18 | nh.initNode(); |
nucho | 1:ff0ec969dad1 | 19 | nh.advertise(chatter); |
nucho | 1:ff0ec969dad1 | 20 | |
nucho | 1:ff0ec969dad1 | 21 | while (1) { |
nucho | 1:ff0ec969dad1 | 22 | str_msg.data = hello; |
nucho | 1:ff0ec969dad1 | 23 | chatter.publish( &str_msg ); |
nucho | 1:ff0ec969dad1 | 24 | nh.spinOnce(); |
nucho | 1:ff0ec969dad1 | 25 | wait_ms(1000); |
nucho | 1:ff0ec969dad1 | 26 | } |
nucho | 1:ff0ec969dad1 | 27 | } |