publish test

Dependencies:   mbed ros_lib_kinetic

Files at this revision

API Documentation at this revision

Comitter:
okapi
Date:
Wed Jun 19 11:14:11 2019 +0000
Commit message:
rfrd

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
ros_lib_kinetic.lib Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Jun 19 11:14:11 2019 +0000
@@ -0,0 +1,24 @@
+#include "mbed.h"
+#include <ros.h>
+#include <std_msgs/String.h>
+
+ros::NodeHandle nh;
+
+std_msgs::String str_msg;
+ros::Publisher chatter("Chatter", &str_msg);
+
+char hello[13] = "hello world!";
+
+int main(){
+    nh.getHardware()->setBaud(115200);
+    nh.initNode();
+    nh.advertise(chatter);
+    
+    while(1){
+        str_msg.data = hello;
+        chatter.publish( &str_msg );
+        nh.spinOnce();
+        wait_ms(1000);
+    }
+}
+        
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Jun 19 11:14:11 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/e95d10626187
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ros_lib_kinetic.lib	Wed Jun 19 11:14:11 2019 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/users/garyservin/code/ros_lib_kinetic/#a849bf78d77f