avr_bridge help
I tried to run the the 'hello' example given in the tutorial. I first generated avr_ros library which i then included in the libraries folder in arduino(/usr/share/arduino).I then edited the files to make all header refference local by removing "avr-ros/" from all headers. This the final program i got
#include <stdio.h>
#include <span style="color: #006699;">"ros.h"</span> <span style="color: #7E7E7E;">//main avrRos library</span>
#include <span style="color: #006699;">"String.h"</span> <span style="color: #7E7E7E;">//std_msg/String library</span>
namespace ros {
<span style="color: #CC6600;">int</span> fputc(<span style="color: #CC6600;">char</span> c, FILE *stream) {
<span style="color: #CC6600;"><b>Serial</b></span>.<span style="color: #CC6600;">write</span>(c);
<span style="color: #CC6600;">return</span> 0;
}
}
<span style="color: #7E7E7E;">//Define global message objects to use in</span>
<span style="color: #7E7E7E;">//the callback functions and throughout the program</span>
<span style="color: #7E7E7E;"><b>ros:</b></span>:Publisher resp;
<span style="color: #7E7E7E;"><b>std_msgs:</b></span>:String call_msg;
<span style="color: #7E7E7E;"><b>std_msgs:</b></span>:String response_msg;
<span style="color: #CC6600;">void</span> toggle()
{ <span style="color: #7E7E7E;">//toggle an led to debug the program</span>
<span style="color: #CC6600;">static</span> <span style="color: #CC6600;">char</span> t=0;
<span style="color: #CC6600;">if</span> (!t ) {
<span style="color: #CC6600;">digitalWrite</span>(13, <span style="color: #006699;">HIGH</span>); <span style="color: #7E7E7E;">// set the LED on</span>
t = 1;
} <span style="color: #CC6600;">else</span> {
<span style="color: #CC6600;">digitalWrite</span>(13, <span style="color: #006699;">LOW</span>); <span style="color: #7E7E7E;">// set the LED off</span>
t = 0;
}
}
<span style="color: #CC6600;">void</span> response(Msg *msg){
toggle();
<span style="color: #7E7E7E;">//make sure that if you are manipulating the raw string,</span>
<span style="color: #7E7E7E;">//there is enough space in it</span>
<span style="color: #7E7E7E;">//to handle all of the data</span>
sprintf(response_msg.data.getRawString(),
<span style="color: #006699;">"You sent : %s"</span>, call_msg.data.getRawString());
node.publish(resp ...