Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed Servo rosserial_mbed_String_PubSub ros_lib_kinetic roscar_ver_20190501_copy
Diff: main.cpp
- Revision:
- 2:8b3e4bfa29e5
- Parent:
- 1:fb8f963047b0
- Child:
- 3:6690a73cf982
diff -r fb8f963047b0 -r 8b3e4bfa29e5 main.cpp
--- a/main.cpp Mon Aug 13 19:25:13 2018 +0000
+++ b/main.cpp Fri Aug 24 20:26:57 2018 +0000
@@ -4,31 +4,30 @@
*/
#include "mbed.h"
#include <ros.h>
-#include <geometry_msgs/Twist.h>
+#include <std_msgs/Char.h>
ros::NodeHandle nh;
DigitalOut myled(LED1);
-geometry_msgs::Twist commandRead;
+std_msgs::Char commandRead;
ros::Publisher chatter("chatter", &commandRead);
// /*
-void handlerFunction(const geometry_msgs::Twist& command){
- commandRead = command;
+void handlerFunction(const std_msgs::Char& commandSend){
+ commandRead = commandSend;
}
// */
-ros::Subscriber<geometry_msgs::Twist> sub("cmd_vel", &handlerFunction);
+ros::Subscriber<std_msgs::> sub("cmd_vel", &handlerFunction);
int main() {
nh.initNode();
nh.subscribe(sub);
nh.advertise(chatter);
- commandRead.linear.x = 6.9;
+ commandRead.data= 'X';
while (1) {
- //commandRead = command;
chatter.publish( &commandRead);
nh.spinOnce();
wait_ms(10);