Ros-RTOS helloworld example project

Dependencies:   mbed-rtos mbed ros_lib_indigo

Files at this revision

API Documentation at this revision

Comitter:
randalthor
Date:
Wed Jan 04 17:13:52 2017 +0000
Commit message:
Ros RTOS hello world example project

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-rtos.lib 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_indigo.lib Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 4934245d6d7a main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Jan 04 17:13:52 2017 +0000
@@ -0,0 +1,41 @@
+#include "mbed.h"
+#include "rtos.h"
+#include "cmsis_os.h"
+#include <ros.h>
+#include <std_msgs/String.h>
+
+
+
+ros::NodeHandle  nh;
+std_msgs::String str_msg;
+ros::Publisher chatter("chatter", &str_msg);
+
+
+DigitalOut led1(LED1);
+
+void print_thread(void const *argument)
+{
+    char hello[13] = "hello world!"; 
+    while (true) {
+        Thread::wait(1000);
+        str_msg.data = hello;
+        chatter.publish( &str_msg );
+        nh.spinOnce();
+       
+    }
+}
+
+int main()
+{
+    nh.initNode();
+    nh.advertise(chatter);
+    
+  
+    Thread thread(print_thread, NULL, osPriorityNormal, DEFAULT_STACK_SIZE);
+    
+    while (true) {
+        led1 = !led1;
+        Thread::wait(500);
+    }
+    
+}
diff -r 000000000000 -r 4934245d6d7a mbed-rtos.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-rtos.lib	Wed Jan 04 17:13:52 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed-rtos/#58563e6cba1e
diff -r 000000000000 -r 4934245d6d7a mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Jan 04 17:13:52 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/faff56e089b2
\ No newline at end of file
diff -r 000000000000 -r 4934245d6d7a ros_lib_indigo.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ros_lib_indigo.lib	Wed Jan 04 17:13:52 2017 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/users/garyservin/code/ros_lib_indigo/#fd24f7ca9688